Patchwork [2,of,3,RFC] transaction: handle backup paths with path separators

login
register
mail settings
Submitter Gregory Szorc
Date May 28, 2014, 6 a.m.
Message ID <02939296b8052833d4c8.1401256846@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4881/
State Changes Requested
Headers show

Comments

Gregory Szorc - May 28, 2014, 6 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1401253139 25200
#      Tue May 27 21:58:59 2014 -0700
# Node ID 02939296b8052833d4c8bfa6e2e2f1371fe5c517
# Parent  13eea2d1b1ada719436f52596a71d8286d7c1391
transaction: handle backup paths with path separators

transaction.addbackup() now properly handles source paths containing
path separators ("/"). Previously, paths with "/" would result in
failure at backup time because the backup file would contain a "/".

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -154,9 +154,9 @@  class transaction(object):
         """
 
         if file in self.map or file in self.backupmap:
             return
-        backupfile = "journal.%s" % file
+        backupfile = "journal.%s" % file.replace('/', '.')
         if self.opener.exists(file):
             filepath = self.opener.join(file)
             backuppath = self.opener.join(backupfile)
             util.copyfiles(filepath, backuppath, hardlink=hardlink)