Mercurial > hg-stable
changeset 23316:fc3670f41d3e
transaction: use 'location' instead of 'vfs' in the addbackup method
This unlock the backup of file outside of store (eg: bookmarks).
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 05 Nov 2014 01:59:32 +0000 |
parents | 66275ecc73c1 |
children | 197e17be5407 |
files | mercurial/transaction.py |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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"""