[PATCH 2 of 2] phases: add `hg help phases` hint to failures to edit public commits

Jordi GutiƩrrez Hermoso jordigh at octave.org
Mon Jun 1 13:18:01 CDT 2015


# HG changeset patch
# User Jordi GutiƩrrez Hermoso <jordigh at octave.org>
# Date 1433182612 14400
#      Mon Jun 01 14:16:52 2015 -0400
# Node ID 14eeb0e4425cae80e1cf323e05dbe4beea04da8d
# Parent  6c075f1d088b9ec99876f109c4a51b79c0fbe26c
phases: add `hg help phases` hint to failures to edit public commits

There were a couple of locations that were missing this hint after an
edition of some kind failed due to the public phase.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -928,7 +928,8 @@ def between(repo, old, new, keep):
             raise util.Abort(_('cannot edit history that contains merges'))
         root = ctxs[0] # list is already sorted by repo.set
         if not root.mutable():
-            raise util.Abort(_('cannot edit public changeset: %s') % root)
+            raise util.Abort(_('cannot edit public changeset: %s') % root,
+                             hint=_('see "hg help phases" for details'))
     return [c.node() for c in ctxs]
 
 def makedesc(repo, action, rev):
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -1215,7 +1215,8 @@ def createmarkers(repo, relations, flag=
 
             if not prec.mutable():
                 raise util.Abort("cannot obsolete public changeset: %s"
-                                 % prec)
+                                 % prec,
+                                 hint='see "hg help phases" for details')
             nprec = prec.node()
             nsucs = tuple(s.node() for s in sucs)
             npare = None
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -220,6 +220,7 @@ Check that histedit respect immutability
   
   $ hg histedit -r '.~2'
   abort: cannot edit public changeset: cb9a9f314b8b
+  (see "hg help phases" for details)
   [255]
 
 


More information about the Mercurial-devel mailing list