Mercurial > hg
annotate tests/test-basic.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 | 42ed0780ec4b |
children | dc4daf028f9c |
rev | line source |
---|---|
11742 | 1 Create a repository: |
2 | |
20608
a3ca1d032926
config: make repo optional again
Matt Mackall <mpm@selenic.com>
parents:
17346
diff
changeset
|
3 $ hg config |
a3ca1d032926
config: make repo optional again
Matt Mackall <mpm@selenic.com>
parents:
17346
diff
changeset
|
4 defaults.backout=-d "0 0" |
a3ca1d032926
config: make repo optional again
Matt Mackall <mpm@selenic.com>
parents:
17346
diff
changeset
|
5 defaults.commit=-d "0 0" |
a3ca1d032926
config: make repo optional again
Matt Mackall <mpm@selenic.com>
parents:
17346
diff
changeset
|
6 defaults.shelve=--date "0 0" |
a3ca1d032926
config: make repo optional again
Matt Mackall <mpm@selenic.com>
parents:
17346
diff
changeset
|
7 defaults.tag=-d "0 0" |
23388
42ed0780ec4b
run-tests: set a default largefiles usercache in the default hgrc file
Matt Harbison <matt_harbison@yahoo.com>
parents:
23053
diff
changeset
|
8 largefiles.usercache=$TESTTMP/.cache/largefiles (glob) |
20608
a3ca1d032926
config: make repo optional again
Matt Mackall <mpm@selenic.com>
parents:
17346
diff
changeset
|
9 ui.slash=True |
a3ca1d032926
config: make repo optional again
Matt Mackall <mpm@selenic.com>
parents:
17346
diff
changeset
|
10 ui.interactive=False |
21918
10abc3a5c6b2
filemerge: use 'basic' as the default of '[ui] mergemarkers' for safety
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20608
diff
changeset
|
11 ui.mergemarkers=detailed |
23053
5ba11ab48fcf
ui: separate option to show prompt echo, enabled only in tests (issue4417)
Yuya Nishihara <yuya@tcha.org>
parents:
21918
diff
changeset
|
12 ui.promptecho=True |
13956
ffb5c09ba822
tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents:
13568
diff
changeset
|
13 $ hg init t |
11742 | 14 $ cd t |
15 | |
16 Make a changeset: | |
17 | |
18 $ echo a > a | |
19 $ hg add a | |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
11742
diff
changeset
|
20 $ hg commit -m test |
11742 | 21 |
22 This command is ancient: | |
331 | 23 |
11742 | 24 $ hg history |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
11742
diff
changeset
|
25 changeset: 0:acb14030fe0a |
11742 | 26 tag: tip |
27 user: test | |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
11742
diff
changeset
|
28 date: Thu Jan 01 00:00:00 1970 +0000 |
11742 | 29 summary: test |
30 | |
31 | |
13568
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
32 Verify that updating to revision 0 via commands.update() works properly |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
33 |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
34 $ cat <<EOF > update_to_rev0.py |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
35 > from mercurial import ui, hg, commands |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
36 > myui = ui.ui() |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
37 > repo = hg.repository(myui, path='.') |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
38 > commands.update(myui, repo, rev=0) |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
39 > EOF |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
40 $ hg up null |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
41 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
42 $ python ./update_to_rev0.py |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
44 $ hg identify -n |
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
45 0 |
17346
2944a6d35158
check-code: fix check for trailing whitespace on empty lines
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
46 |
13568
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
12156
diff
changeset
|
47 |
11742 | 48 Poke around at hashes: |
49 | |
50 $ hg manifest --debug | |
51 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a | |
52 | |
53 $ hg cat a | |
54 a | |
55 | |
56 Verify should succeed: | |
57 | |
58 $ hg verify | |
59 checking changesets | |
60 checking manifests | |
61 crosschecking files in changesets and manifests | |
62 checking files | |
63 1 files, 1 changesets, 1 total revisions | |
64 | |
65 At the end... | |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
13956
diff
changeset
|
66 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
13956
diff
changeset
|
67 $ cd .. |