Patchwork [3,of,6,EVOLVE,V2] fold: emit error message when folding a single revision

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date July 4, 2014, 2:37 p.m.
Message ID <9e2a2864cd20d2160c44.1404484647@Iris>
Download mbox | patch
Permalink /patch/5099/
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 1404138308 14400
#      Mon Jun 30 10:25:08 2014 -0400
# Node ID 9e2a2864cd20d2160c44f4eab260f364eea523b5
# Parent  c90bb870b06306b5d224d4dcbf1c3be328355f73
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.

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2099,6 +2099,11 @@  def fold(ui, repo, *revs, **opts):
         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")
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -619,6 +619,9 @@  Test fold
   $ 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