[PATCH 5 of 5 EVOLVE] fold: improve error messages for multiple heads and roots
Jordi Gutiérrez Hermoso
jordigh at octave.org
Mon Jun 30 13:28:32 CDT 2014
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh at octave.org>
# Date 1404149929 14400
# Mon Jun 30 13:38:49 2014 -0400
# Node ID a8b505057e4e4bac8ffa54bd0f89ef7eaa03edc6
# Parent 410a9c3b3232bbb0fd6cd4427b0174311c3ce803
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.
diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2116,13 +2116,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"),
+ hint=_("multiple roots detected"))
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"),
+ hint=_("multiple heads detected"))
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,14 @@ 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 detected)
+ [255]
+ $ hg fold -r 4 -r 6 --exact
+ abort: cannot fold non-linear revisions
+ (multiple roots detected)
+ [255]
$ hg fold 10 1
abort: cannot fold non-linear revisions
(given revisions are unrelated to parent of working directory)
More information about the Mercurial-devel
mailing list