Patchwork D7355: index: use `index.has_node` in `phabricator.getoldnodedrevmap`

login
register
mail settings
Submitter phabricator
Date Nov. 9, 2019, 5:20 a.m.
Message ID <efee396a70a5602d0ecf916a35b20fa6@localhost.localdomain>
Download mbox | patch
Permalink /patch/43042/
State Not Applicable
Headers show

Comments

phabricator - Nov. 9, 2019, 5:20 a.m.
marmoute updated this revision to Diff 17856.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7355?vs=17778&id=17856

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7355/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7355

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: marmoute, #hg-reviewers, indygreg
Cc: Kwan, mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -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)