Submitter | Sean Farley |
---|---|
Date | May 17, 2016, 11:12 p.m. |
Message ID | <75fc0323200de860fafc.1463526736@laptop.office.atlassian.com> |
Download | mbox | patch |
Permalink | /patch/15157/ |
State | Accepted |
Headers | show |
Comments
On Tue, May 17, 2016 at 04:12:16PM -0700, Sean Farley wrote: > # HG changeset patch > # User Sean Farley <sean@farley.io> > # Date 1462583556 25200 > # Fri May 06 18:12:36 2016 -0700 > # Node ID 75fc0323200de860fafc4203714f334224673af4 > # Parent d4c7748adeeadbb736376a57030c5255f3ac8bfb > # EXP-Topic histedit-auto > histedit: add experimental config for using the first word of the commit queued these, interested to see how they work out in practice. Ryan, I'd be interested to hear what happens if you promote this to your users. > > This allows users to start a commit with "verb! ..." so that when this is > opened in histedit, the default action will be "verb". For example, "roll! foo" > will default to the action "roll". Currently, we'll allow any known verb to be > used but this is experimental. > > diff --git a/hgext/histedit.py b/hgext/histedit.py > --- a/hgext/histedit.py > +++ b/hgext/histedit.py > @@ -416,10 +416,18 @@ class histeditaction(object): > """ > ctx = self.repo[self.node] > summary = '' > if ctx.description(): > summary = ctx.description().splitlines()[0] > + > + fword = summary.split(' ', 1)[0].lower() > + # if it doesn't end with the special character '!' just skip this > + if (self.repo.ui.configbool("experimental", "histedit.autoverb") and > + initial and fword.endswith('!')): > + fword = fword[:-1] > + if fword in primaryactions | secondaryactions | tertiaryactions: > + self.verb = fword > line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary) > # trim to 75 columns by default so it's not stupidly wide in my editor > # (the 5 more are left for verb) > maxlen = self.repo.ui.configint('histedit', 'linelen', default=80) > maxlen = max(maxlen, 22) # avoid truncating hash > diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t > --- a/tests/test-histedit-arguments.t > +++ b/tests/test-histedit-arguments.t > @@ -497,5 +497,55 @@ amend should not be blocked by the ongoi > > [experimental] > > evolution=createmarkers,allowunstable > > EOF > $ hg commit --amend -m 'allow this fold' > $ hg histedit --continue > + > + $ cd .. > + > +Test autoverb feature > + > + $ hg init autoverb > + $ cd autoverb > + $ echo alpha >> alpha > + $ hg addr > + adding alpha > + $ hg ci -m one > + $ echo alpha >> alpha > + $ hg ci -m two > + $ echo alpha >> alpha > + $ hg ci -m "roll! three" > + > + $ hg log --style compact --graph > + @ 2[tip] 1b0b0b04c8fe 1970-01-01 00:00 +0000 test > + | roll! three > + | > + o 1 579e40513370 1970-01-01 00:00 +0000 test > + | two > + | > + o 0 6058cbb6cfd7 1970-01-01 00:00 +0000 test > + one > + > + > +Check that 'roll' is selected by default > + > + $ HGEDITOR=cat hg histedit 1 --config experimental.histedit.autoverb=True > + pick 579e40513370 1 two > + roll 1b0b0b04c8fe 2 roll! three > + > + # Edit history between 579e40513370 and 1b0b0b04c8fe > + # > + # Commits are listed from least to most recent > + # > + # You can reorder changesets by reordering the lines > + # > + # Commands: > + # > + # e, edit = use commit, but stop for amending > + # m, mess = edit commit message without changing commit content > + # p, pick = use commit > + # d, drop = remove commit from history > + # f, fold = use commit, but combine it with the one above > + # r, roll = like fold, but discard this commit's description > + # > + > + $ cd .. > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
On Tue, May 17, 2016 at 4:12 PM, Sean Farley <sean@farley.io> wrote: > # HG changeset patch > # User Sean Farley <sean@farley.io> > # Date 1462583556 25200 > # Fri May 06 18:12:36 2016 -0700 > # Node ID 75fc0323200de860fafc4203714f334224673af4 > # Parent d4c7748adeeadbb736376a57030c5255f3ac8bfb > # EXP-Topic histedit-auto > histedit: add experimental config for using the first word of the commit > > This allows users to start a commit with "verb! ..." so that when this is > opened in histedit, the default action will be "verb". For example, "roll! foo" > will default to the action "roll". Currently, we'll allow any known verb to be > used but this is experimental. > > diff --git a/hgext/histedit.py b/hgext/histedit.py > --- a/hgext/histedit.py > +++ b/hgext/histedit.py > @@ -416,10 +416,18 @@ class histeditaction(object): > """ > ctx = self.repo[self.node] > summary = '' > if ctx.description(): > summary = ctx.description().splitlines()[0] > + > + fword = summary.split(' ', 1)[0].lower() > + # if it doesn't end with the special character '!' just skip this > + if (self.repo.ui.configbool("experimental", "histedit.autoverb") and > + initial and fword.endswith('!')): > + fword = fword[:-1] > + if fword in primaryactions | secondaryactions | tertiaryactions: > + self.verb = fword > line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary) > # trim to 75 columns by default so it's not stupidly wide in my editor > # (the 5 more are left for verb) > maxlen = self.repo.ui.configint('histedit', 'linelen', default=80) > maxlen = max(maxlen, 22) # avoid truncating hash > diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t > --- a/tests/test-histedit-arguments.t > +++ b/tests/test-histedit-arguments.t > @@ -497,5 +497,55 @@ amend should not be blocked by the ongoi > > [experimental] > > evolution=createmarkers,allowunstable > > EOF > $ hg commit --amend -m 'allow this fold' > $ hg histedit --continue > + > + $ cd .. > + > +Test autoverb feature > + > + $ hg init autoverb > + $ cd autoverb > + $ echo alpha >> alpha > + $ hg addr > + adding alpha > + $ hg ci -m one > + $ echo alpha >> alpha > + $ hg ci -m two > + $ echo alpha >> alpha > + $ hg ci -m "roll! three" Having used git before, I would expect "roll! one" to tell histedit to also apply this patch efter the one with commit message (starting with) "one". Future plans? > + > + $ hg log --style compact --graph > + @ 2[tip] 1b0b0b04c8fe 1970-01-01 00:00 +0000 test > + | roll! three > + | > + o 1 579e40513370 1970-01-01 00:00 +0000 test > + | two > + | > + o 0 6058cbb6cfd7 1970-01-01 00:00 +0000 test > + one > + > + > +Check that 'roll' is selected by default > + > + $ HGEDITOR=cat hg histedit 1 --config experimental.histedit.autoverb=True > + pick 579e40513370 1 two > + roll 1b0b0b04c8fe 2 roll! three > + > + # Edit history between 579e40513370 and 1b0b0b04c8fe > + # > + # Commits are listed from least to most recent > + # > + # You can reorder changesets by reordering the lines > + # > + # Commands: > + # > + # e, edit = use commit, but stop for amending > + # m, mess = edit commit message without changing commit content > + # p, pick = use commit > + # d, drop = remove commit from history > + # f, fold = use commit, but combine it with the one above > + # r, roll = like fold, but discard this commit's description > + # > + > + $ cd .. > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Martin von Zweigbergk <martinvonz@google.com> writes: > On Tue, May 17, 2016 at 4:12 PM, Sean Farley <sean@farley.io> wrote: >> # HG changeset patch >> # User Sean Farley <sean@farley.io> >> # Date 1462583556 25200 >> # Fri May 06 18:12:36 2016 -0700 >> # Node ID 75fc0323200de860fafc4203714f334224673af4 >> # Parent d4c7748adeeadbb736376a57030c5255f3ac8bfb >> # EXP-Topic histedit-auto >> histedit: add experimental config for using the first word of the commit >> >> This allows users to start a commit with "verb! ..." so that when this is >> opened in histedit, the default action will be "verb". For example, "roll! foo" >> will default to the action "roll". Currently, we'll allow any known verb to be >> used but this is experimental. >> >> diff --git a/hgext/histedit.py b/hgext/histedit.py >> --- a/hgext/histedit.py >> +++ b/hgext/histedit.py >> @@ -416,10 +416,18 @@ class histeditaction(object): >> """ >> ctx = self.repo[self.node] >> summary = '' >> if ctx.description(): >> summary = ctx.description().splitlines()[0] >> + >> + fword = summary.split(' ', 1)[0].lower() >> + # if it doesn't end with the special character '!' just skip this >> + if (self.repo.ui.configbool("experimental", "histedit.autoverb") and >> + initial and fword.endswith('!')): >> + fword = fword[:-1] >> + if fword in primaryactions | secondaryactions | tertiaryactions: >> + self.verb = fword >> line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary) >> # trim to 75 columns by default so it's not stupidly wide in my editor >> # (the 5 more are left for verb) >> maxlen = self.repo.ui.configint('histedit', 'linelen', default=80) >> maxlen = max(maxlen, 22) # avoid truncating hash >> diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t >> --- a/tests/test-histedit-arguments.t >> +++ b/tests/test-histedit-arguments.t >> @@ -497,5 +497,55 @@ amend should not be blocked by the ongoi >> > [experimental] >> > evolution=createmarkers,allowunstable >> > EOF >> $ hg commit --amend -m 'allow this fold' >> $ hg histedit --continue >> + >> + $ cd .. >> + >> +Test autoverb feature >> + >> + $ hg init autoverb >> + $ cd autoverb >> + $ echo alpha >> alpha >> + $ hg addr >> + adding alpha >> + $ hg ci -m one >> + $ echo alpha >> alpha >> + $ hg ci -m two >> + $ echo alpha >> alpha >> + $ hg ci -m "roll! three" > > Having used git before, I would expect "roll! one" to tell histedit to > also apply this patch efter the one with commit message (starting > with) "one". Future plans? Sure, that sounds cool. What happens with multiple commit messages? e.g. one two roll! one roll! one ?
On Tue, May 24, 2016 at 1:28 PM, Sean Farley <sean@farley.io> wrote: > > Martin von Zweigbergk <martinvonz@google.com> writes: > >> On Tue, May 17, 2016 at 4:12 PM, Sean Farley <sean@farley.io> wrote: >>> # HG changeset patch >>> # User Sean Farley <sean@farley.io> >>> # Date 1462583556 25200 >>> # Fri May 06 18:12:36 2016 -0700 >>> # Node ID 75fc0323200de860fafc4203714f334224673af4 >>> # Parent d4c7748adeeadbb736376a57030c5255f3ac8bfb >>> # EXP-Topic histedit-auto >>> histedit: add experimental config for using the first word of the commit >>> >>> This allows users to start a commit with "verb! ..." so that when this is >>> opened in histedit, the default action will be "verb". For example, "roll! foo" >>> will default to the action "roll". Currently, we'll allow any known verb to be >>> used but this is experimental. >>> >>> diff --git a/hgext/histedit.py b/hgext/histedit.py >>> --- a/hgext/histedit.py >>> +++ b/hgext/histedit.py >>> @@ -416,10 +416,18 @@ class histeditaction(object): >>> """ >>> ctx = self.repo[self.node] >>> summary = '' >>> if ctx.description(): >>> summary = ctx.description().splitlines()[0] >>> + >>> + fword = summary.split(' ', 1)[0].lower() >>> + # if it doesn't end with the special character '!' just skip this >>> + if (self.repo.ui.configbool("experimental", "histedit.autoverb") and >>> + initial and fword.endswith('!')): >>> + fword = fword[:-1] >>> + if fword in primaryactions | secondaryactions | tertiaryactions: >>> + self.verb = fword >>> line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary) >>> # trim to 75 columns by default so it's not stupidly wide in my editor >>> # (the 5 more are left for verb) >>> maxlen = self.repo.ui.configint('histedit', 'linelen', default=80) >>> maxlen = max(maxlen, 22) # avoid truncating hash >>> diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t >>> --- a/tests/test-histedit-arguments.t >>> +++ b/tests/test-histedit-arguments.t >>> @@ -497,5 +497,55 @@ amend should not be blocked by the ongoi >>> > [experimental] >>> > evolution=createmarkers,allowunstable >>> > EOF >>> $ hg commit --amend -m 'allow this fold' >>> $ hg histedit --continue >>> + >>> + $ cd .. >>> + >>> +Test autoverb feature >>> + >>> + $ hg init autoverb >>> + $ cd autoverb >>> + $ echo alpha >> alpha >>> + $ hg addr >>> + adding alpha >>> + $ hg ci -m one >>> + $ echo alpha >> alpha >>> + $ hg ci -m two >>> + $ echo alpha >> alpha >>> + $ hg ci -m "roll! three" >> >> Having used git before, I would expect "roll! one" to tell histedit to >> also apply this patch efter the one with commit message (starting >> with) "one". Future plans? > > Sure, that sounds cool. What happens with multiple commit messages? e.g. > > one > two > roll! one > roll! one > > ? I'd assume: one roll! one # first one roll! one # second one two
Personally I'm more likely to do roll! {sha} -- in fact, of late, I've been writing commits more or less of this form (before upgrading to get the feature that was being implemented/discussed). a foo b bar c foo d baz e roll! foo f roll! foo g roll! bar h fold! foo i roll! foo e and f should both roll onto c, g onto b i should be indeterminate, since it would depend on whether the fold changes the commit message of c*. On Tue, May 24, 2016 at 4:31 PM, Martin von Zweigbergk via Mercurial-devel <mercurial-devel@mercurial-scm.org> wrote: > On Tue, May 24, 2016 at 1:28 PM, Sean Farley <sean@farley.io> wrote: >> >> Martin von Zweigbergk <martinvonz@google.com> writes: >> >>> On Tue, May 17, 2016 at 4:12 PM, Sean Farley <sean@farley.io> wrote: >>>> # HG changeset patch >>>> # User Sean Farley <sean@farley.io> >>>> # Date 1462583556 25200 >>>> # Fri May 06 18:12:36 2016 -0700 >>>> # Node ID 75fc0323200de860fafc4203714f334224673af4 >>>> # Parent d4c7748adeeadbb736376a57030c5255f3ac8bfb >>>> # EXP-Topic histedit-auto >>>> histedit: add experimental config for using the first word of the commit >>>> >>>> This allows users to start a commit with "verb! ..." so that when this is >>>> opened in histedit, the default action will be "verb". For example, "roll! foo" >>>> will default to the action "roll". Currently, we'll allow any known verb to be >>>> used but this is experimental. >>>> >>>> diff --git a/hgext/histedit.py b/hgext/histedit.py >>>> --- a/hgext/histedit.py >>>> +++ b/hgext/histedit.py >>>> @@ -416,10 +416,18 @@ class histeditaction(object): >>>> """ >>>> ctx = self.repo[self.node] >>>> summary = '' >>>> if ctx.description(): >>>> summary = ctx.description().splitlines()[0] >>>> + >>>> + fword = summary.split(' ', 1)[0].lower() >>>> + # if it doesn't end with the special character '!' just skip this >>>> + if (self.repo.ui.configbool("experimental", "histedit.autoverb") and >>>> + initial and fword.endswith('!')): >>>> + fword = fword[:-1] >>>> + if fword in primaryactions | secondaryactions | tertiaryactions: >>>> + self.verb = fword >>>> line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary) >>>> # trim to 75 columns by default so it's not stupidly wide in my editor >>>> # (the 5 more are left for verb) >>>> maxlen = self.repo.ui.configint('histedit', 'linelen', default=80) >>>> maxlen = max(maxlen, 22) # avoid truncating hash >>>> diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t >>>> --- a/tests/test-histedit-arguments.t >>>> +++ b/tests/test-histedit-arguments.t >>>> @@ -497,5 +497,55 @@ amend should not be blocked by the ongoi >>>> > [experimental] >>>> > evolution=createmarkers,allowunstable >>>> > EOF >>>> $ hg commit --amend -m 'allow this fold' >>>> $ hg histedit --continue >>>> + >>>> + $ cd .. >>>> + >>>> +Test autoverb feature >>>> + >>>> + $ hg init autoverb >>>> + $ cd autoverb >>>> + $ echo alpha >> alpha >>>> + $ hg addr >>>> + adding alpha >>>> + $ hg ci -m one >>>> + $ echo alpha >> alpha >>>> + $ hg ci -m two >>>> + $ echo alpha >> alpha >>>> + $ hg ci -m "roll! three" >>> >>> Having used git before, I would expect "roll! one" to tell histedit to >>> also apply this patch efter the one with commit message (starting >>> with) "one". Future plans? >> >> Sure, that sounds cool. What happens with multiple commit messages? e.g. >> >> one >> two >> roll! one >> roll! one >> >> ? > > I'd assume: > > one > roll! one # first one > roll! one # second one > two > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
One problem with basing it on sha is that you can't histedit after rebase without having to the assignment manually. Maybe not very important. On Tue, May 24, 2016, 13:39 timeless <timeless@gmail.com> wrote: > Personally I'm more likely to do roll! {sha} -- in fact, of late, I've > been writing commits more or less of this form (before upgrading to > get the feature that was being implemented/discussed). > > a foo > b bar > c foo > d baz > e roll! foo > f roll! foo > g roll! bar > h fold! foo > i roll! foo > > e and f should both roll onto c, g onto b > i should be indeterminate, since it would depend on whether the fold > changes the commit message of c*. > > On Tue, May 24, 2016 at 4:31 PM, Martin von Zweigbergk via > Mercurial-devel <mercurial-devel@mercurial-scm.org> wrote: > > On Tue, May 24, 2016 at 1:28 PM, Sean Farley <sean@farley.io> wrote: > >> > >> Martin von Zweigbergk <martinvonz@google.com> writes: > >> > >>> On Tue, May 17, 2016 at 4:12 PM, Sean Farley <sean@farley.io> wrote: > >>>> # HG changeset patch > >>>> # User Sean Farley <sean@farley.io> > >>>> # Date 1462583556 25200 > >>>> # Fri May 06 18:12:36 2016 -0700 > >>>> # Node ID 75fc0323200de860fafc4203714f334224673af4 > >>>> # Parent d4c7748adeeadbb736376a57030c5255f3ac8bfb > >>>> # EXP-Topic histedit-auto > >>>> histedit: add experimental config for using the first word of the > commit > >>>> > >>>> This allows users to start a commit with "verb! ..." so that when > this is > >>>> opened in histedit, the default action will be "verb". For example, > "roll! foo" > >>>> will default to the action "roll". Currently, we'll allow any known > verb to be > >>>> used but this is experimental. > >>>> > >>>> diff --git a/hgext/histedit.py b/hgext/histedit.py > >>>> --- a/hgext/histedit.py > >>>> +++ b/hgext/histedit.py > >>>> @@ -416,10 +416,18 @@ class histeditaction(object): > >>>> """ > >>>> ctx = self.repo[self.node] > >>>> summary = '' > >>>> if ctx.description(): > >>>> summary = ctx.description().splitlines()[0] > >>>> + > >>>> + fword = summary.split(' ', 1)[0].lower() > >>>> + # if it doesn't end with the special character '!' just skip > this > >>>> + if (self.repo.ui.configbool("experimental", > "histedit.autoverb") and > >>>> + initial and fword.endswith('!')): > >>>> + fword = fword[:-1] > >>>> + if fword in primaryactions | secondaryactions | > tertiaryactions: > >>>> + self.verb = fword > >>>> line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary) > >>>> # trim to 75 columns by default so it's not stupidly wide in > my editor > >>>> # (the 5 more are left for verb) > >>>> maxlen = self.repo.ui.configint('histedit', 'linelen', > default=80) > >>>> maxlen = max(maxlen, 22) # avoid truncating hash > >>>> diff --git a/tests/test-histedit-arguments.t > b/tests/test-histedit-arguments.t > >>>> --- a/tests/test-histedit-arguments.t > >>>> +++ b/tests/test-histedit-arguments.t > >>>> @@ -497,5 +497,55 @@ amend should not be blocked by the ongoi > >>>> > [experimental] > >>>> > evolution=createmarkers,allowunstable > >>>> > EOF > >>>> $ hg commit --amend -m 'allow this fold' > >>>> $ hg histedit --continue > >>>> + > >>>> + $ cd .. > >>>> + > >>>> +Test autoverb feature > >>>> + > >>>> + $ hg init autoverb > >>>> + $ cd autoverb > >>>> + $ echo alpha >> alpha > >>>> + $ hg addr > >>>> + adding alpha > >>>> + $ hg ci -m one > >>>> + $ echo alpha >> alpha > >>>> + $ hg ci -m two > >>>> + $ echo alpha >> alpha > >>>> + $ hg ci -m "roll! three" > >>> > >>> Having used git before, I would expect "roll! one" to tell histedit to > >>> also apply this patch efter the one with commit message (starting > >>> with) "one". Future plans? > >> > >> Sure, that sounds cool. What happens with multiple commit messages? e.g. > >> > >> one > >> two > >> roll! one > >> roll! one > >> > >> ? > > > > I'd assume: > > > > one > > roll! one # first one > > roll! one # second one > > two > > _______________________________________________ > > Mercurial-devel mailing list > > Mercurial-devel@mercurial-scm.org > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel >
On Tue, May 24, 2016 at 4:51 PM, Martin von Zweigbergk <martinvonz@google.com> wrote: > One problem with basing it on sha is that you can't histedit after rebase > without having to the assignment manually. Maybe not very important. Since I was doing this manually, it didn't matter. But with evolution markers, we could pick the successor ...
On Tue, May 24, 2016 at 05:07:37PM -0400, timeless wrote: > On Tue, May 24, 2016 at 4:51 PM, Martin von Zweigbergk > <martinvonz@google.com> wrote: > > One problem with basing it on sha is that you can't histedit after rebase > > without having to the assignment manually. Maybe not very important. > > Since I was doing this manually, it didn't matter. But with evolution > markers, we could pick the successor ... I'm open to trying things as shas first, and if we can't figure that out trying it as a prefix match on other commits in the histedited set. Seems worth some experimentation. > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
On 05/27/2016 03:28 AM, Augie Fackler wrote: > On Tue, May 24, 2016 at 05:07:37PM -0400, timeless wrote: >> On Tue, May 24, 2016 at 4:51 PM, Martin von Zweigbergk >> <martinvonz@google.com> wrote: >>> One problem with basing it on sha is that you can't histedit after rebase >>> without having to the assignment manually. Maybe not very important. >> >> Since I was doing this manually, it didn't matter. But with evolution >> markers, we could pick the successor ... > > I'm open to trying things as shas first, and if we can't figure that > out trying it as a prefix match on other commits in the histedited > set. Seems worth some experimentation. We could also use revset, a bit more verbose but much more versatile. (not entirely convinced myself because of the verboseness). On the same topic, I'm not super fan of the "action!" notation it's a bit black magic (and could lead to collision quite easily). I'll try to think about something a bit clearer for an alternative. (something like "EDIT:roll!" maybe)
On Fri, May 27, 2016 at 10:37 AM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote: > > > On 05/27/2016 03:28 AM, Augie Fackler wrote: >> On Tue, May 24, 2016 at 05:07:37PM -0400, timeless wrote: >>> On Tue, May 24, 2016 at 4:51 PM, Martin von Zweigbergk >>> <martinvonz@google.com> wrote: >>>> One problem with basing it on sha is that you can't histedit after rebase >>>> without having to the assignment manually. Maybe not very important. >>> >>> Since I was doing this manually, it didn't matter. But with evolution >>> markers, we could pick the successor ... >> >> I'm open to trying things as shas first, and if we can't figure that >> out trying it as a prefix match on other commits in the histedited >> set. Seems worth some experimentation. > > We could also use revset, a bit more verbose but much more versatile. > (not entirely convinced myself because of the verboseness). > > On the same topic, I'm not super fan of the "action!" notation it's a > bit black magic (and could lead to collision quite easily). I'll try to > think about something a bit clearer for an alternative. I agree it feels a little magical, but it's the exact syntax used by git for this, so it'll have to be an extremely compelling argument to convince me to change things. > > (something like "EDIT:roll!" maybe) > > -- > Pierre-Yves David
On 05/27/2016 04:45 PM, Augie Fackler wrote: > On Fri, May 27, 2016 at 10:37 AM, Pierre-Yves David > <pierre-yves.david@ens-lyon.org> wrote: >> >> >> On 05/27/2016 03:28 AM, Augie Fackler wrote: >>> On Tue, May 24, 2016 at 05:07:37PM -0400, timeless wrote: >>>> On Tue, May 24, 2016 at 4:51 PM, Martin von Zweigbergk >>>> <martinvonz@google.com> wrote: >>>>> One problem with basing it on sha is that you can't histedit after rebase >>>>> without having to the assignment manually. Maybe not very important. >>>> >>>> Since I was doing this manually, it didn't matter. But with evolution >>>> markers, we could pick the successor ... >>> >>> I'm open to trying things as shas first, and if we can't figure that >>> out trying it as a prefix match on other commits in the histedited >>> set. Seems worth some experimentation. >> >> We could also use revset, a bit more verbose but much more versatile. >> (not entirely convinced myself because of the verboseness). >> >> On the same topic, I'm not super fan of the "action!" notation it's a >> bit black magic (and could lead to collision quite easily). I'll try to >> think about something a bit clearer for an alternative. > > I agree it feels a little magical, but it's the exact syntax used by > git for this, so it'll have to be an extremely compelling argument to > convince me to change things. Ha, yes, that would be convenient. Maybe we recognize two syntaxes, one for git people and one for human being.
Augie Fackler <raf@durin42.com> writes: > On Fri, May 27, 2016 at 10:37 AM, Pierre-Yves David > <pierre-yves.david@ens-lyon.org> wrote: >> >> >> On 05/27/2016 03:28 AM, Augie Fackler wrote: >>> On Tue, May 24, 2016 at 05:07:37PM -0400, timeless wrote: >>>> On Tue, May 24, 2016 at 4:51 PM, Martin von Zweigbergk >>>> <martinvonz@google.com> wrote: >>>>> One problem with basing it on sha is that you can't histedit after rebase >>>>> without having to the assignment manually. Maybe not very important. >>>> >>>> Since I was doing this manually, it didn't matter. But with evolution >>>> markers, we could pick the successor ... >>> >>> I'm open to trying things as shas first, and if we can't figure that >>> out trying it as a prefix match on other commits in the histedited >>> set. Seems worth some experimentation. >> >> We could also use revset, a bit more verbose but much more versatile. >> (not entirely convinced myself because of the verboseness). Before there was feedback, I almost finished implementing a simple version with no revsets and no hashes. >> On the same topic, I'm not super fan of the "action!" notation it's a >> bit black magic (and could lead to collision quite easily). I'll try to >> think about something a bit clearer for an alternative. > > I agree it feels a little magical, but it's the exact syntax used by > git for this, so it'll have to be an extremely compelling argument to > convince me to change things. To be fair, it's a syntax I come up on my own before I knew git did it (sadz). Originally, it was "VERB! foo bar" so that I would notice the all caps in the text editor.
Patch
diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -416,10 +416,18 @@ class histeditaction(object): """ ctx = self.repo[self.node] summary = '' if ctx.description(): summary = ctx.description().splitlines()[0] + + fword = summary.split(' ', 1)[0].lower() + # if it doesn't end with the special character '!' just skip this + if (self.repo.ui.configbool("experimental", "histedit.autoverb") and + initial and fword.endswith('!')): + fword = fword[:-1] + if fword in primaryactions | secondaryactions | tertiaryactions: + self.verb = fword line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary) # trim to 75 columns by default so it's not stupidly wide in my editor # (the 5 more are left for verb) maxlen = self.repo.ui.configint('histedit', 'linelen', default=80) maxlen = max(maxlen, 22) # avoid truncating hash diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t --- a/tests/test-histedit-arguments.t +++ b/tests/test-histedit-arguments.t @@ -497,5 +497,55 @@ amend should not be blocked by the ongoi > [experimental] > evolution=createmarkers,allowunstable > EOF $ hg commit --amend -m 'allow this fold' $ hg histedit --continue + + $ cd .. + +Test autoverb feature + + $ hg init autoverb + $ cd autoverb + $ echo alpha >> alpha + $ hg addr + adding alpha + $ hg ci -m one + $ echo alpha >> alpha + $ hg ci -m two + $ echo alpha >> alpha + $ hg ci -m "roll! three" + + $ hg log --style compact --graph + @ 2[tip] 1b0b0b04c8fe 1970-01-01 00:00 +0000 test + | roll! three + | + o 1 579e40513370 1970-01-01 00:00 +0000 test + | two + | + o 0 6058cbb6cfd7 1970-01-01 00:00 +0000 test + one + + +Check that 'roll' is selected by default + + $ HGEDITOR=cat hg histedit 1 --config experimental.histedit.autoverb=True + pick 579e40513370 1 two + roll 1b0b0b04c8fe 2 roll! three + + # Edit history between 579e40513370 and 1b0b0b04c8fe + # + # Commits are listed from least to most recent + # + # You can reorder changesets by reordering the lines + # + # Commands: + # + # e, edit = use commit, but stop for amending + # m, mess = edit commit message without changing commit content + # p, pick = use commit + # d, drop = remove commit from history + # f, fold = use commit, but combine it with the one above + # r, roll = like fold, but discard this commit's description + # + + $ cd ..