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

login
register
mail settings
Submitter Sean Farley
Date May 7, 2016, 7:02 a.m.
Message ID <d4c7748adeeadbb73637.1462604529@laptop.local>
Download mbox | patch
Permalink /patch/14963/
State Superseded
Commit 4a3d55281a8515bab8fe4cb0493e2850433e178b
Headers show

Comments

Sean Farley - May 7, 2016, 7:02 a.m.
# HG changeset patch
# User Sean Farley <sean@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.

Patch

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