Patchwork [1,of,5] transaction: use `self.journal` to create backup file

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 7, 2014, 10:51 p.m.
Message ID <ee1123db6db51c45c3ea.1407451919@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5326/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 7, 2014, 10:51 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1407437792 25200
#      Thu Aug 07 11:56:32 2014 -0700
# Node ID ee1123db6db51c45c3ea2205a0e17273c6a87930
# Parent  ae3d223d32629e10df670dabcbc06e7e1a11368b
transaction: use `self.journal` to create backup file

Transaction journal name is "journal" in most case, but it can be something else.
We use the appropriate attribute to create the file.

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -152,11 +152,11 @@  class transaction(object):
         * `hardlink`: use a hardlink to quickly create the backup
         """
 
         if file in self.map or file in self.backupmap:
             return
-        backupfile = "journal.%s" % file
+        backupfile = "%s.%s" % (self.journal, file)
         if self.opener.exists(file):
             filepath = self.opener.join(file)
             backuppath = self.opener.join(backupfile)
             util.copyfiles(filepath, backuppath, hardlink=hardlink)
         else: