Mercurial > hg
annotate tests/test-subrepo-missing.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 | fab9dda0f2a3 |
children | 871485bd03fd |
rev | line source |
---|---|
13017
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 $ hg init repo |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 $ cd repo |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 $ hg init subrepo |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 $ echo a > subrepo/a |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 $ hg -R subrepo ci -Am adda |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 adding a |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 $ echo 'subrepo = subrepo' > .hgsub |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 $ hg ci -Am addsubrepo |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 adding .hgsub |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 $ echo b > subrepo/b |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 $ hg -R subrepo ci -Am addb |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 adding b |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 $ hg ci -m updatedsub |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 |
16595
2de6ac4ac17c
subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents:
16073
diff
changeset
|
15 ignore blanklines in .hgsubstate |
2de6ac4ac17c
subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents:
16073
diff
changeset
|
16 |
2de6ac4ac17c
subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents:
16073
diff
changeset
|
17 >>> file('.hgsubstate', 'wb').write('\n\n \t \n \n') |
2de6ac4ac17c
subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents:
16073
diff
changeset
|
18 $ hg st --subrepos |
2de6ac4ac17c
subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents:
16073
diff
changeset
|
19 M .hgsubstate |
2de6ac4ac17c
subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents:
16073
diff
changeset
|
20 $ hg revert -qC .hgsubstate |
2de6ac4ac17c
subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents:
16073
diff
changeset
|
21 |
16596
95ca6c8b38da
subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents:
16595
diff
changeset
|
22 abort more gracefully on .hgsubstate parsing error |
95ca6c8b38da
subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents:
16595
diff
changeset
|
23 |
95ca6c8b38da
subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents:
16595
diff
changeset
|
24 $ cp .hgsubstate .hgsubstate.old |
95ca6c8b38da
subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents:
16595
diff
changeset
|
25 >>> file('.hgsubstate', 'wb').write('\ninvalid') |
95ca6c8b38da
subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents:
16595
diff
changeset
|
26 $ hg st --subrepos |
95ca6c8b38da
subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents:
16595
diff
changeset
|
27 abort: invalid subrepository revision specifier in .hgsubstate line 2 |
95ca6c8b38da
subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents:
16595
diff
changeset
|
28 [255] |
95ca6c8b38da
subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents:
16595
diff
changeset
|
29 $ mv .hgsubstate.old .hgsubstate |
95ca6c8b38da
subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents:
16595
diff
changeset
|
30 |
13017
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
31 delete .hgsub and revert it |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
32 |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 $ rm .hgsub |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
34 $ hg revert .hgsub |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 warning: subrepo spec file .hgsub not found |
14870
f73c7b70df68
subrepo: use working copy of .hgsub to filter status (issue2901)
Matt Mackall <mpm@selenic.com>
parents:
13017
diff
changeset
|
36 warning: subrepo spec file .hgsub not found |
13017
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 delete .hgsubstate and revert it |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 $ rm .hgsubstate |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 $ hg revert .hgsubstate |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 delete .hgsub and update |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
44 |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
45 $ rm .hgsub |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
46 $ hg up 0 |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 warning: subrepo spec file .hgsub not found |
14870
f73c7b70df68
subrepo: use working copy of .hgsub to filter status (issue2901)
Matt Mackall <mpm@selenic.com>
parents:
13017
diff
changeset
|
48 warning: subrepo spec file .hgsub not found |
13017
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 $ hg st |
14870
f73c7b70df68
subrepo: use working copy of .hgsub to filter status (issue2901)
Matt Mackall <mpm@selenic.com>
parents:
13017
diff
changeset
|
51 warning: subrepo spec file .hgsub not found |
13017
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 ! .hgsub |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 $ ls subrepo |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 a |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 delete .hgsubstate and update |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
57 |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
58 $ hg up -C |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
59 warning: subrepo spec file .hgsub not found |
14870
f73c7b70df68
subrepo: use working copy of .hgsub to filter status (issue2901)
Matt Mackall <mpm@selenic.com>
parents:
13017
diff
changeset
|
60 warning: subrepo spec file .hgsub not found |
13017
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
62 $ rm .hgsubstate |
17345
4f8054d3171b
check-code: fix check for trailing whitespace on sh command lines
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
63 $ hg up 0 |
13017
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
64 remote changed .hgsubstate which local deleted |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
65 use (c)hanged version or leave (d)eleted? c |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
67 $ hg st |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
68 $ ls subrepo |
d0e21c5fde41
subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
69 a |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16596
diff
changeset
|
70 |
20319
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
71 Enable obsolete |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
72 |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
73 $ cat >> $HGRCPATH << EOF |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
74 > [ui] |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
75 > logtemplate= {rev}:{node|short} {desc|firstline} |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
76 > [phases] |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
77 > publish=False |
22955
fab9dda0f2a3
obsolete: update tests to use obsolete options
Durham Goode <durham@fb.com>
parents:
20319
diff
changeset
|
78 > [experimental] |
fab9dda0f2a3
obsolete: update tests to use obsolete options
Durham Goode <durham@fb.com>
parents:
20319
diff
changeset
|
79 > evolution=createmarkers |
20319
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
80 > EOF |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
81 |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
82 check that we can update parent repo with missing (amended) subrepo revision |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
83 |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
84 $ hg up --repository subrepo -r tip |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
86 $ hg ci -m "updated subrepo to tip" |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
87 created new head |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
88 $ cd subrepo |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
89 $ hg update -r tip |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
90 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
91 $ echo foo > a |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
92 $ hg commit --amend -m "addb (amended)" |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16596
diff
changeset
|
93 $ cd .. |
20319
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
94 $ hg update --clean . |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
95 revision 102a90ea7b4a in subrepo subrepo is hidden |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
96 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
97 |
427d672c0e4e
subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
17345
diff
changeset
|
98 $ cd .. |