[PATCH 1 of 2] crecord: repurpose "a" key to toggle all selections (BC)

Jordi Gutiérrez Hermoso jordigh at octave.org
Wed Dec 11 10:31:27 EST 2019


On Wed, 2019-12-11 at 10:41 +0100, Denis Laxalde wrote:
Jordi Gutiérrez Hermoso a écrit :
> > # HG changeset patch
> > # User Jordi Gutiérrez Hermoso <jordigh at octave.org>
> > # Date 1576015329 18000
> > #      Tue Dec 10 17:02:09 2019 -0500
> > # Node ID bd10bc4bdb994b875040c0c58f1c341df66ddd46
> > # Parent  ce088b38f92b6d480df2072dc45fb068443758dd
> > crecord: repurpose "a" key to toggle all selections (BC)
> > 

> Also this 'amend mode' seems only useful for 'commit --interactive';
> but it's currently also available for other interactive commands
> (e.g. 'revert --interactive', which makes no sense) so it's already
> weird.

Oh, right, I forgot about that. I've amended my commit message to also
include this point.

> Does "pretty harmless" mean that you can actually toggle back to the
> previous selection?

Yeah, all selections get flipped. Just hit "a" again to the same state
before you flipped them.

Honestly, the time I would use this most is when everything is
selected so I can start from zero selections. I so very often reach
for "A" at the beginning of my hunk selecting but accidentally hit "a"
and then I panic 'cause I forget what state it's in, so I just quit
the hunk selector and start over again from the command line.

> Also, this breaks tests in test-commit-interactive-curses.t (and it'd be
> nice to have some new test for the new feature).

Oh, oops. I thought I had ran the tests. There, tests fixed, and I
wrote a new test for toggling all lines.

> > diff --git a/mercurial/crecord.py b/mercurial/crecord.py
> > --- a/mercurial/crecord.py
> > +++ b/mercurial/crecord.py
> > @@ -990,6 +990,13 @@ class curseschunkselector(object):
> >                      self.toggleapply(item)
> >          self.waslasttoggleallapplied = not self.waslasttoggleallapplied
> >  
> > +    def flipselections(self):
> > +        b"flip all selections"
> 
> Triple " without 'b' would be nicer.

Fixed. Thanks.



More information about the Mercurial-devel mailing list