comparison hgext/bookmarks.py @ 12026:1938954354ec stable

bookmarks: guard against listing bookmarks on unsupported repos This fixes clones and pulls from statichttprepository repos.
author Martin Geisler <mg@lazybytes.net>
date Mon, 23 Aug 2010 22:16:56 +0200
parents 31dde4c3bb83
children e1a3d7ed478e ebfc46929f3e
comparison
equal deleted inserted replaced
12009:b20211b307b3 12026:1938954354ec
368 delattr(self, attr) 368 delattr(self, attr)
369 369
370 repo.__class__ = bookmark_repo 370 repo.__class__ = bookmark_repo
371 371
372 def listbookmarks(repo): 372 def listbookmarks(repo):
373 # We may try to list bookmarks on a repo type that does not
374 # support it (e.g., statichttprepository).
375 if not hasattr(repo, '_bookmarks'):
376 return {}
377
373 d = {} 378 d = {}
374 for k, v in repo._bookmarks.iteritems(): 379 for k, v in repo._bookmarks.iteritems():
375 d[k] = hex(v) 380 d[k] = hex(v)
376 return d 381 return d
377 382