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

login
register
mail settings
Submitter David Soria Parra
Date Oct. 3, 2013, 2:47 p.m.
Message ID <f6ae312f5a1545e2d594.1380811662@achird.localdomain>
Download mbox | patch
Permalink /patch/2724/
State Superseded, archived
Headers show

Comments

David Soria Parra - Oct. 3, 2013, 2:47 p.m.
# HG changeset patch
# User David Soria Parra <dsp@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

Patch

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: