bookmark: add a `bmstore.recordupdate` to plug bookmarks into the transaction
authorPierre-Yves David <pierre-yves.david@fb.com>
Sun, 28 Sep 2014 00:41:55 -0700
changeset 22665 8319f7e78395
parent 22664 6bd685d2a2de
child 22666 0f8120c1ecf5
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.
mercurial/bookmarks.py
--- 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