Patchwork [6,of,6,EVOLVE,V2] fold: improve error messages for multiple heads and roots

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date July 4, 2014, 2:37 p.m.
Message ID <738e4f87c21e08ceef8f.1404484650@Iris>
Download mbox | patch
Permalink /patch/5103/
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 1404149929 14400
#      Mon Jun 30 13:38:49 2014 -0400
# Node ID 738e4f87c21e08ceef8f0de490798bac1c0e8d2d
# Parent  8f4540dd29bed33a514e9f50ffcb58920f9ddc9d
fold: improve error messages for multiple heads and roots

This commit adds hints and i18n to the error messages about non-linear
revisions, along with corresponding tests.

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2135,13 +2135,15 @@  def fold(ui, repo, *revs, **opts):
 
     roots = repo.revs('roots(%ld)', revs)
     if len(roots) > 1:
-        raise util.Abort("set has multiple roots")
+        raise util.Abort(_("cannot fold non-linear revisions "
+                           "(multiple roots given)"))
     root = repo[roots[0]]
     if root.phase() <= phases.public:
         raise util.Abort(_("cannot fold public revisions"))
     heads = repo.revs('heads(%ld)', revs)
     if len(heads) > 1:
-        raise util.Abort("set has multiple heads")
+        raise util.Abort(_("cannot fold non-linear revisions "
+                           "(multiple heads given)"))
     head = repo[heads[0]]
     wlock = lock = None
     try:
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,12 @@  Test fold
   $ hg fold .
   single revision specified, nothing to fold
   [1]
+  $ hg fold 0::10 --rev 1 --exact
+  abort: cannot fold non-linear revisions (multiple heads given)
+  [255]
+  $ hg fold -r 4 -r 6 --exact
+  abort: cannot fold non-linear revisions (multiple roots given)
+  [255]
   $ hg fold 10 1
   abort: cannot fold non-linear revisions
   (given revisions are unrelated to parent of working directory)