[PATCH 2 of 3 v2] histedit: allow actions to adjust the default edit plan

timeless timeless at fmr.im
Tue May 3 12:17:56 EDT 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1462292141 0
#      Tue May 03 16:15:41 2016 +0000
# Node ID 69374882b37156b87eea935feeaa696235abf204
# Parent  1cb074950009a30cb6346f667b4cc40bc51c3d0c
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r 69374882b371
histedit: allow actions to adjust the default edit plan

diff -r 1cb074950009 -r 69374882b371 hgext/histedit.py
--- a/hgext/histedit.py	Tue May 03 15:26:51 2016 +0000
+++ b/hgext/histedit.py	Tue May 03 16:15:41 2016 +0000
@@ -499,6 +499,11 @@
             return ctx, []
         return ctx, [(self.node, (ctx.node(),))]
 
+    @classmethod
+    def initialactions(cls, state, actions):
+        """Allows action to adjust the default plan for histedit"""
+        return actions
+
 def commitfuncfor(repo, src):
     """Build a commit function for the replacement of <src>
 
@@ -1244,6 +1249,14 @@
     if not rules:
         comment = geteditcomment(ui, node.short(root), node.short(topmost))
         actions = [pick(state, r) for r in revs]
+        verbs = set()
+        for v in actiontable:
+            action = actiontable[v]
+            verb = action.verb
+            if verb in verbs:
+                continue
+            verbs.add(verb)
+            actions = action.initialactions(state, actions)
         rules = ruleeditor(repo, ui, actions, comment)
     else:
         rules = _readfile(rules)


More information about the Mercurial-devel mailing list