hgext/histedit.py
changeset 28131 5a2fb2680a39
parent 28130 47317570ab8c
child 28132 2d09a400b495
--- a/hgext/histedit.py	Mon Feb 01 12:51:20 2016 +0000
+++ b/hgext/histedit.py	Mon Feb 01 14:12:38 2016 +0000
@@ -1044,24 +1044,7 @@
         state.read()
         state = bootstrapcontinue(ui, state, opts)
     elif goal == 'edit-plan':
-        state.read()
-        if not rules:
-            comment = geteditcomment(node.short(state.parentctxnode),
-                                     node.short(state.topmost))
-            rules = ruleeditor(repo, ui, state.actions, comment)
-        else:
-            if rules == '-':
-                f = sys.stdin
-            else:
-                f = open(rules)
-            rules = f.read()
-            f.close()
-        actions = parserules(rules, state)
-        ctxs = [repo[act.nodetoverify()] \
-                for act in state.actions if act.nodetoverify()]
-        warnverifyactions(ui, repo, actions, state, ctxs)
-        state.actions = actions
-        state.write()
+        _editplanaction(ui, repo, state, rules)
         return
     elif goal == 'abort':
         _abortaction(ui, repo, state)
@@ -1225,6 +1208,26 @@
     finally:
             state.clear()
 
+def _editplanaction(ui, repo, state, rules):
+    state.read()
+    if not rules:
+        comment = geteditcomment(node.short(state.parentctxnode),
+                                 node.short(state.topmost))
+        rules = ruleeditor(repo, ui, state.actions, comment)
+    else:
+        if rules == '-':
+            f = sys.stdin
+        else:
+            f = open(rules)
+        rules = f.read()
+        f.close()
+    actions = parserules(rules, state)
+    ctxs = [repo[act.nodetoverify()] \
+            for act in state.actions if act.nodetoverify()]
+    warnverifyactions(ui, repo, actions, state, ctxs)
+    state.actions = actions
+    state.write()
+
 def bootstrapcontinue(ui, state, opts):
     repo = state.repo
     if state.actions: