tests/test-filecache.py
author Gregory Szorc <gregory.szorc@gmail.com>
Mon, 21 Feb 2022 13:08:28 -0700
changeset 48946 642e31cb55f0
parent 48875 6000f5b25c9b
child 49285 56f98406831b
permissions -rw-r--r--
py3: use class X: instead of class X(object): The inheritance from object is implied in Python 3. So this should be equivalent. This change was generated via an automated search and replace. So there may have been some accidental changes. Differential Revision: https://phab.mercurial-scm.org/D12352
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28741
fc5f548393bf py3: use absolute_import in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 26098
diff changeset
     1
import os
36781
ffa3026d4196 cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime
Augie Fackler <augie@google.com>
parents: 36286
diff changeset
     2
import stat
28741
fc5f548393bf py3: use absolute_import in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 26098
diff changeset
     3
import subprocess
fc5f548393bf py3: use absolute_import in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 26098
diff changeset
     4
import sys
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     5
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
     6
if subprocess.call(
45834
e01ea8325859 test-filecache: use sys.executable to call python
Mathias De Mare <mathias.de_mare@nokia.com>
parents: 43076
diff changeset
     7
    [sys.executable, '%s/hghave' % os.environ['TESTDIR'], 'cacheable']
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
     8
):
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     9
    sys.exit(80)
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    10
37900
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    11
print_ = print
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
    12
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
    13
37900
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    14
def print(*args, **kwargs):
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    15
    """print() wrapper that flushes stdout buffers to avoid py3 buffer issues
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    16
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    17
    We could also just write directly to sys.stdout.buffer the way the
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    18
    ui object will, but this was easier for porting the test.
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    19
    """
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    20
    print_(*args, **kwargs)
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    21
    sys.stdout.flush()
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    22
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
    23
28802
b16eacf5347c test-filecache: sort import lines
Yuya Nishihara <yuya@tcha.org>
parents: 28742
diff changeset
    24
from mercurial import (
b16eacf5347c test-filecache: sort import lines
Yuya Nishihara <yuya@tcha.org>
parents: 28742
diff changeset
    25
    extensions,
b16eacf5347c test-filecache: sort import lines
Yuya Nishihara <yuya@tcha.org>
parents: 28742
diff changeset
    26
    hg,
31284
74cbbd5420ba filecache: explicitly test 'repofilecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31251
diff changeset
    27
    localrepo,
36286
daa5f47558cf py3: use range instead of xrange on py3 in tests/test-filecache.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 31284
diff changeset
    28
    pycompat,
28803
76c091f9711e test-filecache: alias ui as uimod
Yuya Nishihara <yuya@tcha.org>
parents: 28802
diff changeset
    29
    ui as uimod,
28802
b16eacf5347c test-filecache: sort import lines
Yuya Nishihara <yuya@tcha.org>
parents: 28742
diff changeset
    30
    util,
31251
34d57ddaf9f2 vfs: use 'vfs' module directly in 'test-filecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31216
diff changeset
    31
    vfs as vfsmod,
28802
b16eacf5347c test-filecache: sort import lines
Yuya Nishihara <yuya@tcha.org>
parents: 28742
diff changeset
    32
)
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    33
36286
daa5f47558cf py3: use range instead of xrange on py3 in tests/test-filecache.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 31284
diff changeset
    34
if pycompat.ispy3:
daa5f47558cf py3: use range instead of xrange on py3 in tests/test-filecache.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 31284
diff changeset
    35
    xrange = range
daa5f47558cf py3: use range instead of xrange on py3 in tests/test-filecache.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 31284
diff changeset
    36
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
    37
48946
642e31cb55f0 py3: use class X: instead of class X(object):
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48875
diff changeset
    38
class fakerepo:
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    39
    def __init__(self):
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    40
        self._filecache = {}
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    41
48946
642e31cb55f0 py3: use class X: instead of class X(object):
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48875
diff changeset
    42
    class fakevfs:
31284
74cbbd5420ba filecache: explicitly test 'repofilecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31251
diff changeset
    43
        def join(self, p):
74cbbd5420ba filecache: explicitly test 'repofilecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31251
diff changeset
    44
            return p
74cbbd5420ba filecache: explicitly test 'repofilecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31251
diff changeset
    45
74cbbd5420ba filecache: explicitly test 'repofilecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31251
diff changeset
    46
    vfs = fakevfs()
