# HG changeset patch # User Pierre-Yves David # Date 1415924063 0 # Node ID 66275ecc73c1a744319eda29277e7ceec462bd87 # Parent 43f66ae57a66499e14bd0949d262ab9b5664f7f9 addbackup: handle file in subdirectory The current naming scheme ('journal.backups.') 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. diff -r 43f66ae57a66 -r 66275ecc73c1 mercurial/transaction.py --- 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):