Patchwork [2,of,6,EVOLVE,V2] fold: clarify message for empty revision set and abort instead (BC)

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date July 4, 2014, 2:37 p.m.
Message ID <c90bb870b06306b5d224.1404484646@Iris>
Download mbox | patch
Permalink /patch/5102/
State Not Applicable
Headers show

Comments

Jordi Gutiérrez Hermoso - July 4, 2014, 2:37 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1404138435 14400
#      Mon Jun 30 10:27:15 2014 -0400
# Node ID c90bb870b06306b5d224d4dcbf1c3be328355f73
# Parent  d5d92a9e25a89df42dc53d037cf6237b62b76bca
fold: clarify message for empty revision set and abort instead (BC)

I find it clearer that there are no revisions to fold because none
were specified. Otherwise it seems ambiguous: maybe there are no
revisions to fold because it's impossible to fold whatever was given?
In analogy of other commands that are given no revisions (e.g. strip,
graft), this is also now an abort instead of a mere error message,
which is a BC.

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2098,8 +2098,7 @@  def fold(ui, repo, *revs, **opts):
     else:
         revs = ()
     if not revs:
-        ui.write_err('no revision to fold\n')
-        return 1
+        raise util.Abort(_('no revisions specified'))
     roots = repo.revs('roots(%ld)', revs)
     if len(roots) > 1:
         raise util.Abort("set has multiple roots")
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -614,8 +614,8 @@  Test fold
 
   $ rm *.orig
   $ hg fold
-  no revision to fold
-  [1]
+  abort: no revisions specified
+  [255]
   $ hg fold 6 --rev 10
   abort: cannot specify both --rev and a target revision
   [255]