Mercurial > hg
annotate tests/test-audit-path.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 | ef60083b5536 |
children | 15c6eb0a51bd |
rev | line source |
---|---|
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
1 $ hg init |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
2 |
16908
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
3 audit of .hg |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
4 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
5 $ hg add .hg/00changelog.i |
15447
9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents:
15441
diff
changeset
|
6 abort: path contains illegal component: .hg/00changelog.i (glob) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11855
diff
changeset
|
7 [255] |
5158
d316124ebbea
Make audit_path more stringent.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
8 |
16908
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
9 #if symlink |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
10 |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
11 Symlinks |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
12 |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
13 $ mkdir a |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
14 $ echo a > a/a |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
15 $ hg ci -Ama |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
16 adding a/a |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
17 $ ln -s a b |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
18 $ echo b > a/b |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
19 $ hg add b/b |
15447
9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents:
15441
diff
changeset
|
20 abort: path 'b/b' traverses symbolic link 'b' (glob) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11855
diff
changeset
|
21 [255] |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
22 $ hg add b |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
23 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
24 should still fail - maybe |
5158
d316124ebbea
Make audit_path more stringent.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
25 |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
26 $ hg add b/b |
15447
9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents:
15441
diff
changeset
|
27 abort: path 'b/b' traverses symbolic link 'b' (glob) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11855
diff
changeset
|
28 [255] |
5158
d316124ebbea
Make audit_path more stringent.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
29 |
16908
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
30 #endif |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
31 |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
32 |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
33 unbundle tampered bundle |
5158
d316124ebbea
Make audit_path more stringent.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
34 |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
35 $ hg init target |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
36 $ cd target |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15521
diff
changeset
|
37 $ hg unbundle "$TESTDIR/bundles/tampered.hg" |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
38 adding changesets |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
39 adding manifests |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
40 adding file changes |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
41 added 5 changesets with 6 changes to 6 files (+4 heads) |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
42 (run 'hg heads' to see heads, 'hg merge' to merge) |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
43 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
44 attack .hg/test |
7554
11a4eb81fb4f
test-audit-path: add more tests (issue 1450)
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
5158
diff
changeset
|
45 |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
46 $ hg manifest -r0 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
47 .hg/test |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
48 $ hg update -Cr0 |
16908
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
49 abort: path contains illegal component: .hg/test (glob) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11855
diff
changeset
|
50 [255] |
7554
11a4eb81fb4f
test-audit-path: add more tests (issue 1450)
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
5158
diff
changeset
|
51 |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
52 attack foo/.hg/test |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
53 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
54 $ hg manifest -r1 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
55 foo/.hg/test |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
56 $ hg update -Cr1 |
16908
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
57 abort: path 'foo/.hg/test' is inside nested repo 'foo' (glob) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11855
diff
changeset
|
58 [255] |
7554
11a4eb81fb4f
test-audit-path: add more tests (issue 1450)
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
5158
diff
changeset
|
59 |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
60 attack back/test where back symlinks to .. |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
61 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
62 $ hg manifest -r2 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
63 back |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
64 back/test |
16908
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
65 #if symlink |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
66 $ hg update -Cr2 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
67 abort: path 'back/test' traverses symbolic link 'back' |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11855
diff
changeset
|
68 [255] |
16908
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
69 #else |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
70 ('back' will be a file and cause some other system specific error) |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
71 $ hg update -Cr2 |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
72 abort: * (glob) |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
73 [255] |
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
74 #endif |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
75 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
76 attack ../test |
7554
11a4eb81fb4f
test-audit-path: add more tests (issue 1450)
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
5158
diff
changeset
|
77 |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
78 $ hg manifest -r3 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
79 ../test |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
80 $ hg update -Cr3 |
16908
6a997aacba5d
tests: convert some 'hghave symlink' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
81 abort: path contains illegal component: ../test (glob) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11855
diff
changeset
|
82 [255] |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
83 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
84 attack /tmp/test |
7554
11a4eb81fb4f
test-audit-path: add more tests (issue 1450)
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
5158
diff
changeset
|
85 |
11855
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
86 $ hg manifest -r4 |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
87 /tmp/test |
054b0d9c3f0c
tests: unify test-audit-path
Martin Geisler <mg@lazybytes.net>
parents:
7681
diff
changeset
|
88 $ hg update -Cr4 |
18506
ef60083b5536
tests: fix for windows - slashes and no serve
Mads Kiilerich <madski@unity3d.com>
parents:
18336
diff
changeset
|
89 abort: path contains illegal component: /tmp/test (glob) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11855
diff
changeset
|
90 [255] |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16908
diff
changeset
|
91 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16908
diff
changeset
|
92 $ cd .. |