[PATCH 5 of 5] histedit: break _histedit function into smaller pieces (add _continueaction)

Kostia Balytskyi ikostia at fb.com
Mon Feb 1 17:54:04 UTC 2016


# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1454348814 0
#      Mon Feb 01 17:46:54 2016 +0000
# Branch stable
# Node ID a6d5d9f5a18ccc250176665cb67f3d018249958a
# Parent  55512493bd388e75f3d6187a9562330ddc3474e9
histedit: break _histedit function into smaller pieces (add _continueaction)

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1057,23 +1057,29 @@
     goal = _getgoal(opts)
     revs = _validateargs(ui, repo, state, goal, freeargs, opts)
 
-    replacements = []
     state.keep = opts.get('keep', False)
-    supportsmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
 
     # rebuild state
-    if goal == 'continue':
+    if Goal.EDITPLAN == goal:
+        _editplanaction(ui, repo, state, rules)
+        return
+    elif Goal.ABORT == goal:
+        _abortaction(ui, repo, state)
+        return
+    elif Goal.CONTINUE == goal:
         state.read()
         state = bootstrapcontinue(ui, state, opts)
-    elif goal == 'edit-plan':
-        _editplanaction(ui, repo, state, rules)
-        return
-    elif goal == 'abort':
-        _abortaction(ui, repo, state)
-        return
     else:
+        # Goal.NEW == goal
         _newaction(ui, repo, state, revs, freeargs, opts)
 
+    _continueaction(ui, repo, state)
+
+def _continueaction(ui, repo, state):
+    """This action runs after either:
+    -bootstrapcontinue (if goal is CONTINUE)
+    -_newaction (if goal is NEW)
+    """
     # preprocess rules so that we can hide inner folds from the user
     # and only show one editor
     actions = state.actions[:]
@@ -1113,6 +1119,7 @@
                     for n in succs[1:]:
                         ui.debug(m % node.short(n))
 
+    supportsmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
     if supportsmarkers:
         # Only create markers if the temp nodes weren't already removed.
         obsolete.createmarkers(repo, ((repo[t],()) for t in sorted(tmpnodes)


More information about the Mercurial-devel mailing list