use Python getattr instead of hasattr (#16177)

git-svn-id: http://svn.redmine.org/redmine/trunk@12935 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-02-26 16:28:43 +00:00
parent 7b295f379b
commit 0cf7a27b50
1 changed files with 1 additions and 1 deletions

View File

@ -79,7 +79,7 @@ def _tags(ui, repo):
def _branches(ui, repo): def _branches(ui, repo):
# see mercurial/commands.py:branches # see mercurial/commands.py:branches
def iterbranches(): def iterbranches():
if hasattr(repo, 'branchtags'): if getattr(repo, 'branchtags', None) is not None:
# Mercurial < 2.9 # Mercurial < 2.9
for t, n in repo.branchtags().iteritems(): for t, n in repo.branchtags().iteritems():
yield t, n, repo.changelog.rev(n) yield t, n, repo.changelog.rev(n)