tests/test-propertycache.py
author Jun Wu <quark@fb.com>
Tue, 05 Sep 2017 13:37:36 -0700
changeset 34087 5361771f9714
parent 30559 d83ca854fa21
child 40297 d33611280add
permissions -rw-r--r--
wrapfunction: use functools.partial if possible Every `extensions.bind` call inserts a frame in traceback: ... in closure return func(*(args + a), **kw) which makes traceback noisy. The Python stdlib has a `functools.partial` which is backed by C code and does not pollute traceback. However it does not support instancemethod and sets `args` attribute which could be problematic for alias handling. This patch makes `wrapfunction` use `functools.partial` if we are wrapping a function directly exported by a module (so it's impossible to be a class or instance method), and special handles `wrapfunction` results so alias handling code could handle `args` just fine. As an example, `hg rebase -s . -d . --traceback` got 6 lines removed in my setup: File "hg/mercurial/dispatch.py", line 898, in _dispatch cmdpats, cmdoptions) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "hg/hgext/journal.py", line 84, in runcommand return orig(lui, repo, cmd, fullargs, *args) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "fb-hgext/hgext3rd/fbamend/hiddenoverride.py", line 119, in runcommand result = orig(lui, repo, cmd, fullargs, *args) File "hg/mercurial/dispatch.py", line 660, in runcommand ret = _runcommand(ui, options, cmd, d) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "hg/hgext/pager.py", line 69, in pagecmd return orig(ui, options, cmd, cmdfunc) .... Differential Revision: https://phab.mercurial-scm.org/D632
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     1
"""test behavior of propertycache and unfiltered propertycache
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     2
19951
d51c4d85ec23 spelling: random spell checker fixes
Mads Kiilerich <madski@unity3d.com>
parents: 19878
diff changeset
     3
The repoview overlay is quite complex. We test the behavior of
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     4
property cache of both localrepo and repoview to prevent
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     5
regression."""
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     6
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
     7
from __future__ import absolute_import, print_function
28755
84673a7c54af py3: use absolute_import in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 21024
diff changeset
     8
import os
84673a7c54af py3: use absolute_import in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 21024
diff changeset
     9
import subprocess
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    10
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    11
from mercurial import (
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    12
    hg,
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    13
    localrepo,
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    14
    ui as uimod,
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    15
    util,
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    16
)
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    17
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    18
# create some special property cache that trace they call
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    19
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    20
calllog = []
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    21
@util.propertycache
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    22
def testcachedfoobar(repo):
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    23
    name = repo.filtername
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    24
    if name is None:
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    25
        name = ''
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    26
    val = len(name)
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    27
    calllog.append(val)
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    28
    return val
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    29
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
    30
unficalllog = []
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    31
@localrepo.unfilteredpropertycache
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
    32
def testcachedunfifoobar(repo):
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
    33
    name = repo.filtername
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
    34
    if name is None:
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
    35
        name = ''
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
    36
    val = 100 + len(name)
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
    37
    unficalllog.append(val)
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
    38
    return val
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
    39
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    40
#plug them on repo
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    41
localrepo.localrepository.testcachedfoobar = testcachedfoobar
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    42
localrepo.localrepository.testcachedunfifoobar = testcachedunfifoobar
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    43
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    44
21024
7731a2281cf0 spelling: fixes from spell checker
Mads Kiilerich <madski@unity3d.com>
parents: 19951
diff changeset
    45
# Create an empty repo and instantiate it. It is important to run
7731a2281cf0 spelling: fixes from spell checker
Mads Kiilerich <madski@unity3d.com>
parents: 19951
diff changeset
    46
# these tests on the real object to detect regression.
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    47
repopath = os.path.join(os.environ['TESTTMP'], 'repo')
19878
21de61bc2ab5 test: make test-propertycache.py python2.4 compatible
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19846
diff changeset
    48
assert subprocess.call(['hg', 'init', repopath]) == 0
30559
d83ca854fa21 ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents: 28839
diff changeset
    49
ui = uimod.ui.load()
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
    50
repo = hg.repository(ui, path=repopath).unfiltered()
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    51
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    52
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    53
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    54
print('=== property cache ===')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    55
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    56
print('calllog:', calllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    57
print('cached value (unfiltered):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    58
    vars(repo).get('testcachedfoobar', 'NOCACHE'))
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    59
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    60
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    61
print('= first access on unfiltered, should do a call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    62
print('access:', repo.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    63
print('calllog:', calllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    64
print('cached value (unfiltered):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    65
    vars(repo).get('testcachedfoobar', 'NOCACHE'))
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    66
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    67
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    68
print('= second access on unfiltered, should not do call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    69
print('access', repo.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    70
print('calllog:', calllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    71
print('cached value (unfiltered):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    72
    vars(repo).get('testcachedfoobar', 'NOCACHE'))
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    73
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    74
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    75
print('= first access on "visible" view, should do a call')
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    76
visibleview = repo.filtered('visible')
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    77
print('cached value ("visible" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    78
    vars(visibleview).get('testcachedfoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    79
print('access:', visibleview.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    80
print('calllog:', calllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    81
print('cached value (unfiltered):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    82
    vars(repo).get('testcachedfoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    83
print('cached value ("visible" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    84
    vars(visibleview).get('testcachedfoobar', 'NOCACHE'))
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    85
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    86
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    87
print('= second access on "visible view", should not do call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    88
print('access:', visibleview.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    89
print('calllog:', calllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    90
print('cached value (unfiltered):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    91
    vars(repo).get('testcachedfoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    92
print('cached value ("visible" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    93
    vars(visibleview).get('testcachedfoobar', 'NOCACHE'))
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    94
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    95
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    96
print('= no effect on other view')
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    97
immutableview = repo.filtered('immutable')
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    98
print('cached value ("immutable" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
    99
    vars(immutableview).get('testcachedfoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   100
print('access:', immutableview.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   101
print('calllog:', calllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   102
print('cached value (unfiltered):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   103
    vars(repo).get('testcachedfoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   104
print('cached value ("visible" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   105
    vars(visibleview).get('testcachedfoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   106
print('cached value ("immutable" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   107
    vars(immutableview).get('testcachedfoobar', 'NOCACHE'))
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
   108
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
   109
# unfiltered property cache test
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   110
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   111
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   112
print('=== unfiltered property cache ===')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   113
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   114
print('unficalllog:', unficalllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   115
print('cached value (unfiltered):      ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   116
    vars(repo).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   117
print('cached value ("visible" view):  ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   118
    vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   119
print('cached value ("immutable" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   120
    vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'))
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
   121
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   122
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   123
print('= first access on unfiltered, should do a call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   124
print('access (unfiltered):', repo.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   125
print('unficalllog:', unficalllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   126
print('cached value (unfiltered):      ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   127
    vars(repo).get('testcachedunfifoobar', 'NOCACHE'))
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
   128
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   129
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   130
print('= second access on unfiltered, should not do call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   131
print('access (unfiltered):', repo.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   132
print('unficalllog:', unficalllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   133
print('cached value (unfiltered):      ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   134
    vars(repo).get('testcachedunfifoobar', 'NOCACHE'))
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
   135
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   136
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   137
print('= access on view should use the unfiltered cache')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   138
print('access (unfiltered):      ', repo.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   139
print('access ("visible" view):  ', visibleview.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   140
print('access ("immutable" view):', immutableview.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   141
print('unficalllog:', unficalllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   142
print('cached value (unfiltered):      ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   143
    vars(repo).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   144
print('cached value ("visible" view):  ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   145
    vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   146
print('cached value ("immutable" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   147
    vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'))
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
   148
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   149
print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   150
print('= even if we clear the unfiltered cache')
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
   151
del repo.__dict__['testcachedunfifoobar']
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   152
print('cached value (unfiltered):      ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   153
    vars(repo).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   154
print('cached value ("visible" view):  ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   155
    vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   156
print('cached value ("immutable" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   157
    vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   158
print('unficalllog:', unficalllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   159
print('access ("visible" view):  ', visibleview.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   160
print('unficalllog:', unficalllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   161
print('cached value (unfiltered):      ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   162
    vars(repo).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   163
print('cached value ("visible" view):  ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   164
    vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   165
print('cached value ("immutable" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   166
    vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   167
print('access ("immutable" view):', immutableview.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   168
print('unficalllog:', unficalllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   169
print('cached value (unfiltered):      ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   170
    vars(repo).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   171
print('cached value ("visible" view):  ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   172
    vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   173
print('cached value ("immutable" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   174
    vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   175
print('access (unfiltered):      ', repo.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   176
print('unficalllog:', unficalllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   177
print('cached value (unfiltered):      ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   178
    vars(repo).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   179
print('cached value ("visible" view):  ',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   180
    vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'))
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   181
print('cached value ("immutable" view):',
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
   182
    vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'))