[PATCH 2 of 6] bookmarks: eliminate infinite lookup suspicions

Nicolas Dumazet nicdumz at gmail.com
Mon Dec 21 00:24:57 CST 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1261375517 -32400
# Node ID cacf8011e7a496f199a8a7d6c8a44c91693b306b
# Parent  ea1d25164f9776507ef18dd6d273f49c8a89da9f
bookmarks: eliminate infinite lookup suspicions

When parsing _bookmarks, we explicitely need super( ).lookup( )
Write down this call instead of relying on a (if key in self._bookmarks) test
that has no reason to work in current code.
Also update the docstrings of parse: the value of _bookmarks was never deleted,
even after a write()

diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
--- a/hgext/bookmarks.py
+++ b/hgext/bookmarks.py
@@ -37,16 +37,14 @@
     '''Parse .hg/bookmarks file and return a dictionary
 
     Bookmarks are stored as {HASH}\\s{NAME}\\n (localtags format) values
-    in the .hg/bookmarks file. They are read by the parse() method and
-    returned as a dictionary with name => hash values.
-
-    The parsed dictionary is cached until a write() operation is done.
+    in the .hg/bookmarks file. They are read returned as a dictionary
+    with name => hash values.
     '''
     try:
         bookmarks = {}
         for line in repo.opener('bookmarks'):
             sha, refspec = line.strip().split(' ', 1)
-            bookmarks[refspec] = repo.lookup(sha)
+            bookmarks[refspec] = super(bookmark_repo, repo).lookup(sha)
     except:
         pass
     return bookmarks
@@ -232,8 +230,6 @@
     if not repo.local():
         return
 
-    # init a bookmark cache as otherwise we would get a infinite reading
-    # in lookup()
     repo._bookmarkcurrent = None
 
     class bookmark_repo(repo.__class__):


More information about the Mercurial-devel mailing list