changeset 10597:153d688cdd06 stable

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()
author Paul Molodowitch <pm@stanfordalumni.org>
date Thu, 17 Dec 2009 15:53:28 -0800
parents 7648f32713f2
children 1037bd445768
files hgext/bookmarks.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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):