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.
--- 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