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

login
register
mail settings
Submitter Sean Farley
Date May 17, 2016, 11:12 p.m.
Message ID <d4c7748adeeadbb73637.1463526735@laptop.office.atlassian.com>
Download mbox | patch
Permalink /patch/15156/
State Accepted
Headers show

Comments

Sean Farley - May 17, 2016, 11:12 p.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.
timeless - May 17, 2016, 11:57 p.m.
I was expecting to see a test or some code that exercises this...

On Tue, May 17, 2016 at 7:12 PM, Sean Farley <sean@farley.io> wrote:
> # 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.
>
> 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Sean Farley - May 17, 2016, 11:58 p.m.
timeless <timeless@gmail.com> writes:

> I was expecting to see a test or some code that exercises this...

Huh? I use it in the 'if' statement of the next patch.
timeless - May 18, 2016, 3:04 a.m.
oops, sorry. sometimes I miss the days where arguments were tagged
with `a` prefix...

On Tue, May 17, 2016 at 7:58 PM, Sean Farley <sean@farley.io> wrote:
>
> timeless <timeless@gmail.com> writes:
>
>> I was expecting to see a test or some code that exercises this...
>
> Huh? I use it in the 'if' statement of the next patch.

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