hgext/histedit.py
changeset 27204 6b77e749af4a
parent 27203 b6a0f0895a25
child 27205 787d8cc3f04e
--- a/hgext/histedit.py	Wed Dec 02 12:19:01 2015 -0800
+++ b/hgext/histedit.py	Wed Dec 02 12:19:01 2015 -0800
@@ -939,7 +939,7 @@
         if not rules:
             comment = editcomment % (node.short(state.parentctxnode),
                                      node.short(state.topmost))
-            rules = ruleeditor(repo, ui, state.rules, comment)
+            rules = ruleeditor(repo, ui, state.actions, comment)
         else:
             if rules == '-':
                 f = sys.stdin
@@ -1022,7 +1022,8 @@
         ctxs = [repo[r] for r in revs]
         if not rules:
             comment = editcomment % (node.short(root), node.short(topmost))
-            rules = ruleeditor(repo, ui, [['pick', c] for c in ctxs], comment)
+            actions = [pick(state, r) for r in revs]
+            rules = ruleeditor(repo, ui, actions, comment)
         else:
             if rules == '-':
                 f = sys.stdin
@@ -1161,12 +1162,12 @@
     maxlen = max(maxlen, 22) # avoid truncating hash
     return util.ellipsis(line, maxlen)
 
-def ruleeditor(repo, ui, rules, editcomment=""):
+def ruleeditor(repo, ui, actions, editcomment=""):
     """open an editor to edit rules
 
     rules are in the format [ [act, ctx], ...] like in state.rules
     """
-    rules = '\n'.join([makedesc(repo, act, rev) for [act, rev] in rules])
+    rules = '\n'.join([act.torule() for act in actions])
     rules += '\n\n'
     rules += editcomment
     rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'})