changeset 22665:8319f7e78395

bookmark: add a `bmstore.recordupdate` to plug bookmarks into the transaction Instead of manually writing bookmarks when they are updated, we can just record this update to the transaction and rely on it to update the on-disk file.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sun, 28 Sep 2014 00:41:55 -0700
parents 6bd685d2a2de
children 0f8120c1ecf5
files mercurial/bookmarks.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Sat Sep 27 03:10:33 2014 -0700
+++ b/mercurial/bookmarks.py	Sun Sep 28 00:41:55 2014 -0700
@@ -47,6 +47,13 @@
             if inst.errno != errno.ENOENT:
                 raise
 
+    def recordchange(self, tr):
+        """record that bookmarks have been changed in a transaction
+
+        The transaction is then responsible for updating the file content."""
+        tr.addfilegenerator('bookmarks', ('bookmarks',), self._write,
+                            vfs=self._repo.vfs)
+
     def write(self):
         '''Write bookmarks