changeset 15902:4252d9f08d7e

phases: use nodemap to check for missing nodes
author Sune Foldager <cryo@cyanite.org>
date Wed, 18 Jan 2012 16:46:15 +0100
parents 73c4b3d0c711
children 0329d3b12d8e
files mercurial/phases.py tests/test-keyword.t
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/phases.py	Wed Jan 18 14:50:17 2012 +0100
+++ b/mercurial/phases.py	Wed Jan 18 16:46:15 2012 +0100
@@ -141,8 +141,9 @@
     """
     if phaseroots is None:
         phaseroots = repo._phaseroots
+    nodemap = repo.changelog.nodemap # to filter unknown nodes
     for phase, nodes in enumerate(phaseroots):
-        missing = [node for node in nodes if node not in repo]
+        missing = [node for node in nodes if node not in nodemap]
         if missing:
             for mnode in missing:
                 msg = _('Removing unknown node %(n)s from %(p)i-phase boundary')
@@ -266,7 +267,7 @@
     """
     # build list from dictionary
     draftroots = []
-    nm = repo.changelog.nodemap # to filter unknown node
+    nodemap = repo.changelog.nodemap # to filter unknown nodes
     for nhex, phase in roots.iteritems():
         if nhex == 'publishing': # ignore data related to publish option
             continue
@@ -277,7 +278,7 @@
                 msg = _('ignoring inconsistense public root from remote: %s')
                 repo.ui.warn(msg, nhex)
         elif phase == 1:
-            if node in nm:
+            if node in nodemap:
                 draftroots.append(node)
         else:
             msg = _('ignoring unexpected root from remote: %i %s')
--- a/tests/test-keyword.t	Wed Jan 18 14:50:17 2012 +0100
+++ b/tests/test-keyword.t	Wed Jan 18 16:46:15 2012 +0100
@@ -556,6 +556,7 @@
 Commit and show expansion in original and copy
 
   $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
+  invalidating branch cache (tip differs)
   c
    c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
   overwriting c expanding keywords