Show More
@@ -1,1275 +1,1290 b'' | |||
|
1 | 1 | #require git |
|
2 | 2 | |
|
3 | # XXX-CHG When running with python2 + chg this test tend to get stuck and end up | |
|
4 | # as a time-out error. My effort to reproduce this outside of the CI failed. The | |
|
5 | # test itself seems to pass fine, but never "complete". Debugging it is slow and | |
|
6 | # tedious. This as a bad impact on the development process as most CI run end up | |
|
7 | # wasting abotu 1h until that one fails. | |
|
8 | # | |
|
9 | # Pierre-Yves David, Augie Fackler and Raphaël Gomès all agreed to disable this | |
|
10 | # case in that specific case until we figure this out (or we drop python2 o:-) ) | |
|
11 | ||
|
12 | #if no-py3 chg | |
|
13 | $ echo 'skipped: this test get stuck on the CI with python2 + chg. investigation needed' | |
|
14 | $ exit 80 | |
|
15 | #endif | |
|
16 | ||
|
17 | ||
|
3 | 18 |
|
|
4 | 19 | |
|
5 | 20 | $ cat >> $HGRCPATH <<EOF |
|
6 | 21 | > [defaults] |
|
7 | 22 | > commit = -d "0 0" |
|
8 | 23 | > EOF |
|
9 | 24 | |
|
10 | 25 | $ echo "[core]" >> $HOME/.gitconfig |
|
11 | 26 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
12 | 27 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
13 | 28 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
14 | 29 | $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE |
|
15 | 30 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
16 | 31 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
17 | 32 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
18 | 33 | $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM |
|
19 | 34 | |
|
20 | 35 | set default branch to value compatible with new and old git version |
|
21 | 36 | |
|
22 | 37 | $ git config --global init.defaultBranch master |
|
23 | 38 | |
|
24 | 39 | root hg repo |
|
25 | 40 | |
|
26 | 41 | $ hg init t |
|
27 | 42 | $ cd t |
|
28 | 43 | $ echo a > a |
|
29 | 44 | $ hg add a |
|
30 | 45 | $ hg commit -m a |
|
31 | 46 | $ cd .. |
|
32 | 47 | |
|
33 | 48 | new external git repo |
|
34 | 49 | |
|
35 | 50 | $ mkdir gitroot |
|
36 | 51 | $ cd gitroot |
|
37 | 52 | $ git init -q |
|
38 | 53 | $ echo g > g |
|
39 | 54 | $ git add g |
|
40 | 55 | $ git commit -q -m g |
|
41 | 56 | |
|
42 | 57 | add subrepo clone |
|
43 | 58 | |
|
44 | 59 | $ cd ../t |
|
45 | 60 | $ echo 's = [git]../gitroot' > .hgsub |
|
46 | 61 | $ git clone -q ../gitroot s |
|
47 | 62 | $ hg add .hgsub |
|
48 | 63 | |
|
49 | 64 | git subrepo is disabled by default |
|
50 | 65 | |
|
51 | 66 | $ hg commit -m 'new git subrepo' |
|
52 | 67 | abort: git subrepos not allowed |
|
53 | 68 | (see 'hg help config.subrepos' for details) |
|
54 | 69 | [255] |
|
55 | 70 | |
|
56 | 71 | so enable it |
|
57 | 72 | |
|
58 | 73 | $ cat >> $HGRCPATH <<EOF |
|
59 | 74 | > [subrepos] |
|
60 | 75 | > git:allowed = true |
|
61 | 76 | > EOF |
|
62 | 77 | |
|
63 | 78 | $ hg commit -m 'new git subrepo' |
|
64 | 79 | |
|
65 | 80 | $ hg debugsub |
|
66 | 81 | path s |
|
67 | 82 | source ../gitroot |
|
68 | 83 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
69 | 84 | |
|
70 | 85 | record a new commit from upstream from a different branch |
|
71 | 86 | |
|
72 | 87 | $ cd ../gitroot |
|
73 | 88 | $ git checkout -q -b testing |
|
74 | 89 | $ echo gg >> g |
|
75 | 90 | $ git commit -q -a -m gg |
|
76 | 91 | |
|
77 | 92 | $ cd ../t/s |
|
78 | 93 | $ git pull -q >/dev/null 2>/dev/null |
|
79 | 94 | $ git checkout -q -b testing origin/testing >/dev/null |
|
80 | 95 | |
|
81 | 96 | $ cd .. |
|
82 | 97 | $ hg status --subrepos |
|
83 | 98 | M s/g |
|
84 | 99 | $ hg commit -m 'update git subrepo' |
|
85 | 100 | $ hg debugsub |
|
86 | 101 | path s |
|
87 | 102 | source ../gitroot |
|
88 | 103 | revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a |
|
89 | 104 | |
|
90 | 105 | make $GITROOT pushable, by replacing it with a clone with nothing checked out |
|
91 | 106 | |
|
92 | 107 | $ cd .. |
|
93 | 108 | $ git clone gitroot gitrootbare --bare -q |
|
94 | 109 | $ rm -rf gitroot |
|
95 | 110 | $ mv gitrootbare gitroot |
|
96 | 111 | |
|
97 | 112 | clone root |
|
98 | 113 | |
|
99 | 114 | $ cd t |
|
100 | 115 | $ hg clone . ../tc 2> /dev/null |
|
101 | 116 | updating to branch default |
|
102 | 117 | cloning subrepo s from $TESTTMP/gitroot |
|
103 | 118 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
104 | 119 | $ cd ../tc |
|
105 | 120 | $ hg debugsub |
|
106 | 121 | path s |
|
107 | 122 | source ../gitroot |
|
108 | 123 | revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a |
|
109 | 124 | $ cd .. |
|
110 | 125 | |
|
111 | 126 | clone with subrepo disabled (update should fail) |
|
112 | 127 | |
|
113 | 128 | $ hg clone t -U tc2 --config subrepos.allowed=false |
|
114 | 129 | $ hg update -R tc2 --config subrepos.allowed=false |
|
115 | 130 | abort: subrepos not enabled |
|
116 | 131 | (see 'hg help config.subrepos' for details) |
|
117 | 132 | [255] |
|
118 | 133 | $ ls tc2 |
|
119 | 134 | a |
|
120 | 135 | |
|
121 | 136 | $ hg clone t tc3 --config subrepos.allowed=false |
|
122 | 137 | updating to branch default |
|
123 | 138 | abort: subrepos not enabled |
|
124 | 139 | (see 'hg help config.subrepos' for details) |
|
125 | 140 | [255] |
|
126 | 141 | $ ls tc3 |
|
127 | 142 | a |
|
128 | 143 | |
|
129 | 144 | update to previous substate |
|
130 | 145 | |
|
131 | 146 | $ cd tc |
|
132 | 147 | $ hg update 1 -q |
|
133 | 148 | $ cat s/g |
|
134 | 149 | g |
|
135 | 150 | $ hg debugsub |
|
136 | 151 | path s |
|
137 | 152 | source ../gitroot |
|
138 | 153 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
139 | 154 | |
|
140 | 155 | clone root, make local change |
|
141 | 156 | |
|
142 | 157 | $ cd ../t |
|
143 | 158 | $ hg clone . ../ta 2> /dev/null |
|
144 | 159 | updating to branch default |
|
145 | 160 | cloning subrepo s from $TESTTMP/gitroot |
|
146 | 161 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
147 | 162 | |
|
148 | 163 | $ cd ../ta |
|
149 | 164 | $ echo ggg >> s/g |
|
150 | 165 | $ hg status --subrepos |
|
151 | 166 | M s/g |
|
152 | 167 | $ hg diff --subrepos |
|
153 | 168 | diff --git a/s/g b/s/g |
|
154 | 169 | index 089258f..85341ee 100644 |
|
155 | 170 | --- a/s/g |
|
156 | 171 | +++ b/s/g |
|
157 | 172 | @@ -1,2 +1,3 @@ |
|
158 | 173 | g |
|
159 | 174 | gg |
|
160 | 175 | +ggg |
|
161 | 176 | $ hg commit --subrepos -m ggg |
|
162 | 177 | committing subrepository s |
|
163 | 178 | $ hg debugsub |
|
164 | 179 | path s |
|
165 | 180 | source ../gitroot |
|
166 | 181 | revision 79695940086840c99328513acbe35f90fcd55e57 |
|
167 | 182 | |
|
168 | 183 | clone root separately, make different local change |
|
169 | 184 | |
|
170 | 185 | $ cd ../t |
|
171 | 186 | $ hg clone . ../tb 2> /dev/null |
|
172 | 187 | updating to branch default |
|
173 | 188 | cloning subrepo s from $TESTTMP/gitroot |
|
174 | 189 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 190 | |
|
176 | 191 | $ cd ../tb/s |
|
177 | 192 | $ hg status --subrepos |
|
178 | 193 | $ echo f > f |
|
179 | 194 | $ hg status --subrepos |
|
180 | 195 | ? s/f |
|
181 | 196 | $ hg add . |
|
182 | 197 | adding f |
|
183 | 198 | $ git add f |
|
184 | 199 | $ cd .. |
|
185 | 200 | |
|
186 | 201 | $ hg status --subrepos |
|
187 | 202 | A s/f |
|
188 | 203 | $ hg commit --subrepos -m f |
|
189 | 204 | committing subrepository s |
|
190 | 205 | $ hg debugsub |
|
191 | 206 | path s |
|
192 | 207 | source ../gitroot |
|
193 | 208 | revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
194 | 209 | |
|
195 | 210 | user b push changes |
|
196 | 211 | |
|
197 | 212 | $ hg push 2>/dev/null |
|
198 | 213 | pushing to $TESTTMP/t |
|
199 | 214 | pushing branch testing of subrepository "s" |
|
200 | 215 | searching for changes |
|
201 | 216 | adding changesets |
|
202 | 217 | adding manifests |
|
203 | 218 | adding file changes |
|
204 | 219 | added 1 changesets with 1 changes to 1 files |
|
205 | 220 | |
|
206 | 221 | user a pulls, merges, commits |
|
207 | 222 | |
|
208 | 223 | $ cd ../ta |
|
209 | 224 | $ hg pull |
|
210 | 225 | pulling from $TESTTMP/t |
|
211 | 226 | searching for changes |
|
212 | 227 | adding changesets |
|
213 | 228 | adding manifests |
|
214 | 229 | adding file changes |
|
215 | 230 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
216 | 231 | new changesets 089416c11d73 |
|
217 | 232 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
218 | 233 | $ hg merge 2>/dev/null |
|
219 | 234 | subrepository s diverged (local revision: 7969594, remote revision: aa84837) |
|
220 | 235 | you can (m)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]. |
|
221 | 236 | what do you want to do? m |
|
222 | 237 | pulling subrepo s from $TESTTMP/gitroot |
|
223 | 238 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
224 | 239 | (branch merge, don't forget to commit) |
|
225 | 240 | $ hg st --subrepos s |
|
226 | 241 | A s/f |
|
227 | 242 | $ cat s/f |
|
228 | 243 | f |
|
229 | 244 | $ cat s/g |
|
230 | 245 | g |
|
231 | 246 | gg |
|
232 | 247 | ggg |
|
233 | 248 | $ hg commit --subrepos -m 'merge' |
|
234 | 249 | committing subrepository s |
|
235 | 250 | $ hg status --subrepos --rev 1:5 |
|
236 | 251 | M .hgsubstate |
|
237 | 252 | M s/g |
|
238 | 253 | A s/f |
|
239 | 254 | $ hg debugsub |
|
240 | 255 | path s |
|
241 | 256 | source ../gitroot |
|
242 | 257 | revision f47b465e1bce645dbf37232a00574aa1546ca8d3 |
|
243 | 258 | $ hg push 2>/dev/null |
|
244 | 259 | pushing to $TESTTMP/t |
|
245 | 260 | pushing branch testing of subrepository "s" |
|
246 | 261 | searching for changes |
|
247 | 262 | adding changesets |
|
248 | 263 | adding manifests |
|
249 | 264 | adding file changes |
|
250 | 265 | added 2 changesets with 2 changes to 1 files |
|
251 | 266 | |
|
252 | 267 | make upstream git changes |
|
253 | 268 | |
|
254 | 269 | $ cd .. |
|
255 | 270 | $ git clone -q gitroot gitclone |
|
256 | 271 | $ cd gitclone |
|
257 | 272 | $ echo ff >> f |
|
258 | 273 | $ git commit -q -a -m ff |
|
259 | 274 | $ echo fff >> f |
|
260 | 275 | $ git commit -q -a -m fff |
|
261 | 276 | $ git push origin testing 2>/dev/null |
|
262 | 277 | |
|
263 | 278 | make and push changes to hg without updating the subrepo |
|
264 | 279 | |
|
265 | 280 | $ cd ../t |
|
266 | 281 | $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.' |
|
267 | 282 | updating to branch default |
|
268 | 283 | cloning subrepo s from $TESTTMP/gitroot |
|
269 | 284 | checking out detached HEAD in subrepository "s" |
|
270 | 285 | check out a git branch if you intend to make changes |
|
271 | 286 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
272 | 287 | $ cd ../td |
|
273 | 288 | $ echo aa >> a |
|
274 | 289 | $ hg commit -m aa |
|
275 | 290 | $ hg push |
|
276 | 291 | pushing to $TESTTMP/t |
|
277 | 292 | searching for changes |
|
278 | 293 | adding changesets |
|
279 | 294 | adding manifests |
|
280 | 295 | adding file changes |
|
281 | 296 | added 1 changesets with 1 changes to 1 files |
|
282 | 297 | |
|
283 | 298 | sync to upstream git, distribute changes |
|
284 | 299 | |
|
285 | 300 | $ cd ../ta |
|
286 | 301 | $ hg pull -u -q |
|
287 | 302 | $ cd s |
|
288 | 303 | $ git pull -q >/dev/null 2>/dev/null |
|
289 | 304 | $ cd .. |
|
290 | 305 | $ hg commit -m 'git upstream sync' |
|
291 | 306 | $ hg debugsub |
|
292 | 307 | path s |
|
293 | 308 | source ../gitroot |
|
294 | 309 | revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
295 | 310 | $ hg push -q |
|
296 | 311 | |
|
297 | 312 | $ cd ../tb |
|
298 | 313 | $ hg pull -q |
|
299 | 314 | $ hg update 2>/dev/null |
|
300 | 315 | pulling subrepo s from $TESTTMP/gitroot |
|
301 | 316 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
302 | 317 | $ hg debugsub |
|
303 | 318 | path s |
|
304 | 319 | source ../gitroot |
|
305 | 320 | revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
306 | 321 | |
|
307 | 322 | create a new git branch |
|
308 | 323 | |
|
309 | 324 | $ cd s |
|
310 | 325 | $ git checkout -b b2 |
|
311 | 326 | Switched to a new branch 'b2' |
|
312 | 327 | $ echo a>a |
|
313 | 328 | $ git add a |
|
314 | 329 | $ git commit -qm 'add a' |
|
315 | 330 | $ cd .. |
|
316 | 331 | $ hg commit -m 'add branch in s' |
|
317 | 332 | |
|
318 | 333 | pulling new git branch should not create tracking branch named 'origin/b2' |
|
319 | 334 | (issue3870) |
|
320 | 335 | $ cd ../td/s |
|
321 | 336 | $ git remote set-url origin $TESTTMP/tb/s |
|
322 | 337 | $ git branch --no-track oldtesting |
|
323 | 338 | $ cd .. |
|
324 | 339 | $ hg pull -q ../tb |
|
325 | 340 | $ hg up |
|
326 | 341 | From $TESTTMP/tb/s |
|
327 | 342 | * [new branch] b2 -> origin/b2 |
|
328 | 343 | Previous HEAD position was f47b465* merge (glob) |
|
329 | 344 | Switched to a new branch 'b2' |
|
330 | 345 | pulling subrepo s from $TESTTMP/tb/s |
|
331 | 346 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
332 | 347 | |
|
333 | 348 | update to a revision without the subrepo, keeping the local git repository |
|
334 | 349 | |
|
335 | 350 | $ cd ../t |
|
336 | 351 | $ hg up 0 |
|
337 | 352 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
338 | 353 | $ ls -a s |
|
339 | 354 | . |
|
340 | 355 | .. |
|
341 | 356 | .git |
|
342 | 357 | |
|
343 | 358 | $ hg up 2 |
|
344 | 359 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
345 | 360 | $ ls -a s |
|
346 | 361 | . |
|
347 | 362 | .. |
|
348 | 363 | .git |
|
349 | 364 | g |
|
350 | 365 | |
|
351 | 366 | archive subrepos |
|
352 | 367 | |
|
353 | 368 | $ cd ../tc |
|
354 | 369 | $ hg pull -q |
|
355 | 370 | $ hg archive --subrepos -r 5 ../archive 2>/dev/null |
|
356 | 371 | pulling subrepo s from $TESTTMP/gitroot |
|
357 | 372 | $ cd ../archive |
|
358 | 373 | $ cat s/f |
|
359 | 374 | f |
|
360 | 375 | $ cat s/g |
|
361 | 376 | g |
|
362 | 377 | gg |
|
363 | 378 | ggg |
|
364 | 379 | |
|
365 | 380 | $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null |
|
366 | 381 | $ find ../archive_x | sort | grep -v pax_global_header |
|
367 | 382 | ../archive_x |
|
368 | 383 | ../archive_x/.hg_archival.txt |
|
369 | 384 | ../archive_x/.hgsub |
|
370 | 385 | ../archive_x/.hgsubstate |
|
371 | 386 | ../archive_x/a |
|
372 | 387 | ../archive_x/s |
|
373 | 388 | ../archive_x/s/g |
|
374 | 389 | |
|
375 | 390 | $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null |
|
376 | 391 | $ tar -tzf ../archive.tgz | sort | grep -v pax_global_header |
|
377 | 392 | .hg_archival.txt |
|
378 | 393 | .hgsub |
|
379 | 394 | .hgsubstate |
|
380 | 395 | a |
|
381 | 396 | s/g |
|
382 | 397 | |
|
383 | 398 | $ hg -R ../tc archive -S ../lf_archive.tgz --prefix '.' \ |
|
384 | 399 | > --config extensions.largefiles= 2>/dev/null |
|
385 | 400 | $ tar -tzf ../lf_archive.tgz | sort | grep -v pax_global_header |
|
386 | 401 | .hg_archival.txt |
|
387 | 402 | .hgsub |
|
388 | 403 | .hgsubstate |
|
389 | 404 | a |
|
390 | 405 | s/g |
|
391 | 406 | |
|
392 | 407 | create nested repo |
|
393 | 408 | |
|
394 | 409 | $ cd .. |
|
395 | 410 | $ hg init outer |
|
396 | 411 | $ cd outer |
|
397 | 412 | $ echo b>b |
|
398 | 413 | $ hg add b |
|
399 | 414 | $ hg commit -m b |
|
400 | 415 | |
|
401 | 416 | $ hg clone ../t inner 2> /dev/null |
|
402 | 417 | updating to branch default |
|
403 | 418 | cloning subrepo s from $TESTTMP/gitroot |
|
404 | 419 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
405 | 420 | $ echo inner = inner > .hgsub |
|
406 | 421 | $ hg add .hgsub |
|
407 | 422 | $ hg commit -m 'nested sub' |
|
408 | 423 | |
|
409 | 424 | nested commit |
|
410 | 425 | |
|
411 | 426 | $ echo ffff >> inner/s/f |
|
412 | 427 | $ hg status --subrepos |
|
413 | 428 | M inner/s/f |
|
414 | 429 | $ hg commit --subrepos -m nested |
|
415 | 430 | committing subrepository inner |
|
416 | 431 | committing subrepository inner/s |
|
417 | 432 | |
|
418 | 433 | nested archive |
|
419 | 434 | |
|
420 | 435 | $ hg archive --subrepos ../narchive |
|
421 | 436 | $ ls ../narchive/inner/s | grep -v pax_global_header |
|
422 | 437 | f |
|
423 | 438 | g |
|
424 | 439 | |
|
425 | 440 | relative source expansion |
|
426 | 441 | |
|
427 | 442 | $ cd .. |
|
428 | 443 | $ mkdir d |
|
429 | 444 | $ hg clone t d/t 2> /dev/null |
|
430 | 445 | updating to branch default |
|
431 | 446 | cloning subrepo s from $TESTTMP/gitroot |
|
432 | 447 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
433 | 448 | |
|
434 | 449 | Don't crash if the subrepo is missing |
|
435 | 450 | |
|
436 | 451 | $ hg clone t missing -q |
|
437 | 452 | $ cd missing |
|
438 | 453 | $ rm -rf s |
|
439 | 454 | $ hg status -S |
|
440 | 455 | $ hg sum | grep commit |
|
441 | 456 | commit: 1 subrepos |
|
442 | 457 | $ hg push -q |
|
443 | 458 | abort: subrepo s is missing (in subrepository "s") |
|
444 | 459 | [255] |
|
445 | 460 | $ hg commit --subrepos -qm missing |
|
446 | 461 | abort: subrepo s is missing (in subrepository "s") |
|
447 | 462 | [255] |
|
448 | 463 | |
|
449 | 464 | #if symlink |
|
450 | 465 | Don't crash if subrepo is a broken symlink |
|
451 | 466 | $ ln -s broken s |
|
452 | 467 | $ hg status -S |
|
453 | 468 | abort: subrepo 's' traverses symbolic link |
|
454 | 469 | [255] |
|
455 | 470 | $ hg push -q |
|
456 | 471 | abort: subrepo 's' traverses symbolic link |
|
457 | 472 | [255] |
|
458 | 473 | $ hg commit --subrepos -qm missing |
|
459 | 474 | abort: subrepo 's' traverses symbolic link |
|
460 | 475 | [255] |
|
461 | 476 | $ rm s |
|
462 | 477 | #endif |
|
463 | 478 | |
|
464 | 479 | $ hg update -C 2> /dev/null |
|
465 | 480 | cloning subrepo s from $TESTTMP/gitroot |
|
466 | 481 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
467 | 482 | $ hg sum | grep commit |
|
468 | 483 | commit: (clean) |
|
469 | 484 | |
|
470 | 485 | Don't crash if the .hgsubstate entry is missing |
|
471 | 486 | |
|
472 | 487 | $ hg update 1 -q |
|
473 | 488 | $ hg rm .hgsubstate |
|
474 | 489 | $ hg commit .hgsubstate -m 'no substate' |
|
475 | 490 | nothing changed |
|
476 | 491 | [1] |
|
477 | 492 | $ hg tag -l nosubstate |
|
478 | 493 | $ hg manifest |
|
479 | 494 | .hgsub |
|
480 | 495 | .hgsubstate |
|
481 | 496 | a |
|
482 | 497 | |
|
483 | 498 | $ hg status -S |
|
484 | 499 | R .hgsubstate |
|
485 | 500 | $ hg sum | grep commit |
|
486 | 501 | commit: 1 removed, 1 subrepos (new branch head) |
|
487 | 502 | |
|
488 | 503 | $ hg commit -m 'restore substate' |
|
489 | 504 | nothing changed |
|
490 | 505 | [1] |
|
491 | 506 | $ hg manifest |
|
492 | 507 | .hgsub |
|
493 | 508 | .hgsubstate |
|
494 | 509 | a |
|
495 | 510 | $ hg sum | grep commit |
|
496 | 511 | commit: 1 removed, 1 subrepos (new branch head) |
|
497 | 512 | |
|
498 | 513 | $ hg update -qC nosubstate |
|
499 | 514 | $ ls s |
|
500 | 515 | g |
|
501 | 516 | |
|
502 | 517 | issue3109: false positives in git diff-index |
|
503 | 518 | |
|
504 | 519 | $ hg update -q |
|
505 | 520 | $ touch -t 200001010000 s/g |
|
506 | 521 | $ hg status --subrepos |
|
507 | 522 | $ touch -t 200001010000 s/g |
|
508 | 523 | $ hg sum | grep commit |
|
509 | 524 | commit: (clean) |
|
510 | 525 | |
|
511 | 526 | Check hg update --clean |
|
512 | 527 | $ cd $TESTTMP/ta |
|
513 | 528 | $ echo > s/g |
|
514 | 529 | $ cd s |
|
515 | 530 | $ echo c1 > f1 |
|
516 | 531 | $ echo c1 > f2 |
|
517 | 532 | $ git add f1 |
|
518 | 533 | $ cd .. |
|
519 | 534 | $ hg status -S |
|
520 | 535 | M s/g |
|
521 | 536 | A s/f1 |
|
522 | 537 | ? s/f2 |
|
523 | 538 | $ ls s |
|
524 | 539 | f |
|
525 | 540 | f1 |
|
526 | 541 | f2 |
|
527 | 542 | g |
|
528 | 543 | $ hg update --clean |
|
529 | 544 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
530 | 545 | $ hg status -S |
|
531 | 546 | ? s/f1 |
|
532 | 547 | ? s/f2 |
|
533 | 548 | $ ls s |
|
534 | 549 | f |
|
535 | 550 | f1 |
|
536 | 551 | f2 |
|
537 | 552 | g |
|
538 | 553 | |
|
539 | 554 | Sticky subrepositories, no changes |
|
540 | 555 | $ cd $TESTTMP/ta |
|
541 | 556 | $ hg id -n |
|
542 | 557 | 7 |
|
543 | 558 | $ cd s |
|
544 | 559 | $ git rev-parse HEAD |
|
545 | 560 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
546 | 561 | $ cd .. |
|
547 | 562 | $ hg update 1 > /dev/null 2>&1 |
|
548 | 563 | $ hg id -n |
|
549 | 564 | 1 |
|
550 | 565 | $ cd s |
|
551 | 566 | $ git rev-parse HEAD |
|
552 | 567 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
553 | 568 | $ cd .. |
|
554 | 569 | |
|
555 | 570 | Sticky subrepositories, file changes |
|
556 | 571 | $ touch s/f1 |
|
557 | 572 | $ cd s |
|
558 | 573 | $ git add f1 |
|
559 | 574 | $ cd .. |
|
560 | 575 | $ hg id -n |
|
561 | 576 | 1+ |
|
562 | 577 | $ cd s |
|
563 | 578 | $ git rev-parse HEAD |
|
564 | 579 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
565 | 580 | $ cd .. |
|
566 | 581 | $ hg update 4 |
|
567 | 582 | subrepository s diverged (local revision: da5f5b1, remote revision: aa84837) |
|
568 | 583 | you can (m)erge, keep (l)ocal [working copy] or keep (r)emote [destination]. |
|
569 | 584 | what do you want to do? m |
|
570 | 585 | subrepository sources for s differ |
|
571 | 586 | you can use (l)ocal source (da5f5b1) or (r)emote source (aa84837). |
|
572 | 587 | what do you want to do? l |
|
573 | 588 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
574 | 589 | $ hg id -n |
|
575 | 590 | 4+ |
|
576 | 591 | $ cd s |
|
577 | 592 | $ git rev-parse HEAD |
|
578 | 593 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
579 | 594 | $ cd .. |
|
580 | 595 | $ hg update --clean tip > /dev/null 2>&1 |
|
581 | 596 | |
|
582 | 597 | Sticky subrepository, revision updates |
|
583 | 598 | $ hg id -n |
|
584 | 599 | 7 |
|
585 | 600 | $ cd s |
|
586 | 601 | $ git rev-parse HEAD |
|
587 | 602 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
588 | 603 | $ cd .. |
|
589 | 604 | $ cd s |
|
590 | 605 | $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
591 | 606 | Previous HEAD position was 32a3438* fff (glob) |
|
592 | 607 | HEAD is now at aa84837* f (glob) |
|
593 | 608 | $ cd .. |
|
594 | 609 | $ hg update 1 |
|
595 | 610 | subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1) |
|
596 | 611 | you can (m)erge, keep (l)ocal [working copy] or keep (r)emote [destination]. |
|
597 | 612 | what do you want to do? m |
|
598 | 613 | subrepository sources for s differ (in checked out version) |
|
599 | 614 | you can use (l)ocal source (32a3438) or (r)emote source (da5f5b1). |
|
600 | 615 | what do you want to do? l |
|
601 | 616 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
602 | 617 | $ hg id -n |
|
603 | 618 | 1+ |
|
604 | 619 | $ cd s |
|
605 | 620 | $ git rev-parse HEAD |
|
606 | 621 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
607 | 622 | $ cd .. |
|
608 | 623 | |
|
609 | 624 | Sticky subrepository, file changes and revision updates |
|
610 | 625 | $ touch s/f1 |
|
611 | 626 | $ cd s |
|
612 | 627 | $ git add f1 |
|
613 | 628 | $ git rev-parse HEAD |
|
614 | 629 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
615 | 630 | $ cd .. |
|
616 | 631 | $ hg id -n |
|
617 | 632 | 1+ |
|
618 | 633 | $ hg update 7 |
|
619 | 634 | subrepository s diverged (local revision: 32a3438, remote revision: 32a3438) |
|
620 | 635 | you can (m)erge, keep (l)ocal [working copy] or keep (r)emote [destination]. |
|
621 | 636 | what do you want to do? m |
|
622 | 637 | subrepository sources for s differ |
|
623 | 638 | you can use (l)ocal source (32a3438) or (r)emote source (32a3438). |
|
624 | 639 | what do you want to do? l |
|
625 | 640 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
626 | 641 | $ hg id -n |
|
627 | 642 | 7+ |
|
628 | 643 | $ cd s |
|
629 | 644 | $ git rev-parse HEAD |
|
630 | 645 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
631 | 646 | $ cd .. |
|
632 | 647 | |
|
633 | 648 | Sticky repository, update --clean |
|
634 | 649 | $ hg update --clean tip 2>/dev/null |
|
635 | 650 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
636 | 651 | $ hg id -n |
|
637 | 652 | 7 |
|
638 | 653 | $ cd s |
|
639 | 654 | $ git rev-parse HEAD |
|
640 | 655 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
641 | 656 | $ cd .. |
|
642 | 657 | |
|
643 | 658 | Test subrepo already at intended revision: |
|
644 | 659 | $ cd s |
|
645 | 660 | $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
646 | 661 | HEAD is now at 32a3438* fff (glob) |
|
647 | 662 | $ cd .. |
|
648 | 663 | $ hg update 1 |
|
649 | 664 | Previous HEAD position was 32a3438* fff (glob) |
|
650 | 665 | HEAD is now at da5f5b1* g (glob) |
|
651 | 666 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
652 | 667 | $ hg id -n |
|
653 | 668 | 1 |
|
654 | 669 | $ cd s |
|
655 | 670 | $ git rev-parse HEAD |
|
656 | 671 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
657 | 672 | $ cd .. |
|
658 | 673 | |
|
659 | 674 | Test forgetting files, not implemented in git subrepo, used to |
|
660 | 675 | traceback |
|
661 | 676 | #if no-windows |
|
662 | 677 | $ hg forget 'notafile*' |
|
663 | 678 | notafile*: $ENOENT$ |
|
664 | 679 | [1] |
|
665 | 680 | #else |
|
666 | 681 | error: The filename, directory name, or volume label syntax is incorrect |
|
667 | 682 | $ hg forget 'notafile' |
|
668 | 683 | notafile: * (glob) |
|
669 | 684 | [1] |
|
670 | 685 | #endif |
|
671 | 686 | |
|
672 | 687 | $ cd .. |
|
673 | 688 | |
|
674 | 689 | Test sanitizing ".hg/hgrc" in subrepo |
|
675 | 690 | |
|
676 | 691 | $ cd t |
|
677 | 692 | $ hg tip -q |
|
678 | 693 | 7:af6d2edbb0d3 |
|
679 | 694 | $ hg update -q -C af6d2edbb0d3 |
|
680 | 695 | $ cd s |
|
681 | 696 | $ git checkout -q -b sanitize-test |
|
682 | 697 | $ mkdir .hg |
|
683 | 698 | $ echo '.hg/hgrc in git repo' > .hg/hgrc |
|
684 | 699 | $ mkdir -p sub/.hg |
|
685 | 700 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc |
|
686 | 701 | $ git add .hg sub |
|
687 | 702 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update' |
|
688 | 703 | $ git push -q origin sanitize-test |
|
689 | 704 | $ cd .. |
|
690 | 705 | $ grep ' s$' .hgsubstate |
|
691 | 706 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
692 | 707 | $ hg commit -qm 'commit with git revision including .hg/hgrc' |
|
693 | 708 | $ hg parents -q |
|
694 | 709 | 8:3473d20bddcf |
|
695 | 710 | $ grep ' s$' .hgsubstate |
|
696 | 711 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s |
|
697 | 712 | $ cd .. |
|
698 | 713 | |
|
699 | 714 | $ hg -R tc pull -q |
|
700 | 715 | $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort |
|
701 | 716 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' |
|
702 | 717 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' |
|
703 | 718 | $ cd tc |
|
704 | 719 | $ hg parents -q |
|
705 | 720 | 8:3473d20bddcf |
|
706 | 721 | $ grep ' s$' .hgsubstate |
|
707 | 722 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s |
|
708 | 723 | $ test -f s/.hg/hgrc |
|
709 | 724 | [1] |
|
710 | 725 | $ test -f s/sub/.hg/hgrc |
|
711 | 726 | [1] |
|
712 | 727 | $ cd .. |
|
713 | 728 | |
|
714 | 729 | additional test for "git merge --ff" route: |
|
715 | 730 | |
|
716 | 731 | $ cd t |
|
717 | 732 | $ hg tip -q |
|
718 | 733 | 8:3473d20bddcf |
|
719 | 734 | $ hg update -q -C af6d2edbb0d3 |
|
720 | 735 | $ cd s |
|
721 | 736 | $ git checkout -q testing |
|
722 | 737 | $ mkdir .hg |
|
723 | 738 | $ echo '.hg/hgrc in git repo' > .hg/hgrc |
|
724 | 739 | $ mkdir -p sub/.hg |
|
725 | 740 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc |
|
726 | 741 | $ git add .hg sub |
|
727 | 742 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)' |
|
728 | 743 | $ git push -q origin testing |
|
729 | 744 | $ cd .. |
|
730 | 745 | $ grep ' s$' .hgsubstate |
|
731 | 746 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
732 | 747 | $ hg commit -qm 'commit with git revision including .hg/hgrc' |
|
733 | 748 | $ hg parents -q |
|
734 | 749 | 9:ed23f7fe024e |
|
735 | 750 | $ grep ' s$' .hgsubstate |
|
736 | 751 | f262643c1077219fbd3858d54e78ef050ef84fbf s |
|
737 | 752 | $ cd .. |
|
738 | 753 | |
|
739 | 754 | $ cd tc |
|
740 | 755 | $ hg update -q -C af6d2edbb0d3 |
|
741 | 756 | $ test -f s/.hg/hgrc |
|
742 | 757 | [1] |
|
743 | 758 | $ test -f s/sub/.hg/hgrc |
|
744 | 759 | [1] |
|
745 | 760 | $ cd .. |
|
746 | 761 | $ hg -R tc pull -q |
|
747 | 762 | $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort |
|
748 | 763 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' |
|
749 | 764 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' |
|
750 | 765 | $ cd tc |
|
751 | 766 | $ hg parents -q |
|
752 | 767 | 9:ed23f7fe024e |
|
753 | 768 | $ grep ' s$' .hgsubstate |
|
754 | 769 | f262643c1077219fbd3858d54e78ef050ef84fbf s |
|
755 | 770 | $ test -f s/.hg/hgrc |
|
756 | 771 | [1] |
|
757 | 772 | $ test -f s/sub/.hg/hgrc |
|
758 | 773 | [1] |
|
759 | 774 | |
|
760 | 775 | Test that sanitizing is omitted in meta data area: |
|
761 | 776 | |
|
762 | 777 | $ mkdir s/.git/.hg |
|
763 | 778 | $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc |
|
764 | 779 | $ hg update -q -C af6d2edbb0d3 |
|
765 | 780 | checking out detached HEAD in subrepository "s" |
|
766 | 781 | check out a git branch if you intend to make changes |
|
767 | 782 | |
|
768 | 783 | check differences made by most recent change |
|
769 | 784 | $ cd s |
|
770 | 785 | $ cat > foobar << EOF |
|
771 | 786 | > woopwoop |
|
772 | 787 | > |
|
773 | 788 | > foo |
|
774 | 789 | > bar |
|
775 | 790 | > EOF |
|
776 | 791 | $ git add foobar |
|
777 | 792 | $ cd .. |
|
778 | 793 | |
|
779 | 794 | $ hg diff --subrepos |
|
780 | 795 | diff --git a/s/foobar b/s/foobar |
|
781 | 796 | new file mode 100644 |
|
782 | 797 | index 0000000..8a5a5e2 |
|
783 | 798 | --- /dev/null |
|
784 | 799 | +++ b/s/foobar |
|
785 | 800 | @@ -0,0 +1,4 @@ |
|
786 | 801 | +woopwoop |
|
787 | 802 | + |
|
788 | 803 | +foo |
|
789 | 804 | +bar |
|
790 | 805 | |
|
791 | 806 | $ hg commit --subrepos -m "Added foobar" |
|
792 | 807 | committing subrepository s |
|
793 | 808 | created new head |
|
794 | 809 | |
|
795 | 810 | $ hg diff -c . --subrepos --nodates |
|
796 | 811 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate |
|
797 | 812 | --- a/.hgsubstate |
|
798 | 813 | +++ b/.hgsubstate |
|
799 | 814 | @@ -1,1 +1,1 @@ |
|
800 | 815 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
801 | 816 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s |
|
802 | 817 | diff --git a/s/foobar b/s/foobar |
|
803 | 818 | new file mode 100644 |
|
804 | 819 | index 0000000..8a5a5e2 |
|
805 | 820 | --- /dev/null |
|
806 | 821 | +++ b/s/foobar |
|
807 | 822 | @@ -0,0 +1,4 @@ |
|
808 | 823 | +woopwoop |
|
809 | 824 | + |
|
810 | 825 | +foo |
|
811 | 826 | +bar |
|
812 | 827 | |
|
813 | 828 | check output when only diffing the subrepository |
|
814 | 829 | $ hg diff -c . --subrepos s |
|
815 | 830 | diff --git a/s/foobar b/s/foobar |
|
816 | 831 | new file mode 100644 |
|
817 | 832 | index 0000000..8a5a5e2 |
|
818 | 833 | --- /dev/null |
|
819 | 834 | +++ b/s/foobar |
|
820 | 835 | @@ -0,0 +1,4 @@ |
|
821 | 836 | +woopwoop |
|
822 | 837 | + |
|
823 | 838 | +foo |
|
824 | 839 | +bar |
|
825 | 840 | |
|
826 | 841 | check output when diffing something else |
|
827 | 842 | $ hg diff -c . --subrepos .hgsubstate --nodates |
|
828 | 843 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate |
|
829 | 844 | --- a/.hgsubstate |
|
830 | 845 | +++ b/.hgsubstate |
|
831 | 846 | @@ -1,1 +1,1 @@ |
|
832 | 847 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
833 | 848 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s |
|
834 | 849 | |
|
835 | 850 | add new changes, including whitespace |
|
836 | 851 | $ cd s |
|
837 | 852 | $ cat > foobar << EOF |
|
838 | 853 | > woop woop |
|
839 | 854 | > |
|
840 | 855 | > foo |
|
841 | 856 | > bar |
|
842 | 857 | > EOF |
|
843 | 858 | $ echo foo > barfoo |
|
844 | 859 | $ git add barfoo |
|
845 | 860 | $ cd .. |
|
846 | 861 | |
|
847 | 862 | $ hg diff --subrepos --ignore-all-space |
|
848 | 863 | diff --git a/s/barfoo b/s/barfoo |
|
849 | 864 | new file mode 100644 |
|
850 | 865 | index 0000000..257cc56 |
|
851 | 866 | --- /dev/null |
|
852 | 867 | +++ b/s/barfoo |
|
853 | 868 | @@ -0,0 +1* @@ (glob) |
|
854 | 869 | +foo |
|
855 | 870 | $ hg diff --subrepos s/foobar |
|
856 | 871 | diff --git a/s/foobar b/s/foobar |
|
857 | 872 | index 8a5a5e2..bd5812a 100644 |
|
858 | 873 | --- a/s/foobar |
|
859 | 874 | +++ b/s/foobar |
|
860 | 875 | @@ -1,4 +1,4 @@ |
|
861 | 876 | -woopwoop |
|
862 | 877 | +woop woop |
|
863 | 878 | |
|
864 | 879 | foo |
|
865 | 880 | bar |
|
866 | 881 | |
|
867 | 882 | execute a diffstat |
|
868 | 883 | the output contains a regex, because git 1.7.10 and 1.7.11 |
|
869 | 884 | change the amount of whitespace |
|
870 | 885 | $ hg diff --subrepos --stat |
|
871 | 886 | \s*barfoo \|\s+1 \+ (re) |
|
872 | 887 | \s*foobar \|\s+2 \+- (re) |
|
873 | 888 | 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re) |
|
874 | 889 | |
|
875 | 890 | adding an include should ignore the other elements |
|
876 | 891 | $ hg diff --subrepos -I s/foobar |
|
877 | 892 | diff --git a/s/foobar b/s/foobar |
|
878 | 893 | index 8a5a5e2..bd5812a 100644 |
|
879 | 894 | --- a/s/foobar |
|
880 | 895 | +++ b/s/foobar |
|
881 | 896 | @@ -1,4 +1,4 @@ |
|
882 | 897 | -woopwoop |
|
883 | 898 | +woop woop |
|
884 | 899 | |
|
885 | 900 | foo |
|
886 | 901 | bar |
|
887 | 902 | |
|
888 | 903 | adding an exclude should ignore this element |
|
889 | 904 | $ hg diff --subrepos -X s/foobar |
|
890 | 905 | diff --git a/s/barfoo b/s/barfoo |
|
891 | 906 | new file mode 100644 |
|
892 | 907 | index 0000000..257cc56 |
|
893 | 908 | --- /dev/null |
|
894 | 909 | +++ b/s/barfoo |
|
895 | 910 | @@ -0,0 +1* @@ (glob) |
|
896 | 911 | +foo |
|
897 | 912 | |
|
898 | 913 | moving a file should show a removal and an add |
|
899 | 914 | $ hg revert --all |
|
900 | 915 | reverting subrepo ../gitroot |
|
901 | 916 | $ cd s |
|
902 | 917 | $ git mv foobar woop |
|
903 | 918 | $ cd .. |
|
904 | 919 | $ hg diff --subrepos |
|
905 | 920 | diff --git a/s/foobar b/s/foobar |
|
906 | 921 | deleted file mode 100644 |
|
907 | 922 | index 8a5a5e2..0000000 |
|
908 | 923 | --- a/s/foobar |
|
909 | 924 | +++ /dev/null |
|
910 | 925 | @@ -1,4 +0,0 @@ |
|
911 | 926 | -woopwoop |
|
912 | 927 | - |
|
913 | 928 | -foo |
|
914 | 929 | -bar |
|
915 | 930 | diff --git a/s/woop b/s/woop |
|
916 | 931 | new file mode 100644 |
|
917 | 932 | index 0000000..8a5a5e2 |
|
918 | 933 | --- /dev/null |
|
919 | 934 | +++ b/s/woop |
|
920 | 935 | @@ -0,0 +1,4 @@ |
|
921 | 936 | +woopwoop |
|
922 | 937 | + |
|
923 | 938 | +foo |
|
924 | 939 | +bar |
|
925 | 940 | $ rm s/woop |
|
926 | 941 | |
|
927 | 942 | revert the subrepository |
|
928 | 943 | $ hg revert --all |
|
929 | 944 | reverting subrepo ../gitroot |
|
930 | 945 | |
|
931 | 946 | $ hg status --subrepos |
|
932 | 947 | ? s/barfoo |
|
933 | 948 | ? s/foobar.orig |
|
934 | 949 | |
|
935 | 950 | $ mv s/foobar.orig s/foobar |
|
936 | 951 | |
|
937 | 952 | $ hg revert --no-backup s |
|
938 | 953 | reverting subrepo ../gitroot |
|
939 | 954 | |
|
940 | 955 | $ hg status --subrepos |
|
941 | 956 | ? s/barfoo |
|
942 | 957 | |
|
943 | 958 | revert moves orig files to the right place |
|
944 | 959 | $ echo 'bloop' > s/foobar |
|
945 | 960 | $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups' |
|
946 | 961 | reverting subrepo ../gitroot |
|
947 | 962 | creating directory: $TESTTMP/tc/.hg/origbackups/s |
|
948 | 963 | saving current version of foobar as .hg/origbackups/s/foobar |
|
949 | 964 | $ ls .hg/origbackups/s |
|
950 | 965 | foobar |
|
951 | 966 | $ rm -rf .hg/origbackups |
|
952 | 967 | |
|
953 | 968 | show file at specific revision |
|
954 | 969 | $ cat > s/foobar << EOF |
|
955 | 970 | > woop woop |
|
956 | 971 | > fooo bar |
|
957 | 972 | > EOF |
|
958 | 973 | $ hg commit --subrepos -m "updated foobar" |
|
959 | 974 | committing subrepository s |
|
960 | 975 | $ cat > s/foobar << EOF |
|
961 | 976 | > current foobar |
|
962 | 977 | > (should not be visible using hg cat) |
|
963 | 978 | > EOF |
|
964 | 979 | |
|
965 | 980 | $ hg cat -r . s/foobar |
|
966 | 981 | woop woop |
|
967 | 982 | fooo bar (no-eol) |
|
968 | 983 | $ hg cat -r "parents(.)" s/foobar > catparents |
|
969 | 984 | |
|
970 | 985 | $ mkdir -p tmp/s |
|
971 | 986 | |
|
972 | 987 | $ hg cat -r "parents(.)" --output tmp/%% s/foobar |
|
973 | 988 | $ diff tmp/% catparents |
|
974 | 989 | |
|
975 | 990 | $ hg cat -r "parents(.)" --output tmp/%s s/foobar |
|
976 | 991 | $ diff tmp/foobar catparents |
|
977 | 992 | |
|
978 | 993 | $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar |
|
979 | 994 | $ diff tmp/s/otherfoobar catparents |
|
980 | 995 | |
|
981 | 996 | $ hg cat -r "parents(.)" --output tmp/%p s/foobar |
|
982 | 997 | $ diff tmp/s/foobar catparents |
|
983 | 998 | |
|
984 | 999 | $ hg cat -r "parents(.)" --output tmp/%H s/foobar |
|
985 | 1000 | $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents |
|
986 | 1001 | |
|
987 | 1002 | $ hg cat -r "parents(.)" --output tmp/%R s/foobar |
|
988 | 1003 | $ diff tmp/10 catparents |
|
989 | 1004 | |
|
990 | 1005 | $ hg cat -r "parents(.)" --output tmp/%h s/foobar |
|
991 | 1006 | $ diff tmp/255ee8cf690e catparents |
|
992 | 1007 | |
|
993 | 1008 | $ rm tmp/10 |
|
994 | 1009 | $ hg cat -r "parents(.)" --output tmp/%r s/foobar |
|
995 | 1010 | $ diff tmp/10 catparents |
|
996 | 1011 | |
|
997 | 1012 | $ mkdir tmp/tc |
|
998 | 1013 | $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar |
|
999 | 1014 | $ diff tmp/tc/foobar catparents |
|
1000 | 1015 | |
|
1001 | 1016 | cleanup |
|
1002 | 1017 | $ rm -r tmp |
|
1003 | 1018 | $ rm catparents |
|
1004 | 1019 | |
|
1005 | 1020 | add git files, using either files or patterns |
|
1006 | 1021 | $ echo "hsss! hsssssssh!" > s/snake.python |
|
1007 | 1022 | $ echo "ccc" > s/c.c |
|
1008 | 1023 | $ echo "cpp" > s/cpp.cpp |
|
1009 | 1024 | |
|
1010 | 1025 | $ hg add s/snake.python s/c.c s/cpp.cpp |
|
1011 | 1026 | $ hg st --subrepos s |
|
1012 | 1027 | M s/foobar |
|
1013 | 1028 | A s/c.c |
|
1014 | 1029 | A s/cpp.cpp |
|
1015 | 1030 | A s/snake.python |
|
1016 | 1031 | ? s/barfoo |
|
1017 | 1032 | $ hg revert s |
|
1018 | 1033 | reverting subrepo ../gitroot |
|
1019 | 1034 | |
|
1020 | 1035 | $ hg add --subrepos "glob:**.python" |
|
1021 | 1036 | adding s/snake.python |
|
1022 | 1037 | $ hg st --subrepos s |
|
1023 | 1038 | A s/snake.python |
|
1024 | 1039 | ? s/barfoo |
|
1025 | 1040 | ? s/c.c |
|
1026 | 1041 | ? s/cpp.cpp |
|
1027 | 1042 | ? s/foobar.orig |
|
1028 | 1043 | $ hg revert s |
|
1029 | 1044 | reverting subrepo ../gitroot |
|
1030 | 1045 | |
|
1031 | 1046 | $ hg add --subrepos s |
|
1032 | 1047 | adding s/barfoo |
|
1033 | 1048 | adding s/c.c |
|
1034 | 1049 | adding s/cpp.cpp |
|
1035 | 1050 | adding s/foobar.orig |
|
1036 | 1051 | adding s/snake.python |
|
1037 | 1052 | $ hg st --subrepos s |
|
1038 | 1053 | A s/barfoo |
|
1039 | 1054 | A s/c.c |
|
1040 | 1055 | A s/cpp.cpp |
|
1041 | 1056 | A s/foobar.orig |
|
1042 | 1057 | A s/snake.python |
|
1043 | 1058 | $ hg revert s |
|
1044 | 1059 | reverting subrepo ../gitroot |
|
1045 | 1060 | make sure everything is reverted correctly |
|
1046 | 1061 | $ hg st --subrepos s |
|
1047 | 1062 | ? s/barfoo |
|
1048 | 1063 | ? s/c.c |
|
1049 | 1064 | ? s/cpp.cpp |
|
1050 | 1065 | ? s/foobar.orig |
|
1051 | 1066 | ? s/snake.python |
|
1052 | 1067 | |
|
1053 | 1068 | $ hg add --subrepos --exclude "path:s/c.c" |
|
1054 | 1069 | adding s/barfoo |
|
1055 | 1070 | adding s/cpp.cpp |
|
1056 | 1071 | adding s/foobar.orig |
|
1057 | 1072 | adding s/snake.python |
|
1058 | 1073 | $ hg st --subrepos s |
|
1059 | 1074 | A s/barfoo |
|
1060 | 1075 | A s/cpp.cpp |
|
1061 | 1076 | A s/foobar.orig |
|
1062 | 1077 | A s/snake.python |
|
1063 | 1078 | ? s/c.c |
|
1064 | 1079 | $ hg revert --all -q |
|
1065 | 1080 | |
|
1066 | 1081 | .hgignore should not have influence in subrepos |
|
1067 | 1082 | $ cat > .hgignore << EOF |
|
1068 | 1083 | > syntax: glob |
|
1069 | 1084 | > *.python |
|
1070 | 1085 | > EOF |
|
1071 | 1086 | $ hg add .hgignore |
|
1072 | 1087 | $ hg add --subrepos "glob:**.python" s/barfoo |
|
1073 | 1088 | adding s/snake.python |
|
1074 | 1089 | $ hg st --subrepos s |
|
1075 | 1090 | A s/barfoo |
|
1076 | 1091 | A s/snake.python |
|
1077 | 1092 | ? s/c.c |
|
1078 | 1093 | ? s/cpp.cpp |
|
1079 | 1094 | ? s/foobar.orig |
|
1080 | 1095 | $ hg revert --all -q |
|
1081 | 1096 | |
|
1082 | 1097 | .gitignore should have influence, |
|
1083 | 1098 | except for explicitly added files (no patterns) |
|
1084 | 1099 | $ cat > s/.gitignore << EOF |
|
1085 | 1100 | > *.python |
|
1086 | 1101 | > EOF |
|
1087 | 1102 | $ hg add s/.gitignore |
|
1088 | 1103 | $ hg st --subrepos s |
|
1089 | 1104 | A s/.gitignore |
|
1090 | 1105 | ? s/barfoo |
|
1091 | 1106 | ? s/c.c |
|
1092 | 1107 | ? s/cpp.cpp |
|
1093 | 1108 | ? s/foobar.orig |
|
1094 | 1109 | $ hg st --subrepos s --all |
|
1095 | 1110 | A s/.gitignore |
|
1096 | 1111 | ? s/barfoo |
|
1097 | 1112 | ? s/c.c |
|
1098 | 1113 | ? s/cpp.cpp |
|
1099 | 1114 | ? s/foobar.orig |
|
1100 | 1115 | I s/snake.python |
|
1101 | 1116 | C s/f |
|
1102 | 1117 | C s/foobar |
|
1103 | 1118 | C s/g |
|
1104 | 1119 | $ hg add --subrepos "glob:**.python" |
|
1105 | 1120 | $ hg st --subrepos s |
|
1106 | 1121 | A s/.gitignore |
|
1107 | 1122 | ? s/barfoo |
|
1108 | 1123 | ? s/c.c |
|
1109 | 1124 | ? s/cpp.cpp |
|
1110 | 1125 | ? s/foobar.orig |
|
1111 | 1126 | $ hg add --subrepos s/snake.python |
|
1112 | 1127 | $ hg st --subrepos s |
|
1113 | 1128 | A s/.gitignore |
|
1114 | 1129 | A s/snake.python |
|
1115 | 1130 | ? s/barfoo |
|
1116 | 1131 | ? s/c.c |
|
1117 | 1132 | ? s/cpp.cpp |
|
1118 | 1133 | ? s/foobar.orig |
|
1119 | 1134 | |
|
1120 | 1135 | correctly do a dry run |
|
1121 | 1136 | $ hg add --subrepos s --dry-run |
|
1122 | 1137 | adding s/barfoo |
|
1123 | 1138 | adding s/c.c |
|
1124 | 1139 | adding s/cpp.cpp |
|
1125 | 1140 | adding s/foobar.orig |
|
1126 | 1141 | $ hg st --subrepos s |
|
1127 | 1142 | A s/.gitignore |
|
1128 | 1143 | A s/snake.python |
|
1129 | 1144 | ? s/barfoo |
|
1130 | 1145 | ? s/c.c |
|
1131 | 1146 | ? s/cpp.cpp |
|
1132 | 1147 | ? s/foobar.orig |
|
1133 | 1148 | |
|
1134 | 1149 | error given when adding an already tracked file |
|
1135 | 1150 | $ hg add s/.gitignore |
|
1136 | 1151 | s/.gitignore already tracked! |
|
1137 | 1152 | [1] |
|
1138 | 1153 | $ hg add s/g |
|
1139 | 1154 | s/g already tracked! |
|
1140 | 1155 | [1] |
|
1141 | 1156 | |
|
1142 | 1157 | removed files can be re-added |
|
1143 | 1158 | removing files using 'rm' or 'git rm' has the same effect, |
|
1144 | 1159 | since we ignore the staging area |
|
1145 | 1160 | $ hg ci --subrepos -m 'snake' |
|
1146 | 1161 | committing subrepository s |
|
1147 | 1162 | $ cd s |
|
1148 | 1163 | $ rm snake.python |
|
1149 | 1164 | (remove leftover .hg so Mercurial doesn't look for a root here) |
|
1150 | 1165 | $ rm -rf .hg |
|
1151 | 1166 | $ hg status --subrepos --all . |
|
1152 | 1167 | R snake.python |
|
1153 | 1168 | ? barfoo |
|
1154 | 1169 | ? c.c |
|
1155 | 1170 | ? cpp.cpp |
|
1156 | 1171 | ? foobar.orig |
|
1157 | 1172 | C .gitignore |
|
1158 | 1173 | C f |
|
1159 | 1174 | C foobar |
|
1160 | 1175 | C g |
|
1161 | 1176 | $ git rm snake.python |
|
1162 | 1177 | rm 'snake.python' |
|
1163 | 1178 | $ hg status --subrepos --all . |
|
1164 | 1179 | R snake.python |
|
1165 | 1180 | ? barfoo |
|
1166 | 1181 | ? c.c |
|
1167 | 1182 | ? cpp.cpp |
|
1168 | 1183 | ? foobar.orig |
|
1169 | 1184 | C .gitignore |
|
1170 | 1185 | C f |
|
1171 | 1186 | C foobar |
|
1172 | 1187 | C g |
|
1173 | 1188 | $ touch snake.python |
|
1174 | 1189 | $ cd .. |
|
1175 | 1190 | $ hg add s/snake.python |
|
1176 | 1191 | $ hg status -S |
|
1177 | 1192 | M s/snake.python |
|
1178 | 1193 | ? .hgignore |
|
1179 | 1194 | ? s/barfoo |
|
1180 | 1195 | ? s/c.c |
|
1181 | 1196 | ? s/cpp.cpp |
|
1182 | 1197 | ? s/foobar.orig |
|
1183 | 1198 | $ hg revert --all -q |
|
1184 | 1199 | |
|
1185 | 1200 | make sure we show changed files, rather than changed subtrees |
|
1186 | 1201 | $ mkdir s/foo |
|
1187 | 1202 | $ touch s/foo/bwuh |
|
1188 | 1203 | $ hg add s/foo/bwuh |
|
1189 | 1204 | $ hg commit -S -m "add bwuh" |
|
1190 | 1205 | committing subrepository s |
|
1191 | 1206 | $ hg status -S --change . |
|
1192 | 1207 | M .hgsubstate |
|
1193 | 1208 | A s/foo/bwuh |
|
1194 | 1209 | ? s/barfoo |
|
1195 | 1210 | ? s/c.c |
|
1196 | 1211 | ? s/cpp.cpp |
|
1197 | 1212 | ? s/foobar.orig |
|
1198 | 1213 | ? s/snake.python.orig |
|
1199 | 1214 | |
|
1200 | 1215 | #if git19 |
|
1201 | 1216 | |
|
1202 | 1217 | test for Git CVE-2016-3068 |
|
1203 | 1218 | $ hg init malicious-subrepository |
|
1204 | 1219 | $ cd malicious-subrepository |
|
1205 | 1220 | $ echo "s = [git]ext::sh -c echo% pwned:% \$PWNED_MSG% >pwned.txt" > .hgsub |
|
1206 | 1221 | $ git init s |
|
1207 | 1222 | Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/ |
|
1208 | 1223 | $ cd s |
|
1209 | 1224 | $ git commit --allow-empty -m 'empty' |
|
1210 | 1225 | [master (root-commit) 153f934] empty |
|
1211 | 1226 | $ cd .. |
|
1212 | 1227 | $ hg add .hgsub |
|
1213 | 1228 | $ hg commit -m "add subrepo" |
|
1214 | 1229 | $ cd .. |
|
1215 | 1230 | $ rm -f pwned.txt |
|
1216 | 1231 | $ unset GIT_ALLOW_PROTOCOL |
|
1217 | 1232 | $ PWNED_MSG="your git is too old or mercurial has regressed" hg clone \ |
|
1218 | 1233 | > malicious-subrepository malicious-subrepository-protected |
|
1219 | 1234 | Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... |
|
1220 | 1235 | fatal: transport 'ext' not allowed |
|
1221 | 1236 | updating to branch default |
|
1222 | 1237 | cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt |
|
1223 | 1238 | abort: git clone error 128 in s (in subrepository "s") |
|
1224 | 1239 | [255] |
|
1225 | 1240 | $ f -Dq pwned.txt |
|
1226 | 1241 | pwned.txt: file not found |
|
1227 | 1242 | |
|
1228 | 1243 | whitelisting of ext should be respected (that's the git submodule behaviour) |
|
1229 | 1244 | $ rm -f pwned.txt |
|
1230 | 1245 | $ env GIT_ALLOW_PROTOCOL=ext PWNED_MSG="you asked for it" hg clone \ |
|
1231 | 1246 | > malicious-subrepository malicious-subrepository-clone-allowed |
|
1232 | 1247 | Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... |
|
1233 | 1248 | fatal: Could not read from remote repository. |
|
1234 | 1249 | |
|
1235 | 1250 | Please make sure you have the correct access rights |
|
1236 | 1251 | and the repository exists. |
|
1237 | 1252 | updating to branch default |
|
1238 | 1253 | cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt |
|
1239 | 1254 | abort: git clone error 128 in s (in subrepository "s") |
|
1240 | 1255 | [255] |
|
1241 | 1256 | $ f -Dq pwned.txt |
|
1242 | 1257 | pwned: you asked for it |
|
1243 | 1258 | |
|
1244 | 1259 | #endif |
|
1245 | 1260 | |
|
1246 | 1261 | test for ssh exploit with git subrepos 2017-07-25 |
|
1247 | 1262 | |
|
1248 | 1263 | $ hg init malicious-proxycommand |
|
1249 | 1264 | $ cd malicious-proxycommand |
|
1250 | 1265 | $ echo 's = [git]ssh://-oProxyCommand=rm${IFS}non-existent/path' > .hgsub |
|
1251 | 1266 | $ git init s |
|
1252 | 1267 | Initialized empty Git repository in $TESTTMP/tc/malicious-proxycommand/s/.git/ |
|
1253 | 1268 | $ cd s |
|
1254 | 1269 | $ git commit --allow-empty -m 'empty' |
|
1255 | 1270 | [master (root-commit) 153f934] empty |
|
1256 | 1271 | $ cd .. |
|
1257 | 1272 | $ hg add .hgsub |
|
1258 | 1273 | $ hg ci -m 'add subrepo' |
|
1259 | 1274 | $ cd .. |
|
1260 | 1275 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1261 | 1276 | updating to branch default |
|
1262 | 1277 | abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s") |
|
1263 | 1278 | [255] |
|
1264 | 1279 | |
|
1265 | 1280 | also check that a percent encoded '-' (%2D) doesn't work |
|
1266 | 1281 | |
|
1267 | 1282 | $ cd malicious-proxycommand |
|
1268 | 1283 | $ echo 's = [git]ssh://%2DoProxyCommand=rm${IFS}non-existent/path' > .hgsub |
|
1269 | 1284 | $ hg ci -m 'change url to percent encoded' |
|
1270 | 1285 | $ cd .. |
|
1271 | 1286 | $ rm -r malicious-proxycommand-clone |
|
1272 | 1287 | $ hg clone malicious-proxycommand malicious-proxycommand-clone |
|
1273 | 1288 | updating to branch default |
|
1274 | 1289 | abort: potentially unsafe url: 'ssh://-oProxyCommand=rm${IFS}non-existent/path' (in subrepository "s") |
|
1275 | 1290 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now