[PATCH 1 of 3] bookmark: simplify mutability check in `validdest`

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Fri Nov 9 18:21:10 UTC 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1351092400 -7200
# Node ID 858ae42f38cf487dce799965216c1716f7bc3132
# Parent  fb14a5dcdc62987512820531fe60719d650491b6
bookmark: simplify mutability check in `validdest`

There is no need to check phase by hand. We already have a ctx method for that.

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -5,11 +5,11 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
 from mercurial.i18n import _
 from mercurial.node import hex
-from mercurial import encoding, error, util, obsolete, phases
+from mercurial import encoding, error, util, obsolete
 import errno, os
 
 def read(repo):
     '''Parse .hg/bookmarks file and return a dictionary
 
@@ -262,11 +262,11 @@ def validdest(repo, old, new):
         # compute the whole set of successors or descendants
         while len(validdests) != plen:
             plen = len(validdests)
             succs = set(c.node() for c in validdests)
             for c in validdests:
-                if c.phase() > phases.public:
+                if c.mutable():
                     # obsolescence marker does not apply to public changeset
                     succs.update(obsolete.allsuccessors(repo.obsstore,
                                                         [c.node()]))
             known = (n for n in succs if n in nm)
             validdests = set(repo.set('%ln::', known))


More information about the Mercurial-devel mailing list