Mercurial > hg
annotate tests/test-cat.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 | 50107a4b32e7 |
children | 82b82168d045 |
rev | line source |
---|---|
11874 | 1 $ hg init |
2 $ echo 0 > a | |
3 $ echo 0 > b | |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
12070
diff
changeset
|
4 $ hg ci -A -m m |
11874 | 5 adding a |
6 adding b | |
7 $ hg rm a | |
8 $ hg cat a | |
9 0 | |
10 $ hg cat --decode a # more tests in test-encode | |
11 0 | |
12 $ echo 1 > b | |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
12070
diff
changeset
|
13 $ hg ci -m m |
11874 | 14 $ echo 2 > b |
15 $ hg cat -r 0 a | |
16 0 | |
17 $ hg cat -r 0 b | |
18 0 | |
19 $ hg cat -r 1 a | |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
12070
diff
changeset
|
20 a: no such file in rev 7040230c159c |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
21 [1] |
11874 | 22 $ hg cat -r 1 b |
23 1 | |
17371
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
24 |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
25 Test fileset |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
26 |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
27 $ echo 3 > c |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
28 $ hg ci -Am addmore c |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
29 $ hg cat 'set:not(b) or a' |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
30 3 |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
31 $ hg cat 'set:c or b' |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
32 1 |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
33 3 |
1310489eb5d6
fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents:
12316
diff
changeset
|
34 |
21078
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
35 $ mkdir tmp |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
36 $ hg cat --output tmp/HH_%H c |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
37 $ hg cat --output tmp/RR_%R c |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
38 $ hg cat --output tmp/h_%h c |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
39 $ hg cat --output tmp/r_%r c |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
40 $ hg cat --output tmp/%s_s c |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
41 $ hg cat --output tmp/%d%%_d c |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
42 $ hg cat --output tmp/%p_p c |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
43 $ hg log -r . --template "{rev}: {node|short}\n" |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
44 2: 45116003780e |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
45 $ find tmp -type f | sort |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
46 tmp/.%_d |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
47 tmp/HH_45116003780e3678b333fb2c99fa7d559c8457e9 |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
48 tmp/RR_2 |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
49 tmp/c_p |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
50 tmp/c_s |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
51 tmp/h_45116003780e |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
52 tmp/r_2 |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
17371
diff
changeset
|
53 |