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

login
register
mail settings
Submitter timeless
Date May 3, 2016, 4:17 p.m.
Message ID <69374882b37156b87eea.1462292276@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/14868/
State Changes Requested
Delegated to: Augie Fackler
Headers show

Comments

timeless - May 3, 2016, 4:17 p.m.
# HG changeset patch
# User timeless <timeless@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

Patch

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)