Yujie Wu  committed c304391

Made finish action be --dry-run friendly.

  • Participants
  • Parent commits 25902ee
  • Branches hotfix/0.9.6/fix_finish_commit_bug

Comments (0)

Files changed (1)

File src/

                     will be used as the commit message. It is OK for both of the options to be missing. But it would trigger
                     an error if C{message} is given without C{commit} set to true. There is no special treatment on other
                     keys, and they will be passed to the C{hg commit} command as is.
+        @rtype : C{bool}
+        @return: Return `True' if committing was successfully done, or `False' if it was not.
         if (opt.get( "commit" )) :
             del opt["commit"]
             del opt["message"]
             if (msg is None) :
                 del opt["force_editor"]
+            return True
         elif (opt.get( "message" )) :
             if (is_erasing) :
                 del opt["message"]
             else :
                 raise AbortFlow( "Cannot use the specified commit message.", "Did you forget to specify the -c option?" )
+        return False
     def _action_finish( self, stream, *arg, **kwarg ) :
                 raise AbortFlow( "'--erase' cannot be applied to branches with multiple merge destinations." )
         # Commits changes (if any) in the current branch.
-        self._commit_change( kwarg, "Finishing '%s' branch" % curr_workspace, should_erase )
-        if (self._has_uncommitted_changes()) :
+        is_commit_done = self._commit_change( kwarg, "Finishing '%s' branch" % curr_workspace, should_erase )
+        # If the commit was done successfully, we don't check against uncommitted changes.
+        # This is particularly needed for dry run.
+        if (not is_commit_done and self._has_uncommitted_changes()) :
             raise AbortFlow( "Cannot finish '%s' branch because it has uncommitted changes." % curr_workspace )
         # For destin streams without trunks, we need to create a branch in each of these destin streams.