diff --git a/lib/redmine/scm/adapters/mercurial/redminehelper.py b/lib/redmine/scm/adapters/mercurial/redminehelper.py index bd82c0020..1e1bc8db1 100644 --- a/lib/redmine/scm/adapters/mercurial/redminehelper.py +++ b/lib/redmine/scm/adapters/mercurial/redminehelper.py @@ -79,8 +79,13 @@ def _tags(ui, repo): def _branches(ui, repo): # see mercurial/commands.py:branches def iterbranches(): - for t, n in repo.branchtags().iteritems(): - yield t, n, repo.changelog.rev(n) + if hasattr(repo, 'branchtags'): + # Mercurial < 2.9 + for t, n in repo.branchtags().iteritems(): + yield t, n, repo.changelog.rev(n) + else: + for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): + yield tag, tip, repo.changelog.rev(tip) def branchheads(branch): try: return repo.branchheads(branch, closed=False)