fold: cleanly abort on empty fold set (issue5453) stable
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 25 Jan 2017 16:40:45 +0100
branchstable
changeset 1784 c3741a5adbb0
parent 1777 e7149cc5101f
child 1785 f22120b12715
child 1786 b674277ea4ef
fold: cleanly abort on empty fold set (issue5453) We now handle the empty set case, cleanly aborting instead of crashing with a traceback. The message used match the output of 'hg push' in similar situation.
README
hgext/evolve.py
tests/test-evolve.t
--- a/README	Sun Nov 06 19:19:28 2016 +0100
+++ b/README	Wed Jan 25 16:40:45 2017 +0100
@@ -56,6 +56,10 @@
 Changelog
 =========
 
+5.5.1 --
+
+ - fix crash when trying to fold an empty revision set (issue5453)
+
 5.5.0 -- 2016-10-30
 
  - The {obsolete} template now yield "obsolete" or "".
--- a/hgext/evolve.py	Sun Nov 06 19:19:28 2016 +0100
+++ b/hgext/evolve.py	Wed Jan 25 16:40:45 2017 +0100
@@ -3124,7 +3124,10 @@
                                       "of working directory"))
         revs = extrevs
 
-    if len(revs) == 1:
+    if not revs:
+        raise error.Abort(_('specified revisions evaluate to an empty set'),
+                          hint=_('use different revision arguments'))
+    elif len(revs) == 1:
         ui.write_err(_('single revision specified, nothing to fold\n'))
         return 1
 
--- a/tests/test-evolve.t	Sun Nov 06 19:19:28 2016 +0100
+++ b/tests/test-evolve.t	Wed Jan 25 16:40:45 2017 +0100
@@ -688,6 +688,10 @@
   $ hg fold -r 4 -r 6 --exact
   abort: cannot fold non-linear revisions (multiple roots given)
   [255]
+  $ hg fold --exact -r "4 and not 4"
+  abort: specified revisions evaluate to an empty set
+  (use different revision arguments)
+  [255]
   $ hg fold 10 1
   abort: cannot fold non-linear revisions
   (given revisions are unrelated to parent of working directory)