Comments
Patch
@@ -50,11 +50,11 @@ class bmstore(dict):
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)
+ location='plain')
tr.hookargs['bookmark_moved'] = '1'
def write(self):
'''Write bookmarks
@@ -179,11 +179,12 @@ class transaction(object):
self.backupmap[file] = len(self.backupentries) - 1
self.backupsfile.write("%s\0%s\0" % (file, backupfile))
self.backupsfile.flush()
@active
- def addfilegenerator(self, genid, filenames, genfunc, order=0, vfs=None):
+ def addfilegenerator(self, genid, filenames, genfunc, order=0,
+ location='store'):
"""add a function to generates some files at transaction commit
The `genfunc` argument is a function capable of generating proper
content of each entry in the `filename` tuple.
@@ -200,12 +201,12 @@ class transaction(object):
The `order` argument may be used to control the order in which multiple
generator will be executed.
"""
# For now, we are unable to do proper backup and restore of custom vfs
# but for bookmarks that are handled outside this mechanism.
- assert vfs is None or filenames == ('bookmarks',)
- self._filegenerators[genid] = (order, filenames, genfunc, vfs)
+ assert location == 'store' or filenames == ('bookmarks',)
+ self._filegenerators[genid] = (order, filenames, genfunc, location)
@active
def find(self, file):
if file in self.map:
return self.entries[self.map[file]]
@@ -246,13 +247,12 @@ class transaction(object):
@active
def close(self):
'''commit the transaction'''
# write files registered for generation
for entry in sorted(self._filegenerators.values()):
- order, filenames, genfunc, vfs = entry
- if vfs is None:
- vfs = self.opener
+ order, filenames, genfunc, location = entry
+ vfs = self._vfsmap[location]
files = []
try:
for name in filenames:
# Some files are already backed up when creating the
# localrepo. Until this is properly fixed we disable the