[PATCH 3 of 4] transaction: avoid ambiguity of file stat at restoring from backup
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Sun Jun 12 16:15:20 EDT 2016
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1465762316 -32400
# Mon Jun 13 05:11:56 2016 +0900
# Node ID 02167888292b1c6ce3f2993deff4612eaf0a7591
# Parent e49ecef9ba4fa398e5597d7412b94d2f397698ee
transaction: avoid ambiguity of file stat at restoring from backup
In some cases below, copying from backup is used to restore original
contents of a file, which is backuped via addfilegenerator(). If
copying keeps ctime, mtime and size of a file, restoring is
overlooked, and old contents cached before restoring isn't invalidated
as expected.
- failure of transaction (from '.hg/journal.backup.*')
- rollback of previous transaction (from '.hg/undo.backup.*')
To avoid ambiguity of file stat at restoring, this patch invokes
util.copyfile() with checkambig=True.
This patch is a part of "Exact Cache Validation Plan":
https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -72,7 +72,7 @@ def _playback(journal, report, opener, v
filepath = vfs.join(f)
backuppath = vfs.join(b)
try:
- util.copyfile(backuppath, filepath)
+ util.copyfile(backuppath, filepath, checkambig=True)
backupfiles.append(b)
except IOError:
report(_("failed to recover %s\n") % f)
More information about the Mercurial-devel
mailing list