transaction: use 'location' instead of 'vfs' in the addbackup method
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 05 Nov 2014 01:59:32 +0000
changeset 23316 fc3670f41d3e
parent 23315 66275ecc73c1
child 23317 197e17be5407
transaction: use 'location' instead of 'vfs' in the addbackup method This unlock the backup of file outside of store (eg: bookmarks).
mercurial/transaction.py
--- a/mercurial/transaction.py	Fri Nov 14 00:14:23 2014 +0000
+++ b/mercurial/transaction.py	Wed Nov 05 01:59:32 2014 +0000
@@ -188,7 +188,7 @@
         self.file.flush()
 
     @active
-    def addbackup(self, file, hardlink=True, vfs=None):
+    def addbackup(self, file, hardlink=True, location=''):
         """Adds a backup of the file to the transaction
 
         Calling addbackup() creates a hardlink backup of the specified file
@@ -205,11 +205,9 @@
         if file in self.map or file in self._backupmap:
             return
         dirname, filename = os.path.split(file)
-
         backupfilename = "%s.backup.%s" % (self.journal, filename)
         backupfile = os.path.join(dirname, backupfilename)
-        if vfs is None:
-            vfs = self.opener
+        vfs = self._vfsmap[location]
         if vfs.exists(file):
             filepath = vfs.join(file)
             backuppath = vfs.join(backupfile)
@@ -217,7 +215,7 @@
         else:
             backupfile = ''
 
-        self._addbackupentry(('', file, backupfile, False))
+        self._addbackupentry((location, file, backupfile, False))
 
     def _addbackupentry(self, entry):
         """register a new backup entry and write it to disk"""