annotate tests/test-pull-pull-corruption.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 f2719b387380
children eb586ed5d8ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
1 Corrupt an hg repo with two pulls.
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
2 create one repo with a long history
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
3
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
4 $ hg init source1
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
5 $ cd source1
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
6 $ touch foo
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
7 $ hg add foo
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
8 $ for i in 1 2 3 4 5 6 7 8 9 10; do
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
9 > echo $i >> foo
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
10 > hg ci -m $i
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
11 > done
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
12 $ cd ..
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
13
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
14 create one repo with a shorter history
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
15
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
16 $ hg clone -r 0 source1 source2
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
17 adding changesets
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
18 adding manifests
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
19 adding file changes
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
20 added 1 changesets with 1 changes to 1 files
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
21 updating to branch default
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
23 $ cd source2
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
24 $ echo a >> foo
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
25 $ hg ci -m a
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
26 $ cd ..
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
27
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
28 create a third repo to pull both other repos into it
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
29
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
30 $ hg init corrupted
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
31 $ cd corrupted
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
32
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
33 use a hook to make the second pull start while the first one is still running
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
34
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
35 $ echo '[hooks]' >> .hg/hgrc
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
36 $ echo 'prechangegroup = sleep 5' >> .hg/hgrc
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
37
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
38 start a pull...
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
39
16481
37e0872b5ced tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents: 13439
diff changeset
40 $ hg pull ../source1 > pull.out 2>&1 &
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
41
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
42 ... and start another pull before the first one has finished
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
43
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
44 $ sleep 1
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
45 $ hg pull ../source2 2>/dev/null
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
46 pulling from ../source2
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
47 searching for changes
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
48 adding changesets
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
49 adding manifests
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
50 adding file changes
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
51 added 1 changesets with 1 changes to 1 files (+1 heads)
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
52 (run 'hg heads' to see heads, 'hg merge' to merge)
16481
37e0872b5ced tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents: 13439
diff changeset
53 $ cat pull.out
37e0872b5ced tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents: 13439
diff changeset
54 pulling from ../source1
37e0872b5ced tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents: 13439
diff changeset
55 requesting all changes
37e0872b5ced tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents: 13439
diff changeset
56 adding changesets
37e0872b5ced tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents: 13439
diff changeset
57 adding manifests
37e0872b5ced tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents: 13439
diff changeset
58 adding file changes
37e0872b5ced tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents: 13439
diff changeset
59 added 10 changesets with 10 changes to 1 files
37e0872b5ced tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents: 13439
diff changeset
60 (run 'hg update' to get a working copy)
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
61
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
62 see the result
1785
81ca1a9bd061 Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
63
12481
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
64 $ wait
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
65 $ hg verify
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
66 checking changesets
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
67 checking manifests
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
68 crosschecking files in changesets and manifests
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
69 checking files
70ef9b470efe tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents: 1785
diff changeset
70 1 files, 11 changesets, 11 total revisions
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16481
diff changeset
71
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16481
diff changeset
72 $ cd ..