mercurial/transaction.py
changeset 50460 f57f5ab0e220
parent 50447 392e2f31444a
parent 50452 a445194f0a4d
child 50465 63dc24be635d
equal deleted inserted replaced
50459:e06331275a53 50460:f57f5ab0e220
   412         backupfilename = b"%s.backup.%s" % (self._journal, filename)
   412         backupfilename = b"%s.backup.%s" % (self._journal, filename)
   413         backupfile = vfs.reljoin(dirname, backupfilename)
   413         backupfile = vfs.reljoin(dirname, backupfilename)
   414         if vfs.exists(file):
   414         if vfs.exists(file):
   415             filepath = vfs.join(file)
   415             filepath = vfs.join(file)
   416             backuppath = vfs.join(backupfile)
   416             backuppath = vfs.join(backupfile)
       
   417             # store encoding may result in different directory here.
       
   418             # so we have to ensure the destination directory exist
       
   419             final_dir_name = os.path.dirname(backuppath)
       
   420             util.makedirs(final_dir_name, mode=vfs.createmode, notindexed=True)
       
   421             # then we can copy the backup
   417             util.copyfile(filepath, backuppath, hardlink=hardlink)
   422             util.copyfile(filepath, backuppath, hardlink=hardlink)
   418         else:
   423         else:
   419             backupfile = b''
   424             backupfile = b''
   420 
   425 
   421         self._addbackupentry((location, file, backupfile, False))
   426         self._addbackupentry((location, file, backupfile, False))