Mercurial > hg
changeset 23315:66275ecc73c1
addbackup: handle file in subdirectory
The current naming scheme ('journal.backups.<file>') resulted is bad directory
name when 'file' was in a subdirectory. We now extract the directory name and
create the backupfile within it.
We plan to use file in a subdirectory for cachefile.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 14 Nov 2014 00:14:23 +0000 |
parents | 43f66ae57a66 |
children | fc3670f41d3e |
files | mercurial/transaction.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/transaction.py Fri Nov 14 14:54:55 2014 +0000 +++ b/mercurial/transaction.py Fri Nov 14 00:14:23 2014 +0000 @@ -12,6 +12,7 @@ # GNU General Public License version 2 or any later version. from i18n import _ +import os import errno import error, util @@ -203,7 +204,10 @@ if file in self.map or file in self._backupmap: return - backupfile = "%s.backup.%s" % (self.journal, file) + 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 if vfs.exists(file):