Mercurial > hg
annotate tests/test-module-imports.t @ 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 | f388ceae2250 |
children | 01b39e821d00 |
rev | line source |
---|---|
23894
f388ceae2250
test-module-imports: use test-repo requirement
Matt Mackall <mpm@selenic.com>
parents:
22947
diff
changeset
|
1 #require test-repo |
f388ceae2250
test-module-imports: use test-repo requirement
Matt Mackall <mpm@selenic.com>
parents:
22947
diff
changeset
|
2 |
20059
385e209377a6
test-module-imports: skip on Python < 2.6, since ast is new in 2.6
Augie Fackler <raf@durin42.com>
parents:
20039
diff
changeset
|
3 This code uses the ast module, which was new in 2.6, so we'll skip |
385e209377a6
test-module-imports: skip on Python < 2.6, since ast is new in 2.6
Augie Fackler <raf@durin42.com>
parents:
20039
diff
changeset
|
4 this test on anything earlier. |
22947
c63a09b6b337
tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents:
20519
diff
changeset
|
5 $ $PYTHON -c 'import sys ; assert sys.version_info >= (2, 6)' || exit 80 |
20059
385e209377a6
test-module-imports: skip on Python < 2.6, since ast is new in 2.6
Augie Fackler <raf@durin42.com>
parents:
20039
diff
changeset
|
6 |
20039
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
7 $ import_checker="$TESTDIR"/../contrib/import-checker.py |
23894
f388ceae2250
test-module-imports: use test-repo requirement
Matt Mackall <mpm@selenic.com>
parents:
22947
diff
changeset
|
8 |
20039
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
9 Run the doctests from the import checker, and make sure |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
10 it's working correctly. |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
11 $ TERM=dumb |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
12 $ export TERM |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
13 $ python -m doctest $import_checker |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
14 |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
15 $ cd "$TESTDIR"/.. |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
16 |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
17 There are a handful of cases here that require renaming a module so it |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
18 doesn't overlap with a stdlib module name. There are also some cycles |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
19 here that we should still endeavor to fix, and some cycles will be |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
20 hidden by deduplication algorithm in the cycle detector, so fixing |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
21 these may expose other cycles. |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
22 |
20395
ab71fb058ebf
tests: test-module-imports.t works on windows (with backslash path sep)
Simon Heimberg <simohe@besonet.ch>
parents:
20392
diff
changeset
|
23 $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker" |
20386
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
24 mercurial/dispatch.py mixed imports |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
25 stdlib: commands |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
26 relative: error, extensions, fancyopts, hg, hook, util |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
27 mercurial/fileset.py mixed imports |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
28 stdlib: parser |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
29 relative: error, merge, util |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
30 mercurial/revset.py mixed imports |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
31 stdlib: parser |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
32 relative: discovery, error, hbisect, phases, util |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
33 mercurial/templater.py mixed imports |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
34 stdlib: parser |
20519
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20405
diff
changeset
|
35 relative: config, error, templatefilters, templatekw, util |
20386
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
36 mercurial/ui.py mixed imports |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
37 stdlib: formatter |
a05d31b040d7
import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents:
20199
diff
changeset
|
38 relative: config, error, scmutil, util |
20392
d4f804caa0ed
itersubrepos: move to scmutil to break a direct import cycle
Augie Fackler <raf@durin42.com>
parents:
20386
diff
changeset
|
39 Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil -> mercurial.cmdutil |