changeset 995:0f3a7efd6ee9

fold: emit error message when folding a single revision Previously, a confusing error state would happen if the revision set to fold was a singleton.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Mon, 30 Jun 2014 10:25:08 -0400
parents debf44fa91a2
children b98dd5d3065c
files hgext/evolve.py tests/test-evolve.t
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Mon Jun 30 10:27:15 2014 -0400
+++ b/hgext/evolve.py	Mon Jun 30 10:25:08 2014 -0400
@@ -2099,6 +2099,11 @@
         revs = ()
     if not revs:
         raise util.Abort(_('no revisions specified'))
+
+    if len(revs) == 1:
+        ui.write_err(_('single revision specified, nothing to fold\n'))
+        return 1
+
     roots = repo.revs('roots(%ld)', revs)
     if len(roots) > 1:
         raise util.Abort("set has multiple roots")
--- a/tests/test-evolve.t	Mon Jun 30 10:27:15 2014 -0400
+++ b/tests/test-evolve.t	Mon Jun 30 10:25:08 2014 -0400
@@ -619,6 +619,9 @@
   $ hg fold 6 --rev 10
   abort: cannot specify both --rev and a target revision
   [255]
+  $ hg fold .
+  single revision specified, nothing to fold
+  [1]
   $ hg fold 6 # want to run hg fold 6
   2 changesets folded
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved