1 #!/bin/sh |
|
2 |
|
3 rm -rf sub |
|
4 mkdir sub |
|
5 cd sub |
|
6 hg init t |
|
7 cd t |
|
8 |
|
9 echo % first revision, no sub |
|
10 echo a > a |
|
11 hg ci -Am0 |
|
12 |
|
13 echo % add first sub |
|
14 echo s = s > .hgsub |
|
15 hg add .hgsub |
|
16 hg init s |
|
17 echo a > s/a |
|
18 |
|
19 # issue2232 - committing a subrepo without .hgsub |
|
20 hg ci -mbad s |
|
21 |
|
22 hg -R s ci -Ams0 |
|
23 hg sum |
|
24 hg ci -m1 |
|
25 |
|
26 # issue 2022 - update -C |
|
27 echo b > s/a |
|
28 hg sum |
|
29 hg co -C 1 |
|
30 hg sum |
|
31 |
|
32 echo % add sub sub |
|
33 echo ss = ss > s/.hgsub |
|
34 hg init s/ss |
|
35 echo a > s/ss/a |
|
36 hg -R s add s/.hgsub |
|
37 hg -R s/ss add s/ss/a |
|
38 hg sum |
|
39 hg ci -m2 |
|
40 hg sum |
|
41 |
|
42 echo % bump sub rev |
|
43 echo b > s/a |
|
44 hg -R s ci -ms1 |
|
45 hg ci -m3 |
|
46 |
|
47 echo % leave sub dirty |
|
48 echo c > s/a |
|
49 hg ci -m4 |
|
50 hg tip -R s |
|
51 |
|
52 echo % check caching |
|
53 hg co 0 |
|
54 hg debugsub |
|
55 echo % restore |
|
56 hg co |
|
57 hg debugsub |
|
58 |
|
59 echo % new branch for merge tests |
|
60 hg co 1 |
|
61 echo t = t >> .hgsub |
|
62 hg init t |
|
63 echo t > t/t |
|
64 hg -R t add t |
|
65 echo % 5 |
|
66 hg ci -m5 # add sub |
|
67 echo t2 > t/t |
|
68 echo % 6 |
|
69 hg st -R s |
|
70 hg ci -m6 # change sub |
|
71 hg debugsub |
|
72 echo t3 > t/t |
|
73 echo % 7 |
|
74 hg ci -m7 # change sub again for conflict test |
|
75 hg rm .hgsub |
|
76 echo % 8 |
|
77 hg ci -m8 # remove sub |
|
78 |
|
79 echo % merge tests |
|
80 hg co -C 3 |
|
81 hg merge 5 # test adding |
|
82 hg debugsub |
|
83 hg ci -m9 |
|
84 hg merge 6 --debug # test change |
|
85 hg debugsub |
|
86 echo conflict > t/t |
|
87 hg ci -m10 |
|
88 HGMERGE=internal:merge hg merge --debug 7 # test conflict |
|
89 echo % should conflict |
|
90 cat t/t |
|
91 |
|
92 echo % clone |
|
93 cd .. |
|
94 hg clone t tc | sed 's|from .*/sub|from .../sub|g' |
|
95 cd tc |
|
96 hg debugsub |
|
97 |
|
98 echo % push |
|
99 echo bah > t/t |
|
100 hg ci -m11 |
|
101 hg push | sed 's/ .*sub/ ...sub/g' |
|
102 |
|
103 echo % push -f |
|
104 echo bah > s/a |
|
105 hg ci -m12 |
|
106 hg push | sed 's/ .*sub/ ...sub/g' |
|
107 hg push -f | sed 's/ .*sub/ ...sub/g' |
|
108 |
|
109 echo % update |
|
110 cd ../t |
|
111 hg up -C # discard our earlier merge |
|
112 echo blah > t/t |
|
113 hg ci -m13 |
|
114 |
|
115 echo % pull |
|
116 cd ../tc |
|
117 hg pull | sed 's/ .*sub/ ...sub/g' |
|
118 # should pull t |
|
119 hg up | sed 's|from .*/sub|from .../sub|g' |
|
120 cat t/t |
|
121 |
|
122 echo % bogus subrepo path aborts |
|
123 echo 'bogus=[boguspath' >> .hgsub |
|
124 hg ci -m 'bogus subrepo path' |
|
125 |
|
126 echo % issue 1986 |
|
127 cd .. |
|
128 rm -rf sub |
|
129 hg init main |
|
130 cd main |
|
131 |
|
132 hg init s # subrepo layout |
|
133 cd s # |
|
134 echo a > a # o 5 br |
|
135 hg ci -Am1 # /| |
|
136 hg branch br # o | 4 default |
|
137 echo a >> a # | | |
|
138 hg ci -m1 # | o 3 br |
|
139 hg up default # |/| |
|
140 echo b > b # o | 2 default |
|
141 hg ci -Am1 # | | |
|
142 hg up br # | o 1 br |
|
143 hg merge tip # |/ |
|
144 hg ci -m1 # o 0 default |
|
145 hg up 2 |
|
146 echo c > c |
|
147 hg ci -Am1 |
|
148 hg up 3 |
|
149 hg merge 4 |
|
150 hg ci -m1 |
|
151 |
|
152 cd .. # main repo layout: |
|
153 echo 's = s' > .hgsub # |
|
154 hg -R s up 2 # * <-- try to merge default into br again |
|
155 hg ci -Am1 # .`| |
|
156 hg branch br # . o 5 br --> substate = 5 |
|
157 echo b > b # . | |
|
158 hg -R s up 3 # o | 4 default --> substate = 4 |
|
159 hg ci -Am1 # | | |
|
160 hg up default # | o 3 br --> substate = 2 |
|
161 echo c > c # |/| |
|
162 hg ci -Am1 # o | 2 default --> substate = 2 |
|
163 hg up 1 # | | |
|
164 hg merge 2 # | o 1 br --> substate = 3 |
|
165 hg ci -m1 # |/ |
|
166 hg up 2 # o 0 default --> substate = 2 |
|
167 hg -R s up 4 |
|
168 echo d > d |
|
169 hg ci -Am1 |
|
170 hg up 3 |
|
171 hg -R s up 5 |
|
172 echo e > e |
|
173 hg ci -Am1 |
|
174 |
|
175 hg up 5 |
|
176 hg merge 4 # try to merge default into br again |
|
177 cd .. |
|
178 |
|
179 echo % test subrepo delete from .hgsubstate |
|
180 hg init testdelete |
|
181 mkdir testdelete/nested testdelete/nested2 |
|
182 hg init testdelete/nested |
|
183 hg init testdelete/nested2 |
|
184 echo test > testdelete/nested/foo |
|
185 echo test > testdelete/nested2/foo |
|
186 hg -R testdelete/nested add |
|
187 hg -R testdelete/nested2 add |
|
188 hg -R testdelete/nested ci -m test |
|
189 hg -R testdelete/nested2 ci -m test |
|
190 echo nested = nested > testdelete/.hgsub |
|
191 echo nested2 = nested2 >> testdelete/.hgsub |
|
192 hg -R testdelete add |
|
193 hg -R testdelete ci -m "nested 1 & 2 added" |
|
194 echo nested = nested > testdelete/.hgsub |
|
195 hg -R testdelete ci -m "nested 2 deleted" |
|
196 cat testdelete/.hgsubstate | sed "s:.* ::" |
|
197 hg -R testdelete remove testdelete/.hgsub |
|
198 hg -R testdelete ci -m ".hgsub deleted" |
|
199 cat testdelete/.hgsubstate |
|
200 |
|
201 echo % test repository cloning |
|
202 mkdir mercurial mercurial2 |
|
203 hg init nested_absolute |
|
204 echo test > nested_absolute/foo |
|
205 hg -R nested_absolute add |
|
206 hg -R nested_absolute ci -mtest |
|
207 cd mercurial |
|
208 hg init nested_relative |
|
209 echo test2 > nested_relative/foo2 |
|
210 hg -R nested_relative add |
|
211 hg -R nested_relative ci -mtest2 |
|
212 hg init main |
|
213 echo "nested_relative = ../nested_relative" > main/.hgsub |
|
214 echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub |
|
215 hg -R main add |
|
216 hg -R main ci -m "add subrepos" |
|
217 cd .. |
|
218 hg clone mercurial/main mercurial2/main |
|
219 cat mercurial2/main/nested_absolute/.hg/hgrc \ |
|
220 mercurial2/main/nested_relative/.hg/hgrc \ |
|
221 | "$TESTDIR/filtertmp.py" |
|
222 rm -rf mercurial mercurial2 |
|
223 |
|
224 echo % issue 1977 |
|
225 hg init repo |
|
226 hg init repo/s |
|
227 echo a > repo/s/a |
|
228 hg -R repo/s ci -Am0 |
|
229 echo s = s > repo/.hgsub |
|
230 hg -R repo ci -Am1 |
|
231 hg clone repo repo2 | sed 's|from .*/sub|from .../sub|g' |
|
232 hg -q -R repo2 pull -u |
|
233 echo 1 > repo2/s/a |
|
234 hg -R repo2/s ci -m2 |
|
235 hg -q -R repo2/s push |
|
236 hg -R repo2/s up -C 0 |
|
237 echo 2 > repo2/s/a |
|
238 hg -R repo2/s ci -m3 |
|
239 hg -R repo2 ci -m3 |
|
240 hg -q -R repo2 push |
|
241 hg -R repo update |
|
242 rm -rf repo2 repo |
|
243 |
|
244 exit 0 |
|