74cbbd5420ba filecache: explicitly test 'repofilecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31251
diff changeset
    47
74cbbd5420ba filecache: explicitly test 'repofilecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31251
diff changeset
    48
    def unfiltered(self):
74cbbd5420ba filecache: explicitly test 'repofilecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31251
diff changeset
    49
        return self
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    50
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    51
    def sjoin(self, p):
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    52
        return p
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    53
31284
74cbbd5420ba filecache: explicitly test 'repofilecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31251
diff changeset
    54
    @localrepo.repofilecache('x', 'y')
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    55
    def cached(self):
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
    56
        print('creating')
20040
ed80cecdfc57 test-filecache.py: make setbeforeget test clearer
Siddharth Agarwal <sid0@fb.com>
parents: 18316
diff changeset
    57
        return 'string from function'
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    58
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    59
    def invalidate(self):
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    60
        for k in self._filecache:
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    61
            try:
37900
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
    62
                delattr(self, pycompat.sysstr(k))
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    63
            except AttributeError:
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    64
                pass
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    65
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
    66
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    67
def basic(repo):
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
    68
    print("* neither file exists")
20041
42deff43460a test-filecache.py: add markers to the output for each event
Siddharth Agarwal <sid0@fb.com>
parents: 20040
diff changeset
    69
    # calls function
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    70
    repo.cached
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    71
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    72
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
    73
    print("* neither file still exists")
20041
42deff43460a test-filecache.py: add markers to the output for each event
Siddharth Agarwal <sid0@fb.com>
parents: 20040
diff changeset
    74
    # uses cache
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    75
    repo.cached
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    76
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    77
    # create empty file
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    78
    f = open('x', 'w')
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    79
    f.close()
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    80
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
    81
    print("* empty file x created")
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    82
    # should recreate the object
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    83
    repo.cached
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    84
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    85
    f = open('x', 'w')
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    86
    f.write('a')
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    87
    f.close()
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    88
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
    89
    print("* file x changed size")
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    90
    # should recreate the object
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    91
    repo.cached
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    92
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    93
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
    94
    print("* nothing changed with either file")
20041
42deff43460a test-filecache.py: add markers to the output for each event
Siddharth Agarwal <sid0@fb.com>
parents: 20040
diff changeset
    95
    # stats file again, reuses object
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    96
    repo.cached
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    97
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    98
    # atomic replace file, size doesn't change
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    99
    # hopefully st_mtime doesn't change as well so this doesn't use the cache
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   100
    # because of inode change
37900
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   101
    f = vfsmod.vfs(b'.')(b'x', b'w', atomictemp=True)
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   102
    f.write(b'b')
15057
774da7121fc9 atomictempfile: make close() consistent with other file-like objects.
Greg Ward <greg@gerg.ca>
parents: 14982
diff changeset
   103
    f.close()
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   104
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   105
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   106
    print("* file x changed inode")
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   107
    repo.cached
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   108
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   109
    # create empty file y
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   110
    f = open('y', 'w')
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   111
    f.close()
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   112
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   113
    print("* empty file y created")
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   114
    # should recreate the object
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   115
    repo.cached
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   116
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   117
    f = open('y', 'w')
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   118
    f.write('A')
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   119
    f.close()
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   120
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   121
    print("* file y changed size")
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   122
    # should recreate the object
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   123
    repo.cached
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   124
37900
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   125
    f = vfsmod.vfs(b'.')(b'y', b'w', atomictemp=True)
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   126
    f.write(b'B')
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   127
    f.close()
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   128
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   129
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   130
    print("* file y changed inode")
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   131
    repo.cached
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   132
37900
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   133
    f = vfsmod.vfs(b'.')(b'x', b'w', atomictemp=True)
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   134
    f.write(b'c')
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   135
    f.close()
