D5543: histedit: crashing with a more useful error message on empty defaultrev
rdamazio (Rodrigo Damazio Bovendorp)
phabricator at mercurial-scm.org
Thu Jan 10 04:05:53 UTC 2019
rdamazio created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5543
AFFECTED FILES
mercurial/destutil.py
tests/test-histedit-arguments.t
CHANGE DETAILS
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
@@ -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
--------------------------------------------------------------------
diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -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
To: rdamazio, durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list