2066 if self.changelog.filteredrevs: |
2066 if self.changelog.filteredrevs: |
2067 tags, tt = self._findtags() |
2067 tags, tt = self._findtags() |
2068 else: |
2068 else: |
2069 tags = self._tagscache.tags |
2069 tags = self._tagscache.tags |
2070 rev = self.changelog.rev |
2070 rev = self.changelog.rev |
2071 for k, v in pycompat.iteritems(tags): |
2071 for k, v in tags.items(): |
2072 try: |
2072 try: |
2073 # ignore tags to unknown nodes |
2073 # ignore tags to unknown nodes |
2074 rev(v) |
2074 rev(v) |
2075 t[k] = v |
2075 t[k] = v |
2076 except (error.LookupError, ValueError): |
2076 except (error.LookupError, ValueError): |
2101 # Build the return dicts. Have to re-encode tag names because |
2101 # Build the return dicts. Have to re-encode tag names because |
2102 # the tags module always uses UTF-8 (in order not to lose info |
2102 # the tags module always uses UTF-8 (in order not to lose info |
2103 # writing to the cache), but the rest of Mercurial wants them in |
2103 # writing to the cache), but the rest of Mercurial wants them in |
2104 # local encoding. |
2104 # local encoding. |
2105 tags = {} |
2105 tags = {} |
2106 for (name, (node, hist)) in pycompat.iteritems(alltags): |
2106 for (name, (node, hist)) in alltags.items(): |
2107 if node != self.nullid: |
2107 if node != self.nullid: |
2108 tags[encoding.tolocal(name)] = node |
2108 tags[encoding.tolocal(name)] = node |
2109 tags[b'tip'] = self.changelog.tip() |
2109 tags[b'tip'] = self.changelog.tip() |
2110 tagtypes = { |
2110 tagtypes = { |
2111 encoding.tolocal(name): value |
2111 encoding.tolocal(name): value for (name, value) in tagtypes.items() |
2112 for (name, value) in pycompat.iteritems(tagtypes) |
|
2113 } |
2112 } |
2114 return (tags, tagtypes) |
2113 return (tags, tagtypes) |
2115 |
2114 |
2116 def tagtype(self, tagname): |
2115 def tagtype(self, tagname): |
2117 """ |
2116 """ |
2136 |
2135 |
2137 def nodetags(self, node): |
2136 def nodetags(self, node): |
2138 '''return the tags associated with a node''' |
2137 '''return the tags associated with a node''' |
2139 if not self._tagscache.nodetagscache: |
2138 if not self._tagscache.nodetagscache: |
2140 nodetagscache = {} |
2139 nodetagscache = {} |
2141 for t, n in pycompat.iteritems(self._tagscache.tags): |
2140 for t, n in self._tagscache.tags.items(): |
2142 nodetagscache.setdefault(n, []).append(t) |
2141 nodetagscache.setdefault(n, []).append(t) |
2143 for tags in pycompat.itervalues(nodetagscache): |
2142 for tags in pycompat.itervalues(nodetagscache): |
2144 tags.sort() |
2143 tags.sort() |
2145 self._tagscache.nodetagscache = nodetagscache |
2144 self._tagscache.nodetagscache = nodetagscache |
2146 return self._tagscache.nodetagscache.get(node, []) |
2145 return self._tagscache.nodetagscache.get(node, []) |
2254 if cmd == b'!': |
2253 if cmd == b'!': |
2255 continue |
2254 continue |
2256 mf = matchmod.match(self.root, b'', [pat]) |
2255 mf = matchmod.match(self.root, b'', [pat]) |
2257 fn = None |
2256 fn = None |
2258 params = cmd |
2257 params = cmd |
2259 for name, filterfn in pycompat.iteritems(self._datafilters): |
2258 for name, filterfn in self._datafilters.items(): |
2260 if cmd.startswith(name): |
2259 if cmd.startswith(name): |
2261 fn = filterfn |
2260 fn = filterfn |
2262 params = cmd[len(name) :].lstrip() |
2261 params = cmd[len(name) :].lstrip() |
2263 break |
2262 break |
2264 if not fn: |
2263 if not fn: |