Submitter | Durham Goode |
---|---|
Date | Feb. 3, 2015, 12:42 a.m. |
Message ID | <f146925438691d039aa3.1422924165@dev2000.prn2.facebook.com> |
Download | mbox | patch |
Permalink | /patch/7618/ |
State | Accepted |
Headers | show |
Comments
Durham Goode writes: > # HG changeset patch > # User Durham Goode <durham@fb.com> > # Date 1422922775 28800 > # Mon Feb 02 16:19:35 2015 -0800 > # Node ID f146925438691d039aa3ea1146790fe85acfbbe6 > # Parent 8b88870cbd1eeefaee0af053ae36728f8c0a1847 > histedit: allow configuring default behavior > > Adds a configuration setting for allowing users to specify the default behavior > of 'hg histedit' without arguments. This saves user's from having to manually > figure out the bottom commit or a complicated revset. My current revset of > choice is "only(.) & draft() - ::merge()" > > The commits that histedit can work with is usually quite limited, so if this > feature ends up working well, we may want to consider making "only(.) & draft() > - ::merge()" the default behavior for everyone. For what it's worth, I agree that this (or something similar) should be the default revset.
On Mon, Feb 2, 2015 at 4:47 PM, Sean Farley <sean.michael.farley@gmail.com> wrote: > > Durham Goode writes: > > > # HG changeset patch > > # User Durham Goode <durham@fb.com> > > # Date 1422922775 28800 > > # Mon Feb 02 16:19:35 2015 -0800 > > # Node ID f146925438691d039aa3ea1146790fe85acfbbe6 > > # Parent 8b88870cbd1eeefaee0af053ae36728f8c0a1847 > > histedit: allow configuring default behavior > > > > Adds a configuration setting for allowing users to specify the default > behavior > > of 'hg histedit' without arguments. This saves user's from having to > manually > > figure out the bottom commit or a complicated revset. My current revset > of > > choice is "only(.) & draft() - ::merge()" > > > > The commits that histedit can work with is usually quite limited, so if > this > > feature ends up working well, we may want to consider making "only(.) & > draft() > > - ::merge()" the default behavior for everyone. > > For what it's worth, I agree that this (or something similar) should be > the default revset. > I don't like saying "me too," but, yeah, I really wish `hg histedit` did something reasonable by default. I've had multiple people come up to me with comments that histedit is too difficult to use out of the box. "It should just work." In the absence of changing the default behavior, I support this patch because it means I can have our interactive Mercurial config generator spit out something reasonable so more users have a good experience.
On Mon, Feb 02, 2015 at 04:42:45PM -0800, Durham Goode wrote: > # HG changeset patch > # User Durham Goode <durham@fb.com> > # Date 1422922775 28800 > # Mon Feb 02 16:19:35 2015 -0800 > # Node ID f146925438691d039aa3ea1146790fe85acfbbe6 > # Parent 8b88870cbd1eeefaee0af053ae36728f8c0a1847 > histedit: allow configuring default behavior Looks good. Queued. (For those following along: the intent here is to let us experiment with different revsets until we find the "right" default, then set that default. I don't know if we'll get the default in 3.4, but I hope so.) > > Adds a configuration setting for allowing users to specify the default behavior > of 'hg histedit' without arguments. This saves user's from having to manually > figure out the bottom commit or a complicated revset. My current revset of > choice is "only(.) & draft() - ::merge()" > > The commits that histedit can work with is usually quite limited, so if this > feature ends up working well, we may want to consider making "only(.) & draft() > - ::merge()" the default behavior for everyone. > > diff --git a/hgext/histedit.py b/hgext/histedit.py > --- a/hgext/histedit.py > +++ b/hgext/histedit.py > @@ -579,6 +579,10 @@ def _histedit(ui, repo, state, *freeargs > _('only one repo argument allowed with --outgoing')) > else: > revs.extend(freeargs) > + if len(revs) == 0: > + histeditdefault = ui.config('histedit', 'defaultrev') > + if histeditdefault: > + revs.append(histeditdefault) > if len(revs) != 1: > raise util.Abort( > _('histedit requires exactly one ancestor revision')) > 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 > @@ -103,6 +103,15 @@ Test that we pick the minimum of a revra > 0 files updated, 0 files merged, 0 files removed, 0 files unresolved > $ hg up --quiet > > +Test config specified default > +----------------------------- > + > + $ HGEDITOR=cat hg histedit --config "histedit.defaultrev=only(.) - ::eb57da33312f" --commands - << EOF > + > pick c8e68270e35a 3 four > + > pick 08d98a8350f3 4 five > + > EOF > + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved > + > Run on a revision not descendants of the initial parent > -------------------------------------------------------------------- > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On Mon, Feb 02, 2015 at 09:49:42PM -0800, Gregory Szorc wrote: > On Mon, Feb 2, 2015 at 4:47 PM, Sean Farley <sean.michael.farley@gmail.com> > wrote: > > > > > Durham Goode writes: > > > > > # HG changeset patch > > > # User Durham Goode <durham@fb.com> > > > # Date 1422922775 28800 > > > # Mon Feb 02 16:19:35 2015 -0800 > > > # Node ID f146925438691d039aa3ea1146790fe85acfbbe6 > > > # Parent 8b88870cbd1eeefaee0af053ae36728f8c0a1847 > > > histedit: allow configuring default behavior > > > > > > Adds a configuration setting for allowing users to specify the default > > behavior > > > of 'hg histedit' without arguments. This saves user's from having to > > manually > > > figure out the bottom commit or a complicated revset. My current revset > > of > > > choice is "only(.) & draft() - ::merge()" > > > > > > The commits that histedit can work with is usually quite limited, so if > > this > > > feature ends up working well, we may want to consider making "only(.) & > > draft() > > > - ::merge()" the default behavior for everyone. > > > > For what it's worth, I agree that this (or something similar) should be > > the default revset. > > > > I don't like saying "me too," but, yeah, I really wish `hg histedit` did > something reasonable by default. I've had multiple people come up to me > with comments that histedit is too difficult to use out of the box. "It > should just work." In the absence of changing the default behavior, I > support this patch because it means I can have our interactive Mercurial > config generator spit out something reasonable so more users have a good > experience. Please experiment with revsets for the default - it's been a little unclear to me what the "right" revset is, so more input is better. (Perhaps we should make a wiki page with a table of who's testing what. Dunno.) > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On 02/03/2015 03:13 PM, Augie Fackler wrote: > On Mon, Feb 02, 2015 at 04:42:45PM -0800, Durham Goode wrote: >> # HG changeset patch >> # User Durham Goode <durham@fb.com> >> # Date 1422922775 28800 >> # Mon Feb 02 16:19:35 2015 -0800 >> # Node ID f146925438691d039aa3ea1146790fe85acfbbe6 >> # Parent 8b88870cbd1eeefaee0af053ae36728f8c0a1847 >> histedit: allow configuring default behavior > > Looks good. Queued. > > (For those following along: the intent here is to let us experiment > with different revsets until we find the "right" default, then set > that default. I don't know if we'll get the default in 3.4, but I hope > so.) If this is an experiment, should this go in the `experimental` configuration section ?
On Tue, Feb 3, 2015 at 10:38 AM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote: >> >> (For those following along: the intent here is to let us experiment >> with different revsets until we find the "right" default, then set >> that default. I don't know if we'll get the default in 3.4, but I hope >> so.) > > > If this is an experiment, should this go in the `experimental` configuration > section ? I believe we should keep the config knob even once it grows a default. Remotebranches users might want to do something involving the 'upstream()' revset, and hgsubversion users might want to do something there, etc etc.
Patch
diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -579,6 +579,10 @@ def _histedit(ui, repo, state, *freeargs _('only one repo argument allowed with --outgoing')) else: revs.extend(freeargs) + if len(revs) == 0: + histeditdefault = ui.config('histedit', 'defaultrev') + if histeditdefault: + revs.append(histeditdefault) if len(revs) != 1: raise util.Abort( _('histedit requires exactly one ancestor revision')) 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 @@ -103,6 +103,15 @@ Test that we pick the minimum of a revra 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg up --quiet +Test config specified default +----------------------------- + + $ HGEDITOR=cat hg histedit --config "histedit.defaultrev=only(.) - ::eb57da33312f" --commands - << EOF + > pick c8e68270e35a 3 four + > pick 08d98a8350f3 4 five + > EOF + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + Run on a revision not descendants of the initial parent --------------------------------------------------------------------