sapling/tests/test-filecache.py.out
FUJIWARA Katsunori 8a6898b88d scmutil: add file object wrapper class to check ambiguity at closing
In Mercurial source tree, opening a file in "a"/"a+" mode like below
doesn't specify atomictemp=True for vfs, and this avoids file stat
ambiguity check by atomictempfile.

  - writing changes out in revlog layer uses "a+" mode
  - truncation in repair.strip() uses "a" mode
  - truncation in transaction._playback() uses "a" mode

If steps below occurs at "the same time in sec", all of mtime, ctime
and size are same between (1) and (3).

  1. append data to revlog-style file (and close transaction)
  2. discard appended data by truncation (strip or rollback)
  3. append same size but different data to revlog-style file again

Therefore, cache validation doesn't work after (3) as expected.

This patch adds file object wrapper class checkambigatclosing to check
(and get rid of) ambiguity at closing. It is used by vfs in subsequent
patch.

This is a part of ExactCacheValidationPlan.

    https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan

BTW, checkambigatclosing is tested in test-filecache.py, even though
it doesn't use filecache itself, because filecache assumes that file
stat ambiguity never occurs (and there is no another test-*.py related
to filecache).
2016-09-22 21:51:57 +09:00

64 lines
1.1 KiB
Plaintext

basic:
* neither file exists
creating
* neither file still exists
* empty file x created
creating
* file x changed size
creating
* nothing changed with either file
* file x changed inode
creating
* empty file y created
creating
* file y changed size
creating
* file y changed inode
creating
* both files changed inode
creating
fakeuncacheable:
* neither file exists
creating
* neither file still exists
creating
* empty file x created
creating
* file x changed size
creating
* nothing changed with either file
creating
* file x changed inode
creating
* empty file y created
creating
* file y changed size
creating
* file y changed inode
creating
* both files changed inode
creating
repository tip rolled back to revision -1 (undo commit)
working directory now based on revision -1
repository tip rolled back to revision -1 (undo commit)
working directory now based on revision -1
setbeforeget:
* neither file exists
string set externally
* file x created
creating
string from function
* string set externally again
string 2 set externally
* file y created
creating
string from function
antiambiguity: