lib/update.operations
branchdns-new
changeset 612 51270237a6ff
parent 611 52d058780506
child 613 5b33ccac38ad
equal deleted inserted replaced
611:52d058780506 612:51270237a6ff
   321 }
   321 }
   322 
   322 
   323 ### Commit
   323 ### Commit
   324 ## Perform `hg commit`
   324 ## Perform `hg commit`
   325 function do_commit {
   325 function do_commit {
       
   326     local repo=$1
   326     local msg=$1
   327     local msg=$1
   327 
   328 
   328     [ $LOG_DIFF ] && indent "    " hg_diff
   329     [ $LOG_DIFF ] && indent "    " hg_diff $repo
   329 
   330 
   330     hg_commit "$msg"
   331     hg_commit $repo "$msg"
   331 }
   332 }
   332 
   333 
   333 
   334 
   334 ## Commit changes to version control:
   335 ## Commit changes to version control:
   335 #
   336 #
   336 #   commit_data
   337 #   commit_data
   337 #
   338 #
   338 # Invokes `hg commit`, first showing the diff.
   339 # Invokes `hg commit`, first showing the diff.
   339 function commit_data {
   340 function commit {
       
   341     local repo=$1
   340     local commit_msg="$COMMIT_MSG"
   342     local commit_msg="$COMMIT_MSG"
   341 
   343 
   342     local msg="Commit changes"
   344     local msg="Commit changes"
   343 
   345 
   344     # operate?
   346     # operate?
   345     if [ $COMMIT_FORCE ]; then
   347     if [ $COMMIT_FORCE ]; then
   346         log_force   "$msg..."
   348         log_force   "$msg..."
   347 
   349 
   348         do_commit "$commit_msg"
   350         do_commit "$commit_msg"
   349 
   351 
   350     elif ! hg_modified; then
   352     elif ! hg_modified $repo; then
   351         log_skip    "$msg: no changes"
   353         log_warn    "$msg: no changes"
   352 
   354 
   353     elif [ $COMMIT_SKIP ]; then
   355     elif [ $COMMIT_SKIP ]; then
   354         log_noop    "$msg: skipped"
   356         log_noop    "$msg: skipped"
   355         
   357         
   356         # still show diff, though
   358         # still show diff, though
   357         [ $LOG_DIFF ] && indent "    " hg_diff
   359         [ $LOG_DIFF ] && indent "    " hg_diff $repo
   358     else
   360     else
   359         log_update  "$msg..."
   361         log_update  "$msg..."
   360 
   362 
   361         do_commit "$commit_msg"
   363         do_commit $repo "$commit_msg"
   362     fi
   364     fi
   363 }
   365 }