Mercurial > hg
annotate tests/test-doctest.py @ 23923:ab6fd3205dad stable
largefiles: fix commit of a directory with no largefile changes (issue4330)
When a directory is named in the commit file list, the previous behavior was to
walk the list, and if no normal files in the directory were also named, add the
corresponding standin for each largefile in that directory. The directory is
then dropped from the list, so that committing a directory with no normal file
changes works. It then added the corresponding standin directory for the first
largefile seen, by prefixing it with '.hglf/'.
The latter is unnecessary since each affected largefile is explicitly referenced
by its standin in the list. It also caused an abort if there were no changed
largefiles in the directory, because none of its standins changed:
abort: .hglf/foo/bar: no match under directory!
This list of files is used to tweak a matcher in lfutil.updatestandinsbymatch(),
which is what is passed to commit().
The status() call that is ultimately done in the commit code with this matcher
seems to have some OS specific differences. It is not necessary to append '.'
for Windows to run the largefiles tests cleanly. But if '.' is not added to the
list, the match function isn't called on Linux, so status() would miss any
normal files that were also in a named directory. The commit then proceeds
without those normal files, or says "nothing changed" if there were no changed
largefiles in the directory. This is not filesystem specific, as VFAT on Linux
had the same behavior as when run on ext4. It is also not an issue with
lfilesrepo.status(), since that only calls the overridden implementation when
paths are passed to commit. I dont have access to an OS X machine ATM to test
there.
Maybe there's a better way to do this. But since the standin directory for the
first largefile was previously being added, and that caused the same walk in
status(), there's no preformance change to this. There is no danger of
erroneously committing files in '.', because the original match function is
called, and if it fails, the lfutil.updatestandinsbymatch() tweaked matcher only
indicates a match if the file is in the list of standins- and '.' never is. The
added tests confirm this.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 18 Jan 2015 15:15:40 -0500 |
parents | aac5482db318 |
children | daee2039dd11 |
rev | line source |
---|---|
7041
b856071435f7
tests: fix readline escape characters in output for test-doctest.py
Mads Kiilerich <mads@kiilerich.com>
parents:
5525
diff
changeset
|
1 # this is hack to make sure no escape characters are inserted into the output |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
2 import os, sys |
7078
967adcf5910d
test-doctest: remove TERM env variable only if it's there
Patrick Mezard <pmezard@gmail.com>
parents:
7041
diff
changeset
|
3 if 'TERM' in os.environ: |
7184
380fda3eed13
clean up trailing spaces
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7078
diff
changeset
|
4 del os.environ['TERM'] |
3232
394ac87f3b74
[extendedchangelog] encode/decode function
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
5 import doctest |
394ac87f3b74
[extendedchangelog] encode/decode function
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
6 |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
7 def testmod(name, optionflags=0, testtarget=None): |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
8 __import__(name) |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
9 mod = sys.modules[name] |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
10 if testtarget is not None: |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
11 mod = getattr(mod, testtarget) |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
12 doctest.testmod(mod, optionflags=optionflags) |
14171
fa2b596db182
ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents:
13949
diff
changeset
|
13 |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
14 testmod('mercurial.changelog') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
15 testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE) |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
16 testmod('mercurial.dispatch') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
17 testmod('mercurial.encoding') |
20799
069bf1b821c8
clone: add doctest for default destination
Yuya Nishihara <yuya@tcha.org>
parents:
20419
diff
changeset
|
18 testmod('mercurial.hg') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
19 testmod('mercurial.hgweb.hgwebdir_mod') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
20 testmod('mercurial.match') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
21 testmod('mercurial.minirst') |
21568
8dd17b19e722
subrepo: normalize path in the specific way for problematic encodings
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20840
diff
changeset
|
22 testmod('mercurial.pathutil') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
23 testmod('mercurial.revset') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
24 testmod('mercurial.store') |
20840
308344d80fe5
subrepo: factor out Git version check to add doctests
Siddharth Agarwal <sid0@fb.com>
parents:
20799
diff
changeset
|
25 testmod('mercurial.subrepo') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
26 testmod('mercurial.templatefilters') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
27 testmod('mercurial.ui') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
28 testmod('mercurial.url') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
29 testmod('mercurial.util') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
30 testmod('mercurial.util', testtarget='platform') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
31 testmod('hgext.convert.cvsps') |
20048
da99ebd35f00
convert: readability and test of rpairs function
Mads Kiilerich <madski@unity3d.com>
parents:
20047
diff
changeset
|
32 testmod('hgext.convert.filemap') |
20419
e61a8395c3c1
convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents:
20048
diff
changeset
|
33 testmod('hgext.convert.subversion') |
22546
aac5482db318
mq: refactor patchheader header ordering to match export (BC)
Mads Kiilerich <madski@unity3d.com>
parents:
21568
diff
changeset
|
34 testmod('hgext.mq') |