tests/heredoctest.py
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 07 Jan 2013 17:23:25 +0100
branchstable
changeset 1184 6f276a923989
parent 1110 d5b3404b82ce
permissions -rw-r--r--
branchmap: allow to use cache of subset Filtered repository are *subset* of unfiltered repository. This means that a filtered branchmap could be use to compute the unfiltered version. And filtered version happen to be subset of each other: - "all() - unserved()" is a subset of "all() - hidden()" - "all() - hidden()" is a subset of "all()" This means that branchmap with "unfiltered" filter can be used as a base for "hidden" branchmap that itself could be used as a base for unfiltered branchmap. unserved < hidden < None This changeset implements this mechanism. If the on disk branchcache is not valid we use the branchcache of the nearest subset as base instead of computing it from scratch. Such fallback can be cascaded multiple time is necessary. Note that both "hidden" and "unserved" set are a bit volatile. We will add more stable filtering in next changesets. This changeset enables collaboration between no filtering and "unserved" filtering. Fixing performance regression introduced by 47f00b0de337 [ original upstream message ]
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1110
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
     1
import sys
1108
168da136346a tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents: 1107
diff changeset
     2
1110
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
     3
globalvars = {}
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
     4
localvars = {}
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
     5
lines = sys.stdin.readlines()
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
     6
while lines:
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
     7
    l = lines.pop(0)
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
     8
    if l.startswith('SALT'):
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
     9
        print l[:-1]
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    10
    elif l.startswith('>>> '):
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    11
        snippet = l[4:]
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    12
        while lines and lines[0].startswith('... '):
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    13
            l = lines.pop(0)
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    14
            snippet += "\n" + l[4:]
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    15
        c = compile(snippet, '<heredoc>', 'single')
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    16
        try:
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    17
            exec c in globalvars, localvars
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    18
        except Exception, inst:
d5b3404b82ce run-tests: replace inline python handling with more native scheme
Matt Mackall <mpm@selenic.com>
parents: 1109
diff changeset
    19
            print repr(inst)