changeset 43597:4cb3f5bb29ec

index: use `index.has_node` in `phabricator.getoldnodedrevmap` Differential Revision: https://phab.mercurial-scm.org/D7355
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 08 Nov 2019 13:26:33 +0100
parents ccda03f6abcb
children a936a3455bb1
files hgext/phabricator.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/phabricator.py	Fri Nov 08 15:09:09 2019 +0100
+++ b/hgext/phabricator.py	Fri Nov 08 13:26:33 2019 +0100
@@ -389,7 +389,7 @@
     corresponding Differential Revision, and exist in the repo.
     """
     unfi = repo.unfiltered()
-    nodemap = unfi.changelog.nodemap
+    has_node = unfi.changelog.index.has_node
 
     result = {}  # {node: (oldnode?, lastdiff?, drev)}
     toconfirm = {}  # {node: (force, {precnode}, drev)}
@@ -398,7 +398,7 @@
         # For tags like "D123", put them into "toconfirm" to verify later
         precnodes = list(obsutil.allpredecessors(unfi.obsstore, [node]))
         for n in precnodes:
-            if n in nodemap:
+            if has_node(n):
                 for tag in unfi.nodetags(n):
                     m = _differentialrevisiontagre.match(tag)
                     if m:
@@ -454,7 +454,7 @@
             if diffs:
                 lastdiff = max(diffs, key=lambda d: int(d[b'id']))
                 oldnode = getnode(lastdiff)
-                if oldnode and oldnode not in nodemap:
+                if oldnode and not has_node(oldnode):
                     oldnode = None
 
             result[newnode] = (oldnode, lastdiff, drev)