37900
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   136
    f = vfsmod.vfs(b'.')(b'y', b'w', atomictemp=True)
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   137
    f.write(b'C')
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   138
    f.close()
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   139
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   140
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   141
    print("* both files changed inode")
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   142
    repo.cached
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   143
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   144
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   145
def fakeuncacheable():
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   146
    def wrapcacheable(orig, *args, **kwargs):
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   147
        return False
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   148
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   149
    def wrapinit(orig, *args, **kwargs):
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   150
        pass
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   151
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   152
    originit = extensions.wrapfunction(util.cachestat, '__init__', wrapinit)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   153
    origcacheable = extensions.wrapfunction(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   154
        util.cachestat, 'cacheable', wrapcacheable
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   155
    )
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   156
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   157
    for fn in ['x', 'y']:
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   158
        try:
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   159
            os.remove(fn)
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   160
        except OSError:
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   161
            pass
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   162
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   163
    basic(fakerepo())
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   164
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   165
    util.cachestat.cacheable = origcacheable
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   166
    util.cachestat.__init__ = originit
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   167
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   168
18313
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   169
def test_filecache_synced():
26098
ce26928cbe41 spelling: behaviour -> behavior
timeless@mozdev.org
parents: 20045
diff changeset
   170
    # test old behavior that caused filecached properties to go out of sync
18313
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   171
    os.system('hg init && echo a >> a && hg ci -qAm.')
30559
d83ca854fa21 ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents: 30332
diff changeset
   172
    repo = hg.repository(uimod.ui.load())
18313
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   173
    # first rollback clears the filecache, but changelog to stays in __dict__
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   174
    repo.rollback()
37900
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   175
    repo.commit(b'.')
18313
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   176
    # second rollback comes along and touches the changelog externally
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   177
    # (file is moved)
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   178
    repo.rollback()
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   179
    # but since changelog isn't under the filecache control anymore, we don't
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   180
    # see that it changed, and return the old changelog without reconstructing
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   181
    # it
37900
b3ffa2faae04 tests: port test-filecache.py to Python 3
Augie Fackler <augie@google.com>
parents: 36781
diff changeset
   182
    repo.commit(b'.')
18313
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   183
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   184
18316
f36375576ed5 filecache: create an entry in _filecache when __set__ is called for a missing one
Idan Kamara <idankk86@gmail.com>
parents: 18313
diff changeset
   185
def setbeforeget(repo):
f36375576ed5 filecache: create an entry in _filecache when __set__ is called for a missing one
Idan Kamara <idankk86@gmail.com>
parents: 18313
diff changeset
   186
    os.remove('x')
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   187
    os.remove('y')
40424
7caf632e30c3 filecache: unimplement __set__() and __delete__() (API)
Yuya Nishihara <yuya@tcha.org>
parents: 37900
diff changeset
   188
    repo.__class__.cached.set(repo, 'string set externally')
18316
f36375576ed5 filecache: create an entry in _filecache when __set__ is called for a missing one
Idan Kamara <idankk86@gmail.com>
parents: 18313
diff changeset
   189
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   190
    print("* neither file exists")
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   191
    print(repo.cached)
18316
f36375576ed5 filecache: create an entry in _filecache when __set__ is called for a missing one
Idan Kamara <idankk86@gmail.com>
parents: 18313
diff changeset
   192
    repo.invalidate()
f36375576ed5 filecache: create an entry in _filecache when __set__ is called for a missing one
Idan Kamara <idankk86@gmail.com>
parents: 18313
diff changeset
   193
    f = open('x', 'w')
f36375576ed5 filecache: create an entry in _filecache when __set__ is called for a missing one
Idan Kamara <idankk86@gmail.com>
parents: 18313
diff changeset
   194
    f.write('a')
f36375576ed5 filecache: create an entry in _filecache when __set__ is called for a missing one
Idan Kamara <idankk86@gmail.com>
parents: 18313
diff changeset
   195
    f.close()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   196
    print("* file x created")
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   197
    print(repo.cached)
18316
f36375576ed5 filecache: create an entry in _filecache when __set__ is called for a missing one
Idan Kamara <idankk86@gmail.com>
parents: 18313
diff changeset
   198
40424
7caf632e30c3 filecache: unimplement __set__() and __delete__() (API)
Yuya Nishihara <yuya@tcha.org>
parents: 37900
diff changeset
   199
    repo.__class__.cached.set(repo, 'string 2 set externally')
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   200
    repo.invalidate()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   201
    print("* string set externally again")
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   202
    print(repo.cached)
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   203
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   204
    repo.invalidate()
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   205
    f = open('y', 'w')
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   206
    f.write('b')
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   207
    f.close()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   208
    print("* file y created")
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   209
    print(repo.cached)
20045
b3684fd2ff1a scmutil.filecache: support watching over multiple files
Siddharth Agarwal <sid0@fb.com>
parents: 20041
diff changeset
   210
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   211
29995
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   212
def antiambiguity():
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   213
    filename = 'ambigcheck'
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   214
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   215
    # try some times, because reproduction of ambiguity depends on
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   216
    # "filesystem time"
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   217
    for i in xrange(5):
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   218
        fp = open(filename, 'w')
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   219
        fp.write('FOO')
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   220
        fp.close()
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   221
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   222
        oldstat = os.stat(filename)
36781
ffa3026d4196 cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime
Augie Fackler <augie@google.com>
parents: 36286
diff changeset
   223
        if oldstat[stat.ST_CTIME] != oldstat[stat.ST_MTIME]:
29995
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   224
            # subsequent changing never causes ambiguity
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   225
            continue
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   226
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   227
        repetition = 3
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   228
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   229
        # repeat changing via checkambigatclosing, to examine whether
30332
318a24b52eeb spelling: fixes of non-dictionary words
Mads Kiilerich <madski@unity3d.com>
parents: 29995
diff changeset
   230
        # st_mtime is advanced multiple times as expected
29995
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   231
        for i in xrange(repetition):
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   232
            # explicit closing
31251
34d57ddaf9f2 vfs: use 'vfs' module directly in 'test-filecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31216
diff changeset
   233
            fp = vfsmod.checkambigatclosing(open(filename, 'a'))
29995
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   234
            fp.write('FOO')
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   235
            fp.close()
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   236
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   237
            # implicit closing by "with" statement
31251
34d57ddaf9f2 vfs: use 'vfs' module directly in 'test-filecache'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31216
diff changeset
   238
            with vfsmod.checkambigatclosing(open(filename, 'a')) as fp:
29995
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   239
                fp.write('BAR')
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   240
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   241
        newstat = os.stat(filename)
36781
ffa3026d4196 cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime
Augie Fackler <augie@google.com>
parents: 36286
diff changeset
   242
        if oldstat[stat.ST_CTIME] != newstat[stat.ST_CTIME]:
29995
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   243
            # timestamp ambiguity was naturally avoided while repetition
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   244
            continue
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   245
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   246
        # st_mtime should be advanced "repetition * 2" times, because
30332
318a24b52eeb spelling: fixes of non-dictionary words
Mads Kiilerich <madski@unity3d.com>
parents: 29995
diff changeset
   247
        # all changes occurred at same time (in sec)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   248
        expected = (oldstat[stat.ST_MTIME] + repetition * 2) & 0x7FFFFFFF
36781
ffa3026d4196 cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime
Augie Fackler <augie@google.com>
parents: 36286
diff changeset
   249
        if newstat[stat.ST_MTIME] != expected:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   250
            print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   251
                "'newstat[stat.ST_MTIME] %s is not %s (as %s + %s * 2)"
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   252
                % (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   253
                    newstat[stat.ST_MTIME],
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   254
                    expected,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   255
                    oldstat[stat.ST_MTIME],
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   256
                    repetition,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   257
                )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   258
            )
29995
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   259
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   260
        # no more examination is needed regardless of result
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   261
        break
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   262
    else:
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   263
        # This platform seems too slow to examine anti-ambiguity
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   264
        # of file timestamp (or test happened to be executed at
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   265
        # bad timing). Exit silently in this case, because running
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   266
        # on other faster platforms can detect problems
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   267
        pass
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   268
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40424
diff changeset
   269
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   270
print('basic:')
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   271
print()
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   272
basic(fakerepo())
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   273
print()
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   274
print('fakeuncacheable:')
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   275
print()
14928
dca59d5be12d scmutil: introduce filecache
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   276
fakeuncacheable()
18313
3e4a944c0d04 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
Idan Kamara <idankk86@gmail.com>
parents: 16688
diff changeset
   277
test_filecache_synced()
28742
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   278
print()
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   279
print('setbeforeget:')
a08c90d622eb py3: use print_function in test-filecache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28741
diff changeset
   280
print()
18316
f36375576ed5 filecache: create an entry in _filecache when __set__ is called for a missing one
Idan Kamara <idankk86@gmail.com>
parents: 18313
diff changeset
   281
setbeforeget(fakerepo())
29995
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   282
print()
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   283
print('antiambiguity:')
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   284
print()
57830bd0e787 scmutil: add file object wrapper class to check ambiguity at closing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28803
diff changeset
   285
antiambiguity()