changeset 14946:28762bf809d8

bookmarks: use getattr instead of hasattr
author Augie Fackler <durin42@gmail.com>
date Mon, 25 Jul 2011 15:07:09 -0500
parents 11aad09a6370
children 3aa34005a73d
files mercurial/bookmarks.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Mon Jul 25 20:37:12 2011 -0500
+++ b/mercurial/bookmarks.py	Mon Jul 25 15:07:09 2011 -0500
@@ -151,11 +151,10 @@
 def listbookmarks(repo):
     # We may try to list bookmarks on a repo type that does not
     # support it (e.g., statichttprepository).
-    if not hasattr(repo, '_bookmarks'):
-        return {}
+    marks = getattr(repo, '_bookmarks', {})
 
     d = {}
-    for k, v in repo._bookmarks.iteritems():
+    for k, v in marks.iteritems():
         d[k] = hex(v)
     return d