Mercurial > public > mercurial-scm > hg
comparison mercurial/transaction.py @ 29353:a9ccd9af48ef
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
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 13 Jun 2016 05:11:56 +0900 |
parents | 76b07a5c064b |
children | 599912a62ff6 |
comparison
equal
deleted
inserted
replaced
29352:37c7f9fb7040 | 29353:a9ccd9af48ef |
---|---|
70 try: | 70 try: |
71 if f and b: | 71 if f and b: |
72 filepath = vfs.join(f) | 72 filepath = vfs.join(f) |
73 backuppath = vfs.join(b) | 73 backuppath = vfs.join(b) |
74 try: | 74 try: |
75 util.copyfile(backuppath, filepath) | 75 util.copyfile(backuppath, filepath, checkambig=True) |
76 backupfiles.append(b) | 76 backupfiles.append(b) |
77 except IOError: | 77 except IOError: |
78 report(_("failed to recover %s\n") % f) | 78 report(_("failed to recover %s\n") % f) |
79 else: | 79 else: |
80 target = f or b | 80 target = f or b |