Patchwork [2,of,5,EVOLVE] fold: emit error message when folding a single revision

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date June 30, 2014, 6:28 p.m.
Message ID <04afee1615a9823298b0.1404152909@Iris>
Download mbox | patch
Permalink /patch/5086/
State Changes Requested
Headers show

Comments

Jordi Gutiérrez Hermoso - June 30, 2014, 6:28 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 04afee1615a9823298b011ed1ab1ff1e2b686a1e
# Parent  5b362328531a3e47a18b21cb80659e81c37edf3a
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