bookmarks: use getattr instead of hasattr
authorAugie Fackler <durin42@gmail.com>
Mon, 25 Jul 2011 15:07:09 -0500
changeset 14946 28762bf809d8
parent 14945 11aad09a6370
child 14947 3aa34005a73d
bookmarks: use getattr instead of hasattr
mercurial/bookmarks.py
--- 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