Patchwork D5543: histedit: crashing with a more useful error message on empty defaultrev

login
register
mail settings
Submitter phabricator
Date Jan. 10, 2019, 11:30 a.m.
Message ID <d016117130d64325d18c5b9a5137b750@localhost.localdomain>
Download mbox | patch
Permalink /patch/37616/
State Not Applicable
Headers show

Comments

phabricator - Jan. 10, 2019, 11:30 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfbd168455b26: histedit: crashing with a more useful error message on empty defaultrev (authored by rdamazio, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5543?vs=13120&id=13132#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5543?vs=13120&id=13132

REVISION DETAIL
  https://phab.mercurial-scm.org/D5543

AFFECTED FILES
  mercurial/destutil.py
  tests/test-histedit-arguments.t

CHANGE DETAILS




To: rdamazio, durin42, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

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