[PATCH 1 of 2 RFC] histedit: add optional parameter for determining intial editor line

Sean Farley sean at farley.io
Sat May 7 03:02:09 EDT 2016


# HG changeset patch
# User Sean Farley <sean at farley.io>
# Date 1462582803 25200
#      Fri May 06 18:00:03 2016 -0700
# Node ID d4c7748adeeadbb736376a57030c5255f3ac8bfb
# Parent  fe50341de1fff843ae633d7ad7be908100c09cdc
# EXP-Topic histedit-auto
histedit: add optional parameter for determining intial editor line

A simple refactor to allow us to change the default verb for the initial editor
display.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -406,11 +406,11 @@ class histeditaction(object):
             self.node = repo[ha].node()
         except error.RepoError:
             raise error.ParseError(_('unknown changeset %s listed')
                               % ha[:12])
 
-    def torule(self):
+    def torule(self, initial=False):
         """build a histedit rule line for an action
 
         by default lines are in the form:
         <hash> <rev> <summary>
         """
@@ -1302,11 +1302,11 @@ def between(repo, old, new, keep):
 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([act.torule() for act in actions])
+    rules = '\n'.join([act.torule(initial=True) for act in actions])
     rules += '\n\n'
     rules += editcomment
     rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'})
 
     # Save edit rules in .hg/histedit-last-edit.txt in case


More information about the Mercurial-devel mailing list