Mercurial > hg
comparison mercurial/bookmarks.py @ 43544:886ec3962c66
index: use `index.has_node` in `bookmarks.bmstore`
Differential Revision: https://phab.mercurial-scm.org/D7344
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 08 Nov 2019 13:36:02 +0100 |
parents | 8ff1ecfadcd1 |
children | 2a8cd7edf409 |
comparison
equal
deleted
inserted
replaced
43543:2c3afd083e45 | 43544:886ec3962c66 |
---|---|
76 self._repo = repo | 76 self._repo = repo |
77 self._refmap = refmap = {} # refspec: node | 77 self._refmap = refmap = {} # refspec: node |
78 self._nodemap = nodemap = {} # node: sorted([refspec, ...]) | 78 self._nodemap = nodemap = {} # node: sorted([refspec, ...]) |
79 self._clean = True | 79 self._clean = True |
80 self._aclean = True | 80 self._aclean = True |
81 nm = repo.changelog.nodemap | 81 has_node = repo.changelog.index.has_node |
82 tonode = bin # force local lookup | 82 tonode = bin # force local lookup |
83 try: | 83 try: |
84 with _getbkfile(repo) as bkfile: | 84 with _getbkfile(repo) as bkfile: |
85 for line in bkfile: | 85 for line in bkfile: |
86 line = line.strip() | 86 line = line.strip() |
87 if not line: | 87 if not line: |
88 continue | 88 continue |
89 try: | 89 try: |
90 sha, refspec = line.split(b' ', 1) | 90 sha, refspec = line.split(b' ', 1) |
91 node = tonode(sha) | 91 node = tonode(sha) |
92 if node in nm: | 92 if has_node(node): |
93 refspec = encoding.tolocal(refspec) | 93 refspec = encoding.tolocal(refspec) |
94 refmap[refspec] = node | 94 refmap[refspec] = node |
95 nrefs = nodemap.get(node) | 95 nrefs = nodemap.get(node) |
96 if nrefs is None: | 96 if nrefs is None: |
97 nodemap[node] = [refspec] | 97 nodemap[node] = [refspec] |