# HG changeset patch # User rdamazio@google.com # Date 1547092835 28800 # Node ID fbd168455b26ddbcd0302cc3471ab7e252907677 # Parent f467c353298cc771f0b07215edd800a4249375c6 histedit: crashing with a more useful error message on empty defaultrev Before this, `hg --config histedit.defaultrev= histedit` would crash with File "destutil.py", line 385, in desthistedit if revs: UnboundLocalError: local variable 'revs' referenced before assignment Differential Revision: https://phab.mercurial-scm.org/D5543 diff -r f467c353298c -r fbd168455b26 mercurial/destutil.py --- a/mercurial/destutil.py Mon Jan 07 19:00:54 2019 -0500 +++ b/mercurial/destutil.py Wed Jan 09 20:00:35 2019 -0800 @@ -381,6 +381,8 @@ revs = stack.getstack(repo) elif default: revs = scmutil.revrange(repo, [default]) + else: + raise error.Abort(_("config option histedit.defaultrev can't be empty")) if revs: # Take the first revision of the revset as the root diff -r f467c353298c -r fbd168455b26 tests/test-histedit-arguments.t --- a/tests/test-histedit-arguments.t Mon Jan 07 19:00:54 2019 -0500 +++ b/tests/test-histedit-arguments.t Wed Jan 09 20:00:35 2019 -0800 @@ -112,6 +112,13 @@ > pick 08d98a8350f3 4 five > EOF +Test invalid config default +--------------------------- + + $ hg histedit --config "histedit.defaultrev=" + abort: config option histedit.defaultrev can't be empty + [255] + Run on a revision not descendants of the initial parent --------------------------------------------------------------------