changeset 998:85ec2a55fe7c

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.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Mon, 30 Jun 2014 13:38:49 -0400
parents f48cd2f48d14
children 38099dfdcbbe
files hgext/evolve.py tests/test-evolve.t
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Mon Jun 30 13:37:15 2014 -0400
+++ b/hgext/evolve.py	Mon Jun 30 13:38:49 2014 -0400
@@ -2135,13 +2135,15 @@
 
     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:
--- a/tests/test-evolve.t	Mon Jun 30 13:37:15 2014 -0400
+++ b/tests/test-evolve.t	Mon Jun 30 13:38:49 2014 -0400
@@ -619,6 +619,12 @@
   $ 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)