Yujie Wu avatar Yujie Wu committed 576c02e Merge

flow: Merged <hotfix/0.9.5> 'abort_erase' to <hotfix/0.9.5> ('hotfix/0.9.5').

Comments (0)

Files changed (1)

         """
         kwarg          = _getopt( self.ui, "abort", kwarg )
         msg            = kwarg.pop( "message",  ""    )
+        should_erase   = kwarg.pop( "erase",    False )
         onstream       = kwarg.pop( "onstream", False )
         curr_workspace = self.curr_workspace
         if (msg) :
             elif (stream._trunk) :
                 branches.append( stream.trunk() )
             for branch in branches :
-                self._update( branch )
-                self._commit( close_branch = True, message = "%s%sAborted %s %s." %
-                              (msg, self.msg_prefix, stream, branch.basename( stream, should_quote = True ),) )
-            if (self.curr_workspace != self.orig_workspace) :
+                if (should_erase) :
+                    self._strip( rev = ["branch('%s')" % branch,] )
+                else :
+                    self._update( branch )
+                    self._commit( close_branch = True, message = "%s%sAborted %s %s." %
+                                  (msg, self.msg_prefix, stream, branch.basename( stream, should_quote = True ),) )
+            if (self.curr_workspace != self.orig_workspace and self._orig_workspace not in branches) :
                 self._update( self.orig_workspace )
         else :
             if (curr_workspace.is_trunk( stream )) :
             if (curr_workspace not in stream) :
                 raise AbortFlow( "Your workspace is '%s' branch, which is not in %s." % (curr_workspace, stream,),
                                  "To abort a %s branch, you must first update to it." % stream )
-            self._commit( close_branch = True, message = "%s%sAborted %s '%s'." %
-                          (msg, self.msg_prefix, stream, curr_workspace.basename( stream ),) )
+            if (should_erase) :
+                self._strip( rev = ["branch('%s')" % curr_workspace,] )
+            else :
+                self._commit( close_branch = True, message = "%s%sAborted %s '%s'." %
+                              (msg, self.msg_prefix, stream, curr_workspace.basename( stream ),) )
             self._update( stream.trunk( trace = True ) )
         self._unshelve()
 
 """,
         
 "@abort" : """
-Abort the workspace branch, which is to simply close the branch.
+Aborting the workspace branch can be done in two ways:
+1. The default way is simply marking the branch as closed so that it will not
+   show up when you list alive branches, but all changesets in the branch
+   remain in the repository and you cannot reuse the branch's name for a
+   different branch.
+2. The other way is erasing the branch, in other words, completely deleting the
+   branch and all changesets in it from the repository. This way is
+   devastating, but you can clear unneeded changesets and reuse the branch's
+   name. To abort a branch in this way, you just add the {{{-e}}} option.
+   N.B.: A branch cannot be erased if you have previously merged it to other
+   branches that remain in the repository.
 
 syntax:
-{{{hg flow <stream> abort [-m <TEXT>]}}}
+{{{hg flow <stream> abort [-m <TEXT>] [-e]}}}
 
 option:
  -m --message TEXT  Record TEXT as commit message when close branch.
+ -e --erase         Abort branch and erase it.
 """,
 
 "@promote" : """
 "finish"  : ("commit", "message", "date", "erase", "onstream",),
 "list"    : ("closed",),
 "log"     : ("file", "date", "keyword", "patch", "git", "limit", "graph", "closed", "onstream",),
-"abort"   : ("onstream", "message",),
+"abort"   : ("erase", "message", "onstream",),
 "promote" : ("rev", "message", "date", "onstream",),
 "rebase"  : ("dest", "onstream",),
 }
       ("",  "dirty",     False, _("Start a new branch from a dirty workspace, and move all"
                                   " uncommitted changes to the new branch. [start]"),                              ),
       ("c", "commit",    False, _("Commit changes before closing the branch. [finish]"),                           ),
-      ("e", "erase",     False, _("Erase branch after it is merged successfully. [finish]"),                       ),
+      ("e", "erase",     False, _("Erase branch after it is merged successfully or aborted. [finish, abort]"),     ),
       ("d", "date",      '',    _("Record the specified date as commit date. [start, finish, promote]"), _('DATE'),),
       ("m", "message",   '',    _("Record TEXT as commit message. [start, finish, promote, abort]"),     _('TEXT'),),
       ("c", "closed",    False, _("Show normal and closed branches in stream. [list, log]"),                       ),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.