# HG changeset patch # User Durham Goode # Date 2015-02-03 00:19:35 # Node ID 00d3317634429d39c8197b4497cccf52912f48bf # Parent 240343e13c4dfc76b045315937749f57b1b559f6 histedit: allow configuring default behavior Adds a configuration setting for allowing users to specify the default behavior of 'hg histedit' without arguments. This saves users 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 --------------------------------------------------------------------