lib/update.operations
branchdns-new
changeset 96 bed4765fc56f
parent 95 a756f317d083
child 98 a3734856e0fa
equal deleted inserted replaced
95:a756f317d083 96:bed4765fc56f
   332         do_reload_dhcp
   332         do_reload_dhcp
   333     fi
   333     fi
   334 }
   334 }
   335 
   335 
   336 ### Commit
   336 ### Commit
   337 ## Perform `hg commit`
       
   338 function do_commit {
       
   339     local repo=$1
       
   340     local msg=$1
       
   341 
       
   342     [ $LOG_DIFF ] && indent "    " hg_diff $repo
       
   343 
       
   344     hg_commit $repo "$msg"
       
   345 }
       
   346 
       
   347 
       
   348 ## Commit changes to version control:
   337 ## Commit changes to version control:
   349 #
   338 #
   350 #   commit_data
   339 #   update_commit .../etc "commit message"
   351 #
   340 #
   352 # Invokes `hg commit`, first showing the diff.
   341 # Invokes `hg commit`, first showing the diff.
   353 function update_commit {
   342 function update_commit {
   354     local repo=$1
   343     local repo="$1"
   355     local commit_msg="$COMMIT_MSG"
   344     local commit_msg="$COMMIT_MSG"
   356 
   345 
   357     local msg="Commit changes"
   346     local msg="Commit changes"
   358 
   347 
   359     # operate?
   348     # operate?
   360     if [ $COMMIT_FORCE ]; then
   349     if [ $COMMIT_FORCE ]; then
   361         log_force   "$msg: $commit_msg"
   350         log_force   "$msg: $commit_msg"
   362 
   351 
   363         do_commit "$commit_msg"
   352         [ $LOG_DIFF ] && indent "    " hg_diff $repo
   364 
   353 
   365     elif ! hg_modified $repo; then
   354         hg_commit "$repo" "$commit_msg"
       
   355 
       
   356     elif ! hg_modified "$repo"; then
   366         log_warn    "$msg: no changes"
   357         log_warn    "$msg: no changes"
   367 
   358 
   368     elif [ $COMMIT_SKIP ]; then
   359     elif [ $COMMIT_SKIP ]; then
   369         log_noop    "$msg: skipped"
   360         log_noop    "$msg: skipped"
   370         
   361         
   371         # still show diff, though
   362         # still show diff, though
       
   363         [ $LOG_DIFF ] && indent "    " hg_diff "$repo"
       
   364     else
       
   365         log_update  "$msg: $commit_msg"
       
   366 
   372         [ $LOG_DIFF ] && indent "    " hg_diff $repo
   367         [ $LOG_DIFF ] && indent "    " hg_diff $repo
   373     else
   368 
   374         log_update  "$msg: $commit_msg"
   369         hg_commit "$repo" "$commit_msg"
   375 
   370     fi
   376         do_commit $repo "$commit_msg"
   371 }
   377     fi
       
   378 }