Debian Codegraph @

tests/test-merge-subrepos.t

raw
1 $ hg init repo
2 $ cd repo
3
4 $ echo a > a
5 $ hg ci -qAm 'add a'
6
7 $ hg init subrepo
8 $ echo 'subrepo = http://example.net/libfoo' > .hgsub
9 $ hg ci -qAm 'added subrepo'
10
11 $ hg up -qC 0
12 $ echo ax > a
13 $ hg ci -m 'changed a'
14 created new head
15
16 $ hg up -qC 1
17 $ cd subrepo
18 $ echo b > b
19 $ hg add b
20 $ cd ..
21
22 Should fail, since there are added files to subrepo:
23
24 $ hg merge
25 abort: uncommitted changes in subrepository "subrepo"
26 [255]
27
28 Deleted files trigger a '+' marker in top level repos. Deleted files are also
29 noticed by `update --check` in the top level repo.
30
31 $ hg ci -Sqm 'add b'
32 $ echo change > subrepo/b
33
34 $ hg ci -Sm 'change b'
35 committing subrepository subrepo
36
37 $ rm a
38 $ hg id
39 9bfe45a197d7+ tip
40 $ hg sum
41 parent: 4:9bfe45a197d7 tip
42 change b
43 branch: default
44 commit: 1 deleted (clean)
45 update: 1 new changesets, 2 branch heads (merge)
46 phases: 5 draft
47
48 $ hg up --check -r '.^'
49 abort: uncommitted changes
50 [20]
51 $ hg st -S
52 ! a
53 $ hg up -Cq .
54
55 Test that dirty is consistent through subrepos
56
57 $ rm subrepo/b
58
59 A deleted subrepo file is flagged as dirty, like the top level repo
60
61 $ hg id --config extensions.blackbox= --config blackbox.dirty=True \
62 > --config blackbox.track='command commandfinish'
63 9bfe45a197d7+ tip
64 $ cat .hg/blackbox.log
65 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> serve --no-profile --cmdserver chgunix * (glob) (chg !)
66 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* (glob)
67 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* exited 0 * (glob)
68
69 TODO: a deleted file should be listed as such, like the top level repo
70
71 $ hg sum
72 parent: 4:9bfe45a197d7 tip
73 change b
74 branch: default
75 commit: (clean)
76 update: 1 new changesets, 2 branch heads (merge)
77 phases: 5 draft
78
79 Modified subrepo files are noticed by `update --check` and `summary`
80
81 $ echo mod > subrepo/b
82 $ hg st -S
83 M subrepo/b
84
85 $ hg up -r '.^' --check
86 abort: uncommitted changes in subrepository "subrepo"
87 [255]
88
89 $ hg sum
90 parent: 4:9bfe45a197d7 tip
91 change b
92 branch: default
93 commit: 1 subrepos
94 update: 1 new changesets, 2 branch heads (merge)
95 phases: 5 draft
96
97 TODO: why is -R needed here? If it's because the subrepo is treated as a
98 discrete unit, then this should probably warn or something.
99 $ hg revert -R subrepo --no-backup subrepo/b -r .
100
101 $ rm subrepo/b
102 $ hg st -S
103 ! subrepo/b
104
105 `hg update --check` notices a subrepo with a missing file, like it notices a
106 missing file in the top level repo.
107
108 $ hg up -r '.^' --check
109 abort: uncommitted changes in subrepository "subrepo"
110 [255]
111
112 $ hg up -r '.^' --config ui.interactive=True << EOF
113 > d
114 > EOF
115 file 'b' was deleted in local [working copy] but was modified in other [destination].
116 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
117 What do you want to do? d
118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
119
120 XXX: There's a difference between wdir() and '.', so there should be a status.
121 `hg files -S` from the top is also missing 'subrepo/b'. The files should be
122 seen as deleted (and, maybe even missing? in which case `hg files` should list
123 it)
124
125 $ hg st -S
126 R subrepo/b (missing-correct-output !)
127 $ hg st -R subrepo
128 R subrepo/b (missing-correct-output !)
129
130 (note: return [1] because no files "match" since the list is empty)
131
132 $ hg files -R subrepo
133 [1]
134 $ hg files -R subrepo -r '.'
135 subrepo/b
136
137 $ hg bookmark -r tip @other
138 $ echo xyz > subrepo/c
139 $ hg ci -SAm 'add c'
140 adding subrepo/c
141 committing subrepository subrepo
142 created new head
143 $ rm subrepo/c
144
145 Merge sees deleted subrepo files as an uncommitted change
146
147 $ hg merge @other
148 abort: uncommitted changes in subrepository "subrepo"
149 [255]