bookmarks: add invalidate() to bookmark_repo stable
authorPaul Molodowitch <pm@stanfordalumni.org>
Thu, 17 Dec 2009 15:53:28 -0800
branchstable
changeset 10597 153d688cdd06
parent 10596 7648f32713f2
child 10598 1037bd445768
bookmarks: add invalidate() to bookmark_repo Cached bookmark information would not be reset when repo.invalidate() was called, meaning (for instanced) guis would be left with out-of-date bookmark info. This patch fixes that by overriding bookmark_repo.invalidate()
hgext/bookmarks.py
--- a/hgext/bookmarks.py	Tue Jan 12 22:49:10 2010 +0900
+++ b/hgext/bookmarks.py	Thu Dec 17 15:53:28 2009 -0800
@@ -296,6 +296,13 @@
             tags.update(self._bookmarks)
             return (tags, tagtypes)
 
+        if hasattr(repo, 'invalidate'):
+            def invalidate(self):
+                super(bookmark_repo, self).invalidate()
+                for attr in ('_bookmarks', '_bookmarkcurrent'):
+                    if attr in self.__dict__:
+                        delattr(repo, attr)
+
     repo.__class__ = bookmark_repo
 
 def uisetup(ui):