Skip to navigation
"AttributeError: 'localrepository' object has no attribute 'branchtags'"
03.10.14
Index: tracext/hg/backend.py =================================================================== --- a/tracext/hg/backend.py +++ b/tracext/hg/backend.py @@ -21,4 +21,5 @@ import re import sys +import types import pkg_resources @@ -144,4 +145,24 @@ return s + +# Note: localrepository.branchtags was removed in mercurial-2.9 +# see http://selenic.com/hg/rev/4274eda143cb +def get_branchtags(repo): + """return a dict where branch names map to the tipmost head of + the branch, open heads come before closed_branches + """ + def branchtip(heads): + '''return the tipmost branch head in heads''' + tip = heads[-1] + for h in reversed(heads): + if not repo[h].closesbranch(): + tip = h + break + return tip + + bt = {} + for bn, heads in repo.branchmap().iteritems(): + bt[bn] = branchtip(heads) + return bt class trac_ui(ui): @@ -529,4 +550,7 @@ "%(error)s)", path=path, version=version, error=error)) + # restore branchtags() if needed (see StackOverflow:972) + if not getattr(self.repo, 'branchtags', None): + self.repo.branchtags = types.MethodType(get_branchtags, self.repo) Repository.__init__(self, 'hg:%s' % path, params, log)
http://trac.edgewall.org/changeset/29/mercurial-plugin
Reply
Anonymous
Information Epoch 1714614420
Silence is golden.
Home
Notebook
Contact us