comparison hgext3rd/topic/__init__.py @ 2000:c413e7c96265

init: guard _namemap with repo.topics (issue5351) This prevents reading extra data on all repo commits when there is no topic for a given name. _namemap is called a lot, and it is often called for commit shas -- which should pretty much never be names of topics...
author timeless@gmail.com
date Fri, 26 Aug 2016 16:57:45 +0000
parents fe76e9c92fff
children aa3b6cfdf493
comparison
equal deleted inserted replaced
1999:fe76e9c92fff 2000:c413e7c96265
82 r = revs[idx - 1] 82 r = revs[idx - 1]
83 except IndexError: 83 except IndexError:
84 msg = _('cannot resolve "%s": topic "%s" has only %d changesets') 84 msg = _('cannot resolve "%s": topic "%s" has only %d changesets')
85 raise error.Abort(msg % (name, topic, len(revs))) 85 raise error.Abort(msg % (name, topic, len(revs)))
86 return [repo[r].node()] 86 return [repo[r].node()]
87 if not name in repo.topics:
88 return []
87 return [ctx.node() for ctx in 89 return [ctx.node() for ctx in
88 repo.set('not public() and extra(topic, %s)', name)] 90 repo.set('not public() and extra(topic, %s)', name)]
89 91
90 def _nodemap(repo, node): 92 def _nodemap(repo, node):
91 ctx = repo[node] 93 ctx = repo[node]