[PATCH 1 of 3] bookmarks: allow bmstore to re-read bookmarks from file

David Soria Parra dsp at experimentalworks.net
Thu Oct 3 09:47:42 CDT 2013


# HG changeset patch
# User David Soria Parra <dsp at experimentalworks.net>
# Date 1380807015 -7200
#      Thu Oct 03 15:30:15 2013 +0200
# Node ID f6ae312f5a1545e2d594ab407fe19e1a16efedc4
# Parent  a69a77a80900eabe1257c935818d0910217e9702
bookmarks: allow bmstore to re-read bookmarks from file

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -28,19 +28,22 @@
     def __init__(self, repo):
         dict.__init__(self)
         self._repo = repo
+        self.read()
+
+    def read(self):
         try:
-            for line in repo.vfs('bookmarks'):
+            for line in self._repo.vfs('bookmarks'):
                 line = line.strip()
                 if not line:
                     continue
                 if ' ' not in line:
-                    repo.ui.warn(_('malformed line in .hg/bookmarks: %r\n')
-                                 % line)
+                    self._repo.ui.warn(_('malformed line in .hg/bookmarks:'
+                                         ' %r\n') % line)
                     continue
                 sha, refspec = line.split(' ', 1)
                 refspec = encoding.tolocal(refspec)
                 try:
-                    self[refspec] = repo.changelog.lookup(sha)
+                    self[refspec] = self._repo.changelog.lookup(sha)
                 except LookupError:
                     pass
         except IOError, inst:


More information about the Mercurial-devel mailing list