Mercurial > hg
annotate tests/test-revset-dirstate-parents.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 | 7d87f672d069 |
rev | line source |
---|---|
12928
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
1 $ HGENCODING=utf-8 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
2 $ export HGENCODING |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
3 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
4 $ try() { |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
5 > hg debugrevspec --debug $@ |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
6 > } |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
7 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
8 $ log() { |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
9 > hg log --template '{rev}\n' -r "$1" |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
10 > } |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
11 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
12 $ hg init repo |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
13 $ cd repo |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
14 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
15 $ try 'p1()' |
16218
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
12936
diff
changeset
|
16 (func |
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
12936
diff
changeset
|
17 ('symbol', 'p1') |
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
12936
diff
changeset
|
18 None) |
12928
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
19 $ try 'p2()' |
16218
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
12936
diff
changeset
|
20 (func |
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
12936
diff
changeset
|
21 ('symbol', 'p2') |
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
12936
diff
changeset
|
22 None) |
12935
98b79c892768
revset: fix p1, p2 and parents in dirstate case (a5f7f1e9340e)
Patrick Mezard <pmezard@gmail.com>
parents:
12929
diff
changeset
|
23 $ try 'parents()' |
16218
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
12936
diff
changeset
|
24 (func |
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
12936
diff
changeset
|
25 ('symbol', 'parents') |
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
12936
diff
changeset
|
26 None) |
12928
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
27 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
28 null revision |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
29 $ log 'p1()' |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
30 $ log 'p2()' |
12929
515c2786e1cf
revsets: let parents() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
12928
diff
changeset
|
31 $ log 'parents()' |
12928
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
32 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
33 working dir with a single parent |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
34 $ echo a > a |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
35 $ hg ci -Aqm0 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
36 $ log 'p1()' |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
37 0 |
12935
98b79c892768
revset: fix p1, p2 and parents in dirstate case (a5f7f1e9340e)
Patrick Mezard <pmezard@gmail.com>
parents:
12929
diff
changeset
|
38 $ log 'tag() and p1()' |
12928
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
39 $ log 'p2()' |
12929
515c2786e1cf
revsets: let parents() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
12928
diff
changeset
|
40 $ log 'parents()' |
515c2786e1cf
revsets: let parents() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
12928
diff
changeset
|
41 0 |
12935
98b79c892768
revset: fix p1, p2 and parents in dirstate case (a5f7f1e9340e)
Patrick Mezard <pmezard@gmail.com>
parents:
12929
diff
changeset
|
42 $ log 'tag() and parents()' |
12928
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
43 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
44 merge in progress |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
45 $ echo b > b |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
46 $ hg ci -Aqm1 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
47 $ hg up -q 0 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
48 $ echo c > c |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
49 $ hg ci -Aqm2 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
50 $ hg merge -q |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
51 $ log 'p1()' |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
52 2 |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
53 $ log 'p2()' |
a5f7f1e9340e
revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff
changeset
|
54 1 |
12935
98b79c892768
revset: fix p1, p2 and parents in dirstate case (a5f7f1e9340e)
Patrick Mezard <pmezard@gmail.com>
parents:
12929
diff
changeset
|
55 $ log 'tag() and p2()' |
12929
515c2786e1cf
revsets: let parents() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
12928
diff
changeset
|
56 $ log 'parents()' |
12935
98b79c892768
revset: fix p1, p2 and parents in dirstate case (a5f7f1e9340e)
Patrick Mezard <pmezard@gmail.com>
parents:
12929
diff
changeset
|
57 1 |
12929
515c2786e1cf
revsets: let parents() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
12928
diff
changeset
|
58 2 |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16218
diff
changeset
|
59 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16218
diff
changeset
|
60 $ cd .. |