Patchwork D7342: index: use `index.has_node` in `tags.findglobaltags`

login
register
mail settings
Submitter phabricator
Date Nov. 8, 2019, 4:25 p.m.
Message ID <differential-rev-PHID-DREV-xhmc7f27q5tjl5vtnnjw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42947/
State Superseded
Headers show

Comments

phabricator - Nov. 8, 2019, 4:25 p.m.
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/tags.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 8, 2019, 10:12 p.m.
This revision is now accepted and ready to land.
indygreg added inline comments.
indygreg accepted this revision.

INLINE COMMENTS

> tags.py:198
> +        assert repo.changelog.index.has_node(
> +            head
>          ), b"tag cache returned bogus head %s" % short(head)

`repo.changelog` in loops is bad. If you could do a follow-up that aliases `repo.changelog.index.has_node` outside of the loop, it would be appreciated.

REPOSITORY
  rHG Mercurial

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

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

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

Patch

diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -194,8 +194,8 @@ 
         return alltags
 
     for head in reversed(heads):  # oldest to newest
-        assert (
-            head in repo.changelog.nodemap
+        assert repo.changelog.index.has_node(
+            head
         ), b"tag cache returned bogus head %s" % short(head)
     fnodes = _filterfnodes(tagfnode, reversed(heads))
     alltags = _tagsfromfnodes(ui, repo, fnodes)