##// END OF EJS Templates
subrepo: demonstrate broken `hg files` with ui.relative-paths=no...
Martin von Zweigbergk -
r41913:31b84c72 default
parent child Browse files
Show More
@@ -1,1989 +1,1996 b''
1 1 Let commit recurse into subrepos by default to match pre-2.0 behavior:
2 2
3 3 $ echo "[ui]" >> $HGRCPATH
4 4 $ echo "commitsubrepos = Yes" >> $HGRCPATH
5 5
6 6 $ hg init t
7 7 $ cd t
8 8
9 9 first revision, no sub
10 10
11 11 $ echo a > a
12 12 $ hg ci -Am0
13 13 adding a
14 14
15 15 add first sub
16 16
17 17 $ echo s = s > .hgsub
18 18 $ hg add .hgsub
19 19 $ hg init s
20 20 $ echo a > s/a
21 21
22 22 Issue2232: committing a subrepo without .hgsub
23 23
24 24 $ hg ci -mbad s
25 25 abort: can't commit subrepos without .hgsub
26 26 [255]
27 27
28 28 $ hg -R s add s/a
29 29 $ hg files -S
30 30 .hgsub
31 31 a
32 32 s/a
33 33
34 `hg files` respects ui.relative-paths
35 BROKEN: shows subrepo paths relative to the subrepo
36 $ hg files -S --config ui.relative-paths=no
37 .hgsub
38 a
39 a
40
34 41 $ hg -R s ci -Ams0
35 42 $ hg sum
36 43 parent: 0:f7b1eb17ad24 tip
37 44 0
38 45 branch: default
39 46 commit: 1 added, 1 subrepos
40 47 update: (current)
41 48 phases: 1 draft
42 49 $ hg ci -m1
43 50
44 51 test handling .hgsubstate "added" explicitly.
45 52
46 53 $ hg parents --template '{node}\n{files}\n'
47 54 7cf8cfea66e410e8e3336508dfeec07b3192de51
48 55 .hgsub .hgsubstate
49 56 $ hg rollback -q
50 57 $ hg add .hgsubstate
51 58 $ hg ci -m1
52 59 $ hg parents --template '{node}\n{files}\n'
53 60 7cf8cfea66e410e8e3336508dfeec07b3192de51
54 61 .hgsub .hgsubstate
55 62
56 63 Subrepopath which overlaps with filepath, does not change warnings in remove()
57 64
58 65 $ mkdir snot
59 66 $ touch snot/file
60 67 $ hg remove -S snot/file
61 68 not removing snot/file: file is untracked
62 69 [1]
63 70 $ hg cat snot/filenot
64 71 snot/filenot: no such file in rev 7cf8cfea66e4
65 72 [1]
66 73 $ rm -r snot
67 74
68 75 Revert subrepo and test subrepo fileset keyword:
69 76
70 77 $ echo b > s/a
71 78 $ hg revert --dry-run "set:subrepo('glob:s*')"
72 79 reverting subrepo s
73 80 reverting s/a
74 81 $ cat s/a
75 82 b
76 83 $ hg revert "set:subrepo('glob:s*')"
77 84 reverting subrepo s
78 85 reverting s/a
79 86 $ cat s/a
80 87 a
81 88 $ rm s/a.orig
82 89
83 90 Revert subrepo with no backup. The "reverting s/a" line is gone since
84 91 we're really running 'hg update' in the subrepo:
85 92
86 93 $ echo b > s/a
87 94 $ hg revert --no-backup s
88 95 reverting subrepo s
89 96
90 97 Issue2022: update -C
91 98
92 99 $ echo b > s/a
93 100 $ hg sum
94 101 parent: 1:7cf8cfea66e4 tip
95 102 1
96 103 branch: default
97 104 commit: 1 subrepos
98 105 update: (current)
99 106 phases: 2 draft
100 107 $ hg co -C 1
101 108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 109 $ hg sum
103 110 parent: 1:7cf8cfea66e4 tip
104 111 1
105 112 branch: default
106 113 commit: (clean)
107 114 update: (current)
108 115 phases: 2 draft
109 116
110 117 commands that require a clean repo should respect subrepos
111 118
112 119 $ echo b >> s/a
113 120 $ hg backout tip
114 121 abort: uncommitted changes in subrepository "s"
115 122 [255]
116 123 $ hg revert -C -R s s/a
117 124
118 125 add sub sub
119 126
120 127 $ echo ss = ss > s/.hgsub
121 128 $ hg init s/ss
122 129 $ echo a > s/ss/a
123 130 $ hg -R s add s/.hgsub
124 131 $ hg -R s/ss add s/ss/a
125 132 $ hg sum
126 133 parent: 1:7cf8cfea66e4 tip
127 134 1
128 135 branch: default
129 136 commit: 1 subrepos
130 137 update: (current)
131 138 phases: 2 draft
132 139 $ hg ci -m2
133 140 committing subrepository s
134 141 committing subrepository s/ss
135 142 $ hg sum
136 143 parent: 2:df30734270ae tip
137 144 2
138 145 branch: default
139 146 commit: (clean)
140 147 update: (current)
141 148 phases: 3 draft
142 149
143 150 test handling .hgsubstate "modified" explicitly.
144 151
145 152 $ hg parents --template '{node}\n{files}\n'
146 153 df30734270ae757feb35e643b7018e818e78a9aa
147 154 .hgsubstate
148 155 $ hg rollback -q
149 156 $ hg status -A .hgsubstate
150 157 M .hgsubstate
151 158 $ hg ci -m2
152 159 $ hg parents --template '{node}\n{files}\n'
153 160 df30734270ae757feb35e643b7018e818e78a9aa
154 161 .hgsubstate
155 162
156 163 bump sub rev (and check it is ignored by ui.commitsubrepos)
157 164
158 165 $ echo b > s/a
159 166 $ hg -R s ci -ms1
160 167 $ hg --config ui.commitsubrepos=no ci -m3
161 168
162 169 leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
163 170
164 171 $ echo c > s/a
165 172 $ hg --config ui.commitsubrepos=no ci -m4
166 173 abort: uncommitted changes in subrepository "s"
167 174 (use --subrepos for recursive commit)
168 175 [255]
169 176 $ hg id
170 177 f6affe3fbfaa+ tip
171 178 $ hg -R s ci -mc
172 179 $ hg id
173 180 f6affe3fbfaa+ tip
174 181 $ echo d > s/a
175 182 $ hg ci -m4
176 183 committing subrepository s
177 184 $ hg tip -R s
178 185 changeset: 4:02dcf1d70411
179 186 tag: tip
180 187 user: test
181 188 date: Thu Jan 01 00:00:00 1970 +0000
182 189 summary: 4
183 190
184 191
185 192 check caching
186 193
187 194 $ hg co 0
188 195 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
189 196 $ hg debugsub
190 197
191 198 restore
192 199
193 200 $ hg co
194 201 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
195 202 $ hg debugsub
196 203 path s
197 204 source s
198 205 revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef
199 206
200 207 new branch for merge tests
201 208
202 209 $ hg co 1
203 210 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 211 $ echo t = t >> .hgsub
205 212 $ hg init t
206 213 $ echo t > t/t
207 214 $ hg -R t add t
208 215 adding t/t
209 216
210 217 5
211 218
212 219 $ hg ci -m5 # add sub
213 220 committing subrepository t
214 221 created new head
215 222 $ echo t2 > t/t
216 223
217 224 6
218 225
219 226 $ hg st -R s
220 227 $ hg ci -m6 # change sub
221 228 committing subrepository t
222 229 $ hg debugsub
223 230 path s
224 231 source s
225 232 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
226 233 path t
227 234 source t
228 235 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
229 236 $ echo t3 > t/t
230 237
231 238 7
232 239
233 240 $ hg ci -m7 # change sub again for conflict test
234 241 committing subrepository t
235 242 $ hg rm .hgsub
236 243
237 244 8
238 245
239 246 $ hg ci -m8 # remove sub
240 247
241 248 test handling .hgsubstate "removed" explicitly.
242 249
243 250 $ hg parents --template '{node}\n{files}\n'
244 251 96615c1dad2dc8e3796d7332c77ce69156f7b78e
245 252 .hgsub .hgsubstate
246 253 $ hg rollback -q
247 254 $ hg remove .hgsubstate
248 255 $ hg ci -m8
249 256 $ hg parents --template '{node}\n{files}\n'
250 257 96615c1dad2dc8e3796d7332c77ce69156f7b78e
251 258 .hgsub .hgsubstate
252 259
253 260 merge tests
254 261
255 262 $ hg co -C 3
256 263 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 264 $ hg merge 5 # test adding
258 265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
259 266 (branch merge, don't forget to commit)
260 267 $ hg debugsub
261 268 path s
262 269 source s
263 270 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
264 271 path t
265 272 source t
266 273 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
267 274 $ hg ci -m9
268 275 created new head
269 276 $ hg merge 6 --debug # test change
270 277 searching for copies back to rev 2
271 278 resolving manifests
272 279 branchmerge: True, force: False, partial: False
273 280 ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
274 281 starting 4 threads for background file closing (?)
275 282 .hgsubstate: versions differ -> m (premerge)
276 283 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
277 284 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
278 285 getting subrepo t
279 286 resolving manifests
280 287 branchmerge: False, force: False, partial: False
281 288 ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a
282 289 t: remote is newer -> g
283 290 getting t
284 291 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
285 292 (branch merge, don't forget to commit)
286 293 $ hg debugsub
287 294 path s
288 295 source s
289 296 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
290 297 path t
291 298 source t
292 299 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
293 300 $ echo conflict > t/t
294 301 $ hg ci -m10
295 302 committing subrepository t
296 303 $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
297 304 searching for copies back to rev 2
298 305 resolving manifests
299 306 branchmerge: True, force: False, partial: False
300 307 ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
301 308 starting 4 threads for background file closing (?)
302 309 .hgsubstate: versions differ -> m (premerge)
303 310 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
304 311 subrepo t: both sides changed
305 312 subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
306 313 starting 4 threads for background file closing (?)
307 314 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
308 315 merging subrepository "t"
309 316 searching for copies back to rev 2
310 317 resolving manifests
311 318 branchmerge: True, force: False, partial: False
312 319 ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
313 320 preserving t for resolve of t
314 321 starting 4 threads for background file closing (?)
315 322 t: versions differ -> m (premerge)
316 323 picked tool ':merge' for t (binary False symlink False changedelete False)
317 324 merging t
318 325 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
319 326 t: versions differ -> m (merge)
320 327 picked tool ':merge' for t (binary False symlink False changedelete False)
321 328 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
322 329 warning: conflicts while merging t! (edit, then use 'hg resolve --mark')
323 330 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
324 331 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
325 332 subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
326 333 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
327 334 (branch merge, don't forget to commit)
328 335
329 336 should conflict
330 337
331 338 $ cat t/t
332 339 <<<<<<< local: 20a0db6fbf6c - test: 10
333 340 conflict
334 341 =======
335 342 t3
336 343 >>>>>>> other: 7af322bc1198 - test: 7
337 344
338 345 11: remove subrepo t
339 346
340 347 $ hg co -C 5
341 348 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 349 $ hg revert -r 4 .hgsub # remove t
343 350 $ hg ci -m11
344 351 created new head
345 352 $ hg debugsub
346 353 path s
347 354 source s
348 355 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
349 356
350 357 local removed, remote changed, keep changed
351 358
352 359 $ hg merge 6
353 360 remote [merge rev] changed subrepository t which local [working copy] removed
354 361 use (c)hanged version or (d)elete? c
355 362 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
356 363 (branch merge, don't forget to commit)
357 364 BROKEN: should include subrepo t
358 365 $ hg debugsub
359 366 path s
360 367 source s
361 368 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
362 369 $ cat .hgsubstate
363 370 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
364 371 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t
365 372 $ hg ci -m 'local removed, remote changed, keep changed'
366 373 BROKEN: should include subrepo t
367 374 $ hg debugsub
368 375 path s
369 376 source s
370 377 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
371 378 BROKEN: should include subrepo t
372 379 $ cat .hgsubstate
373 380 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
374 381 $ cat t/t
375 382 t2
376 383
377 384 local removed, remote changed, keep removed
378 385
379 386 $ hg co -C 11
380 387 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
381 388 $ hg merge --config ui.interactive=true 6 <<EOF
382 389 > d
383 390 > EOF
384 391 remote [merge rev] changed subrepository t which local [working copy] removed
385 392 use (c)hanged version or (d)elete? d
386 393 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
387 394 (branch merge, don't forget to commit)
388 395 $ hg debugsub
389 396 path s
390 397 source s
391 398 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
392 399 $ cat .hgsubstate
393 400 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
394 401 $ hg ci -m 'local removed, remote changed, keep removed'
395 402 created new head
396 403 $ hg debugsub
397 404 path s
398 405 source s
399 406 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
400 407 $ cat .hgsubstate
401 408 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
402 409
403 410 local changed, remote removed, keep changed
404 411
405 412 $ hg co -C 6
406 413 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 414 $ hg merge 11
408 415 local [working copy] changed subrepository t which remote [merge rev] removed
409 416 use (c)hanged version or (d)elete? c
410 417 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
411 418 (branch merge, don't forget to commit)
412 419 BROKEN: should include subrepo t
413 420 $ hg debugsub
414 421 path s
415 422 source s
416 423 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
417 424 BROKEN: should include subrepo t
418 425 $ cat .hgsubstate
419 426 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
420 427 $ hg ci -m 'local changed, remote removed, keep changed'
421 428 created new head
422 429 BROKEN: should include subrepo t
423 430 $ hg debugsub
424 431 path s
425 432 source s
426 433 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
427 434 BROKEN: should include subrepo t
428 435 $ cat .hgsubstate
429 436 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
430 437 $ cat t/t
431 438 t2
432 439
433 440 local changed, remote removed, keep removed
434 441
435 442 $ hg co -C 6
436 443 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
437 444 $ hg merge --config ui.interactive=true 11 <<EOF
438 445 > d
439 446 > EOF
440 447 local [working copy] changed subrepository t which remote [merge rev] removed
441 448 use (c)hanged version or (d)elete? d
442 449 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
443 450 (branch merge, don't forget to commit)
444 451 $ hg debugsub
445 452 path s
446 453 source s
447 454 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
448 455 $ cat .hgsubstate
449 456 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
450 457 $ hg ci -m 'local changed, remote removed, keep removed'
451 458 created new head
452 459 $ hg debugsub
453 460 path s
454 461 source s
455 462 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
456 463 $ cat .hgsubstate
457 464 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
458 465
459 466 clean up to avoid having to fix up the tests below
460 467
461 468 $ hg co -C 10
462 469 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
463 470 $ cat >> $HGRCPATH <<EOF
464 471 > [extensions]
465 472 > strip=
466 473 > EOF
467 474 $ hg strip -r 11:15
468 475 saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob)
469 476
470 477 clone
471 478
472 479 $ cd ..
473 480 $ hg clone t tc
474 481 updating to branch default
475 482 cloning subrepo s from $TESTTMP/t/s
476 483 cloning subrepo s/ss from $TESTTMP/t/s/ss
477 484 cloning subrepo t from $TESTTMP/t/t
478 485 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
479 486 $ cd tc
480 487 $ hg debugsub
481 488 path s
482 489 source s
483 490 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
484 491 path t
485 492 source t
486 493 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
487 494 $ cd ..
488 495
489 496 clone with subrepo disabled (update should fail)
490 497
491 498 $ hg clone t -U tc2 --config subrepos.allowed=false
492 499 $ hg update -R tc2 --config subrepos.allowed=false
493 500 abort: subrepos not enabled
494 501 (see 'hg help config.subrepos' for details)
495 502 [255]
496 503 $ ls tc2
497 504 a
498 505
499 506 $ hg clone t tc3 --config subrepos.allowed=false
500 507 updating to branch default
501 508 abort: subrepos not enabled
502 509 (see 'hg help config.subrepos' for details)
503 510 [255]
504 511 $ ls tc3
505 512 a
506 513
507 514 And again with just the hg type disabled
508 515
509 516 $ hg clone t -U tc4 --config subrepos.hg:allowed=false
510 517 $ hg update -R tc4 --config subrepos.hg:allowed=false
511 518 abort: hg subrepos not allowed
512 519 (see 'hg help config.subrepos' for details)
513 520 [255]
514 521 $ ls tc4
515 522 a
516 523
517 524 $ hg clone t tc5 --config subrepos.hg:allowed=false
518 525 updating to branch default
519 526 abort: hg subrepos not allowed
520 527 (see 'hg help config.subrepos' for details)
521 528 [255]
522 529 $ ls tc5
523 530 a
524 531
525 532 push
526 533
527 534 $ cd tc
528 535 $ echo bah > t/t
529 536 $ hg ci -m11
530 537 committing subrepository t
531 538 $ hg push
532 539 pushing to $TESTTMP/t
533 540 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
534 541 no changes made to subrepo s since last push to $TESTTMP/t/s
535 542 pushing subrepo t to $TESTTMP/t/t
536 543 searching for changes
537 544 adding changesets
538 545 adding manifests
539 546 adding file changes
540 547 added 1 changesets with 1 changes to 1 files
541 548 searching for changes
542 549 adding changesets
543 550 adding manifests
544 551 adding file changes
545 552 added 1 changesets with 1 changes to 1 files
546 553
547 554 push -f
548 555
549 556 $ echo bah > s/a
550 557 $ hg ci -m12
551 558 committing subrepository s
552 559 $ hg push
553 560 pushing to $TESTTMP/t
554 561 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
555 562 pushing subrepo s to $TESTTMP/t/s
556 563 searching for changes
557 564 abort: push creates new remote head 12a213df6fa9! (in subrepository "s")
558 565 (merge or see 'hg help push' for details about pushing new heads)
559 566 [255]
560 567 $ hg push -f
561 568 pushing to $TESTTMP/t
562 569 pushing subrepo s/ss to $TESTTMP/t/s/ss
563 570 searching for changes
564 571 no changes found
565 572 pushing subrepo s to $TESTTMP/t/s
566 573 searching for changes
567 574 adding changesets
568 575 adding manifests
569 576 adding file changes
570 577 added 1 changesets with 1 changes to 1 files (+1 heads)
571 578 pushing subrepo t to $TESTTMP/t/t
572 579 searching for changes
573 580 no changes found
574 581 searching for changes
575 582 adding changesets
576 583 adding manifests
577 584 adding file changes
578 585 added 1 changesets with 1 changes to 1 files
579 586
580 587 check that unmodified subrepos are not pushed
581 588
582 589 $ hg clone . ../tcc
583 590 updating to branch default
584 591 cloning subrepo s from $TESTTMP/tc/s
585 592 cloning subrepo s/ss from $TESTTMP/tc/s/ss
586 593 cloning subrepo t from $TESTTMP/tc/t
587 594 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
588 595
589 596 the subrepos on the new clone have nothing to push to its source
590 597
591 598 $ hg push -R ../tcc .
592 599 pushing to .
593 600 no changes made to subrepo s/ss since last push to s/ss
594 601 no changes made to subrepo s since last push to s
595 602 no changes made to subrepo t since last push to t
596 603 searching for changes
597 604 no changes found
598 605 [1]
599 606
600 607 the subrepos on the source do not have a clean store versus the clone target
601 608 because they were never explicitly pushed to the source
602 609
603 610 $ hg push ../tcc
604 611 pushing to ../tcc
605 612 pushing subrepo s/ss to ../tcc/s/ss
606 613 searching for changes
607 614 no changes found
608 615 pushing subrepo s to ../tcc/s
609 616 searching for changes
610 617 no changes found
611 618 pushing subrepo t to ../tcc/t
612 619 searching for changes
613 620 no changes found
614 621 searching for changes
615 622 no changes found
616 623 [1]
617 624
618 625 after push their stores become clean
619 626
620 627 $ hg push ../tcc
621 628 pushing to ../tcc
622 629 no changes made to subrepo s/ss since last push to ../tcc/s/ss
623 630 no changes made to subrepo s since last push to ../tcc/s
624 631 no changes made to subrepo t since last push to ../tcc/t
625 632 searching for changes
626 633 no changes found
627 634 [1]
628 635
629 636 updating a subrepo to a different revision or changing
630 637 its working directory does not make its store dirty
631 638
632 639 $ hg -R s update '.^'
633 640 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
634 641 $ hg push
635 642 pushing to $TESTTMP/t
636 643 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
637 644 no changes made to subrepo s since last push to $TESTTMP/t/s
638 645 no changes made to subrepo t since last push to $TESTTMP/t/t
639 646 searching for changes
640 647 no changes found
641 648 [1]
642 649 $ echo foo >> s/a
643 650 $ hg push
644 651 pushing to $TESTTMP/t
645 652 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
646 653 no changes made to subrepo s since last push to $TESTTMP/t/s
647 654 no changes made to subrepo t since last push to $TESTTMP/t/t
648 655 searching for changes
649 656 no changes found
650 657 [1]
651 658 $ hg -R s update -C tip
652 659 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
653 660
654 661 committing into a subrepo makes its store (but not its parent's store) dirty
655 662
656 663 $ echo foo >> s/ss/a
657 664 $ hg -R s/ss commit -m 'test dirty store detection'
658 665
659 666 $ hg out -S -r `hg log -r tip -T "{node|short}"`
660 667 comparing with $TESTTMP/t
661 668 searching for changes
662 669 no changes found
663 670 comparing with $TESTTMP/t/s
664 671 searching for changes
665 672 no changes found
666 673 comparing with $TESTTMP/t/s/ss
667 674 searching for changes
668 675 changeset: 1:79ea5566a333
669 676 tag: tip
670 677 user: test
671 678 date: Thu Jan 01 00:00:00 1970 +0000
672 679 summary: test dirty store detection
673 680
674 681 comparing with $TESTTMP/t/t
675 682 searching for changes
676 683 no changes found
677 684
678 685 $ hg push
679 686 pushing to $TESTTMP/t
680 687 pushing subrepo s/ss to $TESTTMP/t/s/ss
681 688 searching for changes
682 689 adding changesets
683 690 adding manifests
684 691 adding file changes
685 692 added 1 changesets with 1 changes to 1 files
686 693 no changes made to subrepo s since last push to $TESTTMP/t/s
687 694 no changes made to subrepo t since last push to $TESTTMP/t/t
688 695 searching for changes
689 696 no changes found
690 697 [1]
691 698
692 699 a subrepo store may be clean versus one repo but not versus another
693 700
694 701 $ hg push
695 702 pushing to $TESTTMP/t
696 703 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
697 704 no changes made to subrepo s since last push to $TESTTMP/t/s
698 705 no changes made to subrepo t since last push to $TESTTMP/t/t
699 706 searching for changes
700 707 no changes found
701 708 [1]
702 709 $ hg push ../tcc
703 710 pushing to ../tcc
704 711 pushing subrepo s/ss to ../tcc/s/ss
705 712 searching for changes
706 713 adding changesets
707 714 adding manifests
708 715 adding file changes
709 716 added 1 changesets with 1 changes to 1 files
710 717 no changes made to subrepo s since last push to ../tcc/s
711 718 no changes made to subrepo t since last push to ../tcc/t
712 719 searching for changes
713 720 no changes found
714 721 [1]
715 722
716 723 update
717 724
718 725 $ cd ../t
719 726 $ hg up -C # discard our earlier merge
720 727 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
721 728 updated to "c373c8102e68: 12"
722 729 2 other heads for branch "default"
723 730 $ echo blah > t/t
724 731 $ hg ci -m13
725 732 committing subrepository t
726 733
727 734 backout calls revert internally with minimal opts, which should not raise
728 735 KeyError
729 736
730 737 $ hg backout ".^" --no-commit
731 738 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
732 739 changeset c373c8102e68 backed out, don't forget to commit.
733 740
734 741 $ hg up -C # discard changes
735 742 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
736 743 updated to "925c17564ef8: 13"
737 744 2 other heads for branch "default"
738 745
739 746 pull
740 747
741 748 $ cd ../tc
742 749 $ hg pull
743 750 pulling from $TESTTMP/t
744 751 searching for changes
745 752 adding changesets
746 753 adding manifests
747 754 adding file changes
748 755 added 1 changesets with 1 changes to 1 files
749 756 new changesets 925c17564ef8
750 757 (run 'hg update' to get a working copy)
751 758
752 759 should pull t
753 760
754 761 $ hg incoming -S -r `hg log -r tip -T "{node|short}"`
755 762 comparing with $TESTTMP/t
756 763 no changes found
757 764 comparing with $TESTTMP/t/s
758 765 searching for changes
759 766 no changes found
760 767 comparing with $TESTTMP/t/s/ss
761 768 searching for changes
762 769 no changes found
763 770 comparing with $TESTTMP/t/t
764 771 searching for changes
765 772 changeset: 5:52c0adc0515a
766 773 tag: tip
767 774 user: test
768 775 date: Thu Jan 01 00:00:00 1970 +0000
769 776 summary: 13
770 777
771 778
772 779 $ hg up
773 780 pulling subrepo t from $TESTTMP/t/t
774 781 searching for changes
775 782 adding changesets
776 783 adding manifests
777 784 adding file changes
778 785 added 1 changesets with 1 changes to 1 files
779 786 new changesets 52c0adc0515a
780 787 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
781 788 updated to "925c17564ef8: 13"
782 789 2 other heads for branch "default"
783 790 $ cat t/t
784 791 blah
785 792
786 793 bogus subrepo path aborts
787 794
788 795 $ echo 'bogus=[boguspath' >> .hgsub
789 796 $ hg ci -m 'bogus subrepo path'
790 797 abort: missing ] in subrepository source
791 798 [255]
792 799
793 800 Issue1986: merge aborts when trying to merge a subrepo that
794 801 shouldn't need merging
795 802
796 803 # subrepo layout
797 804 #
798 805 # o 5 br
799 806 # /|
800 807 # o | 4 default
801 808 # | |
802 809 # | o 3 br
803 810 # |/|
804 811 # o | 2 default
805 812 # | |
806 813 # | o 1 br
807 814 # |/
808 815 # o 0 default
809 816
810 817 $ cd ..
811 818 $ rm -rf sub
812 819 $ hg init main
813 820 $ cd main
814 821 $ hg init s
815 822 $ cd s
816 823 $ echo a > a
817 824 $ hg ci -Am1
818 825 adding a
819 826 $ hg branch br
820 827 marked working directory as branch br
821 828 (branches are permanent and global, did you want a bookmark?)
822 829 $ echo a >> a
823 830 $ hg ci -m1
824 831 $ hg up default
825 832 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
826 833 $ echo b > b
827 834 $ hg ci -Am1
828 835 adding b
829 836 $ hg up br
830 837 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
831 838 $ hg merge tip
832 839 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
833 840 (branch merge, don't forget to commit)
834 841 $ hg ci -m1
835 842 $ hg up 2
836 843 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
837 844 $ echo c > c
838 845 $ hg ci -Am1
839 846 adding c
840 847 $ hg up 3
841 848 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
842 849 $ hg merge 4
843 850 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
844 851 (branch merge, don't forget to commit)
845 852 $ hg ci -m1
846 853
847 854 # main repo layout:
848 855 #
849 856 # * <-- try to merge default into br again
850 857 # .`|
851 858 # . o 5 br --> substate = 5
852 859 # . |
853 860 # o | 4 default --> substate = 4
854 861 # | |
855 862 # | o 3 br --> substate = 2
856 863 # |/|
857 864 # o | 2 default --> substate = 2
858 865 # | |
859 866 # | o 1 br --> substate = 3
860 867 # |/
861 868 # o 0 default --> substate = 2
862 869
863 870 $ cd ..
864 871 $ echo 's = s' > .hgsub
865 872 $ hg -R s up 2
866 873 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
867 874 $ hg ci -Am1
868 875 adding .hgsub
869 876 $ hg branch br
870 877 marked working directory as branch br
871 878 (branches are permanent and global, did you want a bookmark?)
872 879 $ echo b > b
873 880 $ hg -R s up 3
874 881 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
875 882 $ hg ci -Am1
876 883 adding b
877 884 $ hg up default
878 885 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
879 886 $ echo c > c
880 887 $ hg ci -Am1
881 888 adding c
882 889 $ hg up 1
883 890 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
884 891 $ hg merge 2
885 892 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
886 893 (branch merge, don't forget to commit)
887 894 $ hg ci -m1
888 895 $ hg up 2
889 896 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
890 897 $ hg -R s up 4
891 898 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
892 899 $ echo d > d
893 900 $ hg ci -Am1
894 901 adding d
895 902 $ hg up 3
896 903 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
897 904 $ hg -R s up 5
898 905 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
899 906 $ echo e > e
900 907 $ hg ci -Am1
901 908 adding e
902 909
903 910 $ hg up 5
904 911 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
905 912 $ hg merge 4 # try to merge default into br again
906 913 subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88)
907 914 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
908 915 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
909 916 (branch merge, don't forget to commit)
910 917 $ cd ..
911 918
912 919 test subrepo delete from .hgsubstate
913 920
914 921 $ hg init testdelete
915 922 $ mkdir testdelete/nested testdelete/nested2
916 923 $ hg init testdelete/nested
917 924 $ hg init testdelete/nested2
918 925 $ echo test > testdelete/nested/foo
919 926 $ echo test > testdelete/nested2/foo
920 927 $ hg -R testdelete/nested add
921 928 adding testdelete/nested/foo
922 929 $ hg -R testdelete/nested2 add
923 930 adding testdelete/nested2/foo
924 931 $ hg -R testdelete/nested ci -m test
925 932 $ hg -R testdelete/nested2 ci -m test
926 933 $ echo nested = nested > testdelete/.hgsub
927 934 $ echo nested2 = nested2 >> testdelete/.hgsub
928 935 $ hg -R testdelete add
929 936 adding testdelete/.hgsub
930 937 $ hg -R testdelete ci -m "nested 1 & 2 added"
931 938 $ echo nested = nested > testdelete/.hgsub
932 939 $ hg -R testdelete ci -m "nested 2 deleted"
933 940 $ cat testdelete/.hgsubstate
934 941 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
935 942 $ hg -R testdelete remove testdelete/.hgsub
936 943 $ hg -R testdelete ci -m ".hgsub deleted"
937 944 $ cat testdelete/.hgsubstate
938 945 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
939 946
940 947 test repository cloning
941 948
942 949 $ mkdir mercurial mercurial2
943 950 $ hg init nested_absolute
944 951 $ echo test > nested_absolute/foo
945 952 $ hg -R nested_absolute add
946 953 adding nested_absolute/foo
947 954 $ hg -R nested_absolute ci -mtest
948 955 $ cd mercurial
949 956 $ hg init nested_relative
950 957 $ echo test2 > nested_relative/foo2
951 958 $ hg -R nested_relative add
952 959 adding nested_relative/foo2
953 960 $ hg -R nested_relative ci -mtest2
954 961 $ hg init main
955 962 $ echo "nested_relative = ../nested_relative" > main/.hgsub
956 963 $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
957 964 $ hg -R main add
958 965 adding main/.hgsub
959 966 $ hg -R main ci -m "add subrepos"
960 967 $ cd ..
961 968 $ hg clone mercurial/main mercurial2/main
962 969 updating to branch default
963 970 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
964 971 $ cat mercurial2/main/nested_absolute/.hg/hgrc \
965 972 > mercurial2/main/nested_relative/.hg/hgrc
966 973 [paths]
967 974 default = $TESTTMP/mercurial/nested_absolute
968 975 [paths]
969 976 default = $TESTTMP/mercurial/nested_relative
970 977 $ rm -rf mercurial mercurial2
971 978
972 979 Issue1977: multirepo push should fail if subrepo push fails
973 980
974 981 $ hg init repo
975 982 $ hg init repo/s
976 983 $ echo a > repo/s/a
977 984 $ hg -R repo/s ci -Am0
978 985 adding a
979 986 $ echo s = s > repo/.hgsub
980 987 $ hg -R repo ci -Am1
981 988 adding .hgsub
982 989 $ hg clone repo repo2
983 990 updating to branch default
984 991 cloning subrepo s from $TESTTMP/repo/s
985 992 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
986 993 $ hg -q -R repo2 pull -u
987 994 $ echo 1 > repo2/s/a
988 995 $ hg -R repo2/s ci -m2
989 996 $ hg -q -R repo2/s push
990 997 $ hg -R repo2/s up -C 0
991 998 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
992 999 $ echo 2 > repo2/s/b
993 1000 $ hg -R repo2/s ci -m3 -A
994 1001 adding b
995 1002 created new head
996 1003 $ hg -R repo2 ci -m3
997 1004 $ hg -q -R repo2 push
998 1005 abort: push creates new remote head cc505f09a8b2! (in subrepository "s")
999 1006 (merge or see 'hg help push' for details about pushing new heads)
1000 1007 [255]
1001 1008 $ hg -R repo update
1002 1009 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1003 1010
1004 1011 test if untracked file is not overwritten
1005 1012
1006 1013 (this also tests that updated .hgsubstate is treated as "modified",
1007 1014 when 'merge.update()' is aborted before 'merge.recordupdates()', even
1008 1015 if none of mode, size and timestamp of it isn't changed on the
1009 1016 filesystem (see also issue4583))
1010 1017
1011 1018 $ echo issue3276_ok > repo/s/b
1012 1019 $ hg -R repo2 push -f -q
1013 1020 $ touch -t 200001010000 repo/.hgsubstate
1014 1021
1015 1022 $ cat >> repo/.hg/hgrc <<EOF
1016 1023 > [fakedirstatewritetime]
1017 1024 > # emulate invoking dirstate.write() via repo.status()
1018 1025 > # at 2000-01-01 00:00
1019 1026 > fakenow = 200001010000
1020 1027 >
1021 1028 > [extensions]
1022 1029 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
1023 1030 > EOF
1024 1031 $ hg -R repo update
1025 1032 b: untracked file differs
1026 1033 abort: untracked files in working directory differ from files in requested revision (in subrepository "s")
1027 1034 [255]
1028 1035 $ cat >> repo/.hg/hgrc <<EOF
1029 1036 > [extensions]
1030 1037 > fakedirstatewritetime = !
1031 1038 > EOF
1032 1039
1033 1040 $ cat repo/s/b
1034 1041 issue3276_ok
1035 1042 $ rm repo/s/b
1036 1043 $ touch -t 200001010000 repo/.hgsubstate
1037 1044 $ hg -R repo revert --all
1038 1045 reverting repo/.hgsubstate
1039 1046 reverting subrepo s
1040 1047 $ hg -R repo update
1041 1048 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1042 1049 $ cat repo/s/b
1043 1050 2
1044 1051 $ rm -rf repo2 repo
1045 1052
1046 1053
1047 1054 Issue1852 subrepos with relative paths always push/pull relative to default
1048 1055
1049 1056 Prepare a repo with subrepo
1050 1057
1051 1058 $ hg init issue1852a
1052 1059 $ cd issue1852a
1053 1060 $ hg init sub/repo
1054 1061 $ echo test > sub/repo/foo
1055 1062 $ hg -R sub/repo add sub/repo/foo
1056 1063 $ echo sub/repo = sub/repo > .hgsub
1057 1064 $ hg add .hgsub
1058 1065 $ hg ci -mtest
1059 1066 committing subrepository sub/repo
1060 1067 $ echo test >> sub/repo/foo
1061 1068 $ hg ci -mtest
1062 1069 committing subrepository sub/repo
1063 1070 $ hg cat sub/repo/foo
1064 1071 test
1065 1072 test
1066 1073 $ hg cat sub/repo/foo -Tjson | sed 's|\\\\|/|g'
1067 1074 [
1068 1075 {
1069 1076 "data": "test\ntest\n",
1070 1077 "path": "foo"
1071 1078 }
1072 1079 ]
1073 1080
1074 1081 non-exact match:
1075 1082
1076 1083 $ hg cat -T '{path|relpath}\n' 'glob:**'
1077 1084 .hgsub
1078 1085 .hgsubstate
1079 1086 sub/repo/foo
1080 1087 $ hg cat -T '{path|relpath}\n' 're:^sub'
1081 1088 sub/repo/foo
1082 1089
1083 1090 missing subrepos in working directory:
1084 1091
1085 1092 $ mkdir -p tmp/sub/repo
1086 1093 $ hg cat -r 0 --output tmp/%p_p sub/repo/foo
1087 1094 $ cat tmp/sub/repo/foo_p
1088 1095 test
1089 1096 $ mv sub/repo sub_
1090 1097 $ hg cat sub/repo/baz
1091 1098 skipping missing subrepository: sub/repo
1092 1099 [1]
1093 1100 $ rm -rf sub/repo
1094 1101 $ mv sub_ sub/repo
1095 1102 $ cd ..
1096 1103
1097 1104 Create repo without default path, pull top repo, and see what happens on update
1098 1105
1099 1106 $ hg init issue1852b
1100 1107 $ hg -R issue1852b pull issue1852a
1101 1108 pulling from issue1852a
1102 1109 requesting all changes
1103 1110 adding changesets
1104 1111 adding manifests
1105 1112 adding file changes
1106 1113 added 2 changesets with 3 changes to 2 files
1107 1114 new changesets 19487b456929:be5eb94e7215
1108 1115 (run 'hg update' to get a working copy)
1109 1116 $ hg -R issue1852b update
1110 1117 abort: default path for subrepository not found (in subrepository "sub/repo")
1111 1118 [255]
1112 1119
1113 1120 Ensure a full traceback, not just the SubrepoAbort part
1114 1121
1115 1122 $ hg -R issue1852b update --traceback 2>&1 | grep 'raise error\.Abort'
1116 1123 raise error.Abort(_("default path for subrepository not found"))
1117 1124
1118 1125 Pull -u now doesn't help
1119 1126
1120 1127 $ hg -R issue1852b pull -u issue1852a
1121 1128 pulling from issue1852a
1122 1129 searching for changes
1123 1130 no changes found
1124 1131
1125 1132 Try the same, but with pull -u
1126 1133
1127 1134 $ hg init issue1852c
1128 1135 $ hg -R issue1852c pull -r0 -u issue1852a
1129 1136 pulling from issue1852a
1130 1137 adding changesets
1131 1138 adding manifests
1132 1139 adding file changes
1133 1140 added 1 changesets with 2 changes to 2 files
1134 1141 new changesets 19487b456929
1135 1142 cloning subrepo sub/repo from issue1852a/sub/repo
1136 1143 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1137 1144
1138 1145 Try to push from the other side
1139 1146
1140 1147 $ hg -R issue1852a push `pwd`/issue1852c
1141 1148 pushing to $TESTTMP/issue1852c
1142 1149 pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo
1143 1150 searching for changes
1144 1151 no changes found
1145 1152 searching for changes
1146 1153 adding changesets
1147 1154 adding manifests
1148 1155 adding file changes
1149 1156 added 1 changesets with 1 changes to 1 files
1150 1157
1151 1158 Incoming and outgoing should not use the default path:
1152 1159
1153 1160 $ hg clone -q issue1852a issue1852d
1154 1161 $ hg -R issue1852d outgoing --subrepos issue1852c
1155 1162 comparing with issue1852c
1156 1163 searching for changes
1157 1164 no changes found
1158 1165 comparing with issue1852c/sub/repo
1159 1166 searching for changes
1160 1167 no changes found
1161 1168 [1]
1162 1169 $ hg -R issue1852d incoming --subrepos issue1852c
1163 1170 comparing with issue1852c
1164 1171 searching for changes
1165 1172 no changes found
1166 1173 comparing with issue1852c/sub/repo
1167 1174 searching for changes
1168 1175 no changes found
1169 1176 [1]
1170 1177
1171 1178 Check that merge of a new subrepo doesn't write the uncommitted state to
1172 1179 .hgsubstate (issue4622)
1173 1180
1174 1181 $ hg init issue1852a/addedsub
1175 1182 $ echo zzz > issue1852a/addedsub/zz.txt
1176 1183 $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ"
1177 1184
1178 1185 $ hg clone issue1852a/addedsub issue1852d/addedsub
1179 1186 updating to branch default
1180 1187 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1181 1188
1182 1189 $ echo def > issue1852a/sub/repo/foo
1183 1190 $ hg -R issue1852a ci -SAm 'tweaked subrepo'
1184 1191 adding tmp/sub/repo/foo_p
1185 1192 committing subrepository sub/repo
1186 1193
1187 1194 $ echo 'addedsub = addedsub' >> issue1852d/.hgsub
1188 1195 $ echo xyz > issue1852d/sub/repo/foo
1189 1196 $ hg -R issue1852d pull -u
1190 1197 pulling from $TESTTMP/issue1852a
1191 1198 searching for changes
1192 1199 adding changesets
1193 1200 adding manifests
1194 1201 adding file changes
1195 1202 added 1 changesets with 2 changes to 2 files
1196 1203 new changesets c82b79fdcc5b
1197 1204 subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c)
1198 1205 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1199 1206 pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo
1200 1207 searching for changes
1201 1208 adding changesets
1202 1209 adding manifests
1203 1210 adding file changes
1204 1211 added 1 changesets with 1 changes to 1 files
1205 1212 new changesets 46cd4aac504c
1206 1213 subrepository sources for sub/repo differ
1207 1214 use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l
1208 1215 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1209 1216 $ cat issue1852d/.hgsubstate
1210 1217 f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo
1211 1218
1212 1219 Check status of files when none of them belong to the first
1213 1220 subrepository:
1214 1221
1215 1222 $ hg init subrepo-status
1216 1223 $ cd subrepo-status
1217 1224 $ hg init subrepo-1
1218 1225 $ hg init subrepo-2
1219 1226 $ cd subrepo-2
1220 1227 $ touch file
1221 1228 $ hg add file
1222 1229 $ cd ..
1223 1230 $ echo subrepo-1 = subrepo-1 > .hgsub
1224 1231 $ echo subrepo-2 = subrepo-2 >> .hgsub
1225 1232 $ hg add .hgsub
1226 1233 $ hg ci -m 'Added subrepos'
1227 1234 committing subrepository subrepo-2
1228 1235 $ hg st subrepo-2/file
1229 1236
1230 1237 Check that share works with subrepo
1231 1238 $ hg --config extensions.share= share . ../shared
1232 1239 updating working directory
1233 1240 sharing subrepo subrepo-1 from $TESTTMP/subrepo-status/subrepo-1
1234 1241 sharing subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2
1235 1242 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1236 1243 $ find ../shared/* | sort
1237 1244 ../shared/subrepo-1
1238 1245 ../shared/subrepo-1/.hg
1239 1246 ../shared/subrepo-1/.hg/cache
1240 1247 ../shared/subrepo-1/.hg/cache/storehash
1241 1248 ../shared/subrepo-1/.hg/cache/storehash/* (glob)
1242 1249 ../shared/subrepo-1/.hg/hgrc
1243 1250 ../shared/subrepo-1/.hg/requires
1244 1251 ../shared/subrepo-1/.hg/sharedpath
1245 1252 ../shared/subrepo-1/.hg/wcache
1246 1253 ../shared/subrepo-2
1247 1254 ../shared/subrepo-2/.hg
1248 1255 ../shared/subrepo-2/.hg/branch
1249 1256 ../shared/subrepo-2/.hg/cache
1250 1257 ../shared/subrepo-2/.hg/cache/storehash
1251 1258 ../shared/subrepo-2/.hg/cache/storehash/* (glob)
1252 1259 ../shared/subrepo-2/.hg/dirstate
1253 1260 ../shared/subrepo-2/.hg/hgrc
1254 1261 ../shared/subrepo-2/.hg/requires
1255 1262 ../shared/subrepo-2/.hg/sharedpath
1256 1263 ../shared/subrepo-2/.hg/wcache
1257 1264 ../shared/subrepo-2/.hg/wcache/checkisexec (execbit !)
1258 1265 ../shared/subrepo-2/.hg/wcache/checklink (symlink !)
1259 1266 ../shared/subrepo-2/.hg/wcache/checklink-target (symlink !)
1260 1267 ../shared/subrepo-2/file
1261 1268 $ hg -R ../shared in
1262 1269 abort: repository default not found!
1263 1270 [255]
1264 1271 $ hg -R ../shared/subrepo-2 showconfig paths
1265 1272 paths.default=$TESTTMP/subrepo-status/subrepo-2
1266 1273 $ hg -R ../shared/subrepo-1 sum --remote
1267 1274 parent: -1:000000000000 tip (empty repository)
1268 1275 branch: default
1269 1276 commit: (clean)
1270 1277 update: (current)
1271 1278 remote: (synced)
1272 1279
1273 1280 Check hg update --clean
1274 1281 $ cd $TESTTMP/t
1275 1282 $ rm -r t/t.orig
1276 1283 $ hg status -S --all
1277 1284 C .hgsub
1278 1285 C .hgsubstate
1279 1286 C a
1280 1287 C s/.hgsub
1281 1288 C s/.hgsubstate
1282 1289 C s/a
1283 1290 C s/ss/a
1284 1291 C t/t
1285 1292 $ echo c1 > s/a
1286 1293 $ cd s
1287 1294 $ echo c1 > b
1288 1295 $ echo c1 > c
1289 1296 $ hg add b
1290 1297 $ cd ..
1291 1298 $ hg status -S
1292 1299 M s/a
1293 1300 A s/b
1294 1301 ? s/c
1295 1302 $ hg update -C
1296 1303 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1297 1304 updated to "925c17564ef8: 13"
1298 1305 2 other heads for branch "default"
1299 1306 $ hg status -S
1300 1307 ? s/b
1301 1308 ? s/c
1302 1309
1303 1310 Sticky subrepositories, no changes
1304 1311 $ cd $TESTTMP/t
1305 1312 $ hg id
1306 1313 925c17564ef8 tip
1307 1314 $ hg -R s id
1308 1315 12a213df6fa9 tip
1309 1316 $ hg -R t id
1310 1317 52c0adc0515a tip
1311 1318 $ hg update 11
1312 1319 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1313 1320 $ hg id
1314 1321 365661e5936a
1315 1322 $ hg -R s id
1316 1323 fc627a69481f
1317 1324 $ hg -R t id
1318 1325 e95bcfa18a35
1319 1326
1320 1327 Sticky subrepositories, file changes
1321 1328 $ touch s/f1
1322 1329 $ touch t/f1
1323 1330 $ hg add -S s/f1
1324 1331 $ hg add -S t/f1
1325 1332 $ hg id
1326 1333 365661e5936a+
1327 1334 $ hg -R s id
1328 1335 fc627a69481f+
1329 1336 $ hg -R t id
1330 1337 e95bcfa18a35+
1331 1338 $ hg update tip
1332 1339 subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9)
1333 1340 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1334 1341 subrepository sources for s differ
1335 1342 use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l
1336 1343 subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a)
1337 1344 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1338 1345 subrepository sources for t differ
1339 1346 use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l
1340 1347 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1341 1348 $ hg id
1342 1349 925c17564ef8+ tip
1343 1350 $ hg -R s id
1344 1351 fc627a69481f+
1345 1352 $ hg -R t id
1346 1353 e95bcfa18a35+
1347 1354 $ hg update --clean tip
1348 1355 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1349 1356
1350 1357 Sticky subrepository, revision updates
1351 1358 $ hg id
1352 1359 925c17564ef8 tip
1353 1360 $ hg -R s id
1354 1361 12a213df6fa9 tip
1355 1362 $ hg -R t id
1356 1363 52c0adc0515a tip
1357 1364 $ cd s
1358 1365 $ hg update -r -2
1359 1366 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1360 1367 $ cd ../t
1361 1368 $ hg update -r 2
1362 1369 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1363 1370 $ cd ..
1364 1371 $ hg update 10
1365 1372 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1366 1373 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1367 1374 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c)
1368 1375 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1369 1376 subrepository sources for t differ (in checked out version)
1370 1377 use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l
1371 1378 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1372 1379 $ hg id
1373 1380 e45c8b14af55+
1374 1381 $ hg -R s id
1375 1382 02dcf1d70411
1376 1383 $ hg -R t id
1377 1384 7af322bc1198
1378 1385
1379 1386 Sticky subrepository, file changes and revision updates
1380 1387 $ touch s/f1
1381 1388 $ touch t/f1
1382 1389 $ hg add -S s/f1
1383 1390 $ hg add -S t/f1
1384 1391 $ hg id
1385 1392 e45c8b14af55+
1386 1393 $ hg -R s id
1387 1394 02dcf1d70411+
1388 1395 $ hg -R t id
1389 1396 7af322bc1198+
1390 1397 $ hg update tip
1391 1398 subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9)
1392 1399 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1393 1400 subrepository sources for s differ
1394 1401 use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l
1395 1402 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a)
1396 1403 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1397 1404 subrepository sources for t differ
1398 1405 use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l
1399 1406 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1400 1407 $ hg id
1401 1408 925c17564ef8+ tip
1402 1409 $ hg -R s id
1403 1410 02dcf1d70411+
1404 1411 $ hg -R t id
1405 1412 7af322bc1198+
1406 1413
1407 1414 Sticky repository, update --clean
1408 1415 $ hg update --clean tip
1409 1416 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1410 1417 $ hg id
1411 1418 925c17564ef8 tip
1412 1419 $ hg -R s id
1413 1420 12a213df6fa9 tip
1414 1421 $ hg -R t id
1415 1422 52c0adc0515a tip
1416 1423
1417 1424 Test subrepo already at intended revision:
1418 1425 $ cd s
1419 1426 $ hg update fc627a69481f
1420 1427 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1421 1428 $ cd ..
1422 1429 $ hg update 11
1423 1430 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1424 1431 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1425 1432 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1426 1433 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1427 1434 $ hg id -n
1428 1435 11+
1429 1436 $ hg -R s id
1430 1437 fc627a69481f
1431 1438 $ hg -R t id
1432 1439 e95bcfa18a35
1433 1440
1434 1441 Test that removing .hgsubstate doesn't break anything:
1435 1442
1436 1443 $ hg rm -f .hgsubstate
1437 1444 $ hg ci -mrm
1438 1445 nothing changed
1439 1446 [1]
1440 1447 $ hg log -vr tip
1441 1448 changeset: 13:925c17564ef8
1442 1449 tag: tip
1443 1450 user: test
1444 1451 date: Thu Jan 01 00:00:00 1970 +0000
1445 1452 files: .hgsubstate
1446 1453 description:
1447 1454 13
1448 1455
1449 1456
1450 1457
1451 1458 Test that removing .hgsub removes .hgsubstate:
1452 1459
1453 1460 $ hg rm .hgsub
1454 1461 $ hg ci -mrm2
1455 1462 created new head
1456 1463 $ hg log -vr tip
1457 1464 changeset: 14:2400bccd50af
1458 1465 tag: tip
1459 1466 parent: 11:365661e5936a
1460 1467 user: test
1461 1468 date: Thu Jan 01 00:00:00 1970 +0000
1462 1469 files: .hgsub .hgsubstate
1463 1470 description:
1464 1471 rm2
1465 1472
1466 1473
1467 1474 Test issue3153: diff -S with deleted subrepos
1468 1475
1469 1476 $ hg diff --nodates -S -c .
1470 1477 diff -r 365661e5936a -r 2400bccd50af .hgsub
1471 1478 --- a/.hgsub
1472 1479 +++ /dev/null
1473 1480 @@ -1,2 +0,0 @@
1474 1481 -s = s
1475 1482 -t = t
1476 1483 diff -r 365661e5936a -r 2400bccd50af .hgsubstate
1477 1484 --- a/.hgsubstate
1478 1485 +++ /dev/null
1479 1486 @@ -1,2 +0,0 @@
1480 1487 -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1481 1488 -e95bcfa18a358dc4936da981ebf4147b4cad1362 t
1482 1489
1483 1490 Test behavior of add for explicit path in subrepo:
1484 1491 $ cd ..
1485 1492 $ hg init explicit
1486 1493 $ cd explicit
1487 1494 $ echo s = s > .hgsub
1488 1495 $ hg add .hgsub
1489 1496 $ hg init s
1490 1497 $ hg ci -m0
1491 1498 Adding with an explicit path in a subrepo adds the file
1492 1499 $ echo c1 > f1
1493 1500 $ echo c2 > s/f2
1494 1501 $ hg st -S
1495 1502 ? f1
1496 1503 ? s/f2
1497 1504 $ hg add s/f2
1498 1505 $ hg st -S
1499 1506 A s/f2
1500 1507 ? f1
1501 1508 $ hg ci -R s -m0
1502 1509 $ hg ci -Am1
1503 1510 adding f1
1504 1511 Adding with an explicit path in a subrepo with -S has the same behavior
1505 1512 $ echo c3 > f3
1506 1513 $ echo c4 > s/f4
1507 1514 $ hg st -S
1508 1515 ? f3
1509 1516 ? s/f4
1510 1517 $ hg add -S s/f4
1511 1518 $ hg st -S
1512 1519 A s/f4
1513 1520 ? f3
1514 1521 $ hg ci -R s -m1
1515 1522 $ hg ci -Ama2
1516 1523 adding f3
1517 1524 Adding without a path or pattern silently ignores subrepos
1518 1525 $ echo c5 > f5
1519 1526 $ echo c6 > s/f6
1520 1527 $ echo c7 > s/f7
1521 1528 $ hg st -S
1522 1529 ? f5
1523 1530 ? s/f6
1524 1531 ? s/f7
1525 1532 $ hg add
1526 1533 adding f5
1527 1534 $ hg st -S
1528 1535 A f5
1529 1536 ? s/f6
1530 1537 ? s/f7
1531 1538 $ hg ci -R s -Am2
1532 1539 adding f6
1533 1540 adding f7
1534 1541 $ hg ci -m3
1535 1542 Adding without a path or pattern with -S also adds files in subrepos
1536 1543 $ echo c8 > f8
1537 1544 $ echo c9 > s/f9
1538 1545 $ echo c10 > s/f10
1539 1546 $ hg st -S
1540 1547 ? f8
1541 1548 ? s/f10
1542 1549 ? s/f9
1543 1550 $ hg add -S
1544 1551 adding f8
1545 1552 adding s/f10
1546 1553 adding s/f9
1547 1554 $ hg st -S
1548 1555 A f8
1549 1556 A s/f10
1550 1557 A s/f9
1551 1558 $ hg ci -R s -m3
1552 1559 $ hg ci -m4
1553 1560 Adding with a pattern silently ignores subrepos
1554 1561 $ echo c11 > fm11
1555 1562 $ echo c12 > fn12
1556 1563 $ echo c13 > s/fm13
1557 1564 $ echo c14 > s/fn14
1558 1565 $ hg st -S
1559 1566 ? fm11
1560 1567 ? fn12
1561 1568 ? s/fm13
1562 1569 ? s/fn14
1563 1570 $ hg add 'glob:**fm*'
1564 1571 adding fm11
1565 1572 $ hg st -S
1566 1573 A fm11
1567 1574 ? fn12
1568 1575 ? s/fm13
1569 1576 ? s/fn14
1570 1577 $ hg ci -R s -Am4
1571 1578 adding fm13
1572 1579 adding fn14
1573 1580 $ hg ci -Am5
1574 1581 adding fn12
1575 1582 Adding with a pattern with -S also adds matches in subrepos
1576 1583 $ echo c15 > fm15
1577 1584 $ echo c16 > fn16
1578 1585 $ echo c17 > s/fm17
1579 1586 $ echo c18 > s/fn18
1580 1587 $ hg st -S
1581 1588 ? fm15
1582 1589 ? fn16
1583 1590 ? s/fm17
1584 1591 ? s/fn18
1585 1592 $ hg add -S 'glob:**fm*'
1586 1593 adding fm15
1587 1594 adding s/fm17
1588 1595 $ hg st -S
1589 1596 A fm15
1590 1597 A s/fm17
1591 1598 ? fn16
1592 1599 ? s/fn18
1593 1600 $ hg ci -R s -Am5
1594 1601 adding fn18
1595 1602 $ hg ci -Am6
1596 1603 adding fn16
1597 1604
1598 1605 Test behavior of forget for explicit path in subrepo:
1599 1606 Forgetting an explicit path in a subrepo untracks the file
1600 1607 $ echo c19 > s/f19
1601 1608 $ hg add s/f19
1602 1609 $ hg st -S
1603 1610 A s/f19
1604 1611 $ hg forget s/f19
1605 1612 $ hg st -S
1606 1613 ? s/f19
1607 1614 $ rm s/f19
1608 1615 $ cd ..
1609 1616
1610 1617 Courtesy phases synchronisation to publishing server does not block the push
1611 1618 (issue3781)
1612 1619
1613 1620 $ cp -R main issue3781
1614 1621 $ cp -R main issue3781-dest
1615 1622 $ cd issue3781-dest/s
1616 1623 $ hg phase tip # show we have draft changeset
1617 1624 5: draft
1618 1625 $ chmod a-w .hg/store/phaseroots # prevent phase push
1619 1626 $ cd ../../issue3781
1620 1627 $ cat >> .hg/hgrc << EOF
1621 1628 > [paths]
1622 1629 > default=../issue3781-dest/
1623 1630 > EOF
1624 1631 $ hg push --config devel.legacy.exchange=bundle1
1625 1632 pushing to $TESTTMP/issue3781-dest
1626 1633 pushing subrepo s to $TESTTMP/issue3781-dest/s
1627 1634 searching for changes
1628 1635 no changes found
1629 1636 searching for changes
1630 1637 no changes found
1631 1638 [1]
1632 1639 # clean the push cache
1633 1640 $ rm s/.hg/cache/storehash/*
1634 1641 $ hg push # bundle2+
1635 1642 pushing to $TESTTMP/issue3781-dest
1636 1643 pushing subrepo s to $TESTTMP/issue3781-dest/s
1637 1644 searching for changes
1638 1645 no changes found
1639 1646 searching for changes
1640 1647 no changes found
1641 1648 [1]
1642 1649 $ cd ..
1643 1650
1644 1651 Test phase choice for newly created commit with "phases.subrepochecks"
1645 1652 configuration
1646 1653
1647 1654 $ cd t
1648 1655 $ hg update -q -r 12
1649 1656
1650 1657 $ cat >> s/ss/.hg/hgrc <<EOF
1651 1658 > [phases]
1652 1659 > new-commit = secret
1653 1660 > EOF
1654 1661 $ cat >> s/.hg/hgrc <<EOF
1655 1662 > [phases]
1656 1663 > new-commit = draft
1657 1664 > EOF
1658 1665 $ echo phasecheck1 >> s/ss/a
1659 1666 $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
1660 1667 committing subrepository ss
1661 1668 transaction abort!
1662 1669 rollback completed
1663 1670 abort: can't commit in draft phase conflicting secret from subrepository ss
1664 1671 [255]
1665 1672 $ echo phasecheck2 >> s/ss/a
1666 1673 $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
1667 1674 committing subrepository ss
1668 1675 $ hg -R s/ss phase tip
1669 1676 3: secret
1670 1677 $ hg -R s phase tip
1671 1678 6: draft
1672 1679 $ echo phasecheck3 >> s/ss/a
1673 1680 $ hg -R s commit -S -m phasecheck3
1674 1681 committing subrepository ss
1675 1682 warning: changes are committed in secret phase from subrepository ss
1676 1683 $ hg -R s/ss phase tip
1677 1684 4: secret
1678 1685 $ hg -R s phase tip
1679 1686 7: secret
1680 1687
1681 1688 $ cat >> t/.hg/hgrc <<EOF
1682 1689 > [phases]
1683 1690 > new-commit = draft
1684 1691 > EOF
1685 1692 $ cat >> .hg/hgrc <<EOF
1686 1693 > [phases]
1687 1694 > new-commit = public
1688 1695 > EOF
1689 1696 $ echo phasecheck4 >> s/ss/a
1690 1697 $ echo phasecheck4 >> t/t
1691 1698 $ hg commit -S -m phasecheck4
1692 1699 committing subrepository s
1693 1700 committing subrepository s/ss
1694 1701 warning: changes are committed in secret phase from subrepository ss
1695 1702 committing subrepository t
1696 1703 warning: changes are committed in secret phase from subrepository s
1697 1704 created new head
1698 1705 $ hg -R s/ss phase tip
1699 1706 5: secret
1700 1707 $ hg -R s phase tip
1701 1708 8: secret
1702 1709 $ hg -R t phase tip
1703 1710 6: draft
1704 1711 $ hg phase tip
1705 1712 15: secret
1706 1713
1707 1714 $ cd ..
1708 1715
1709 1716
1710 1717 Test that commit --secret works on both repo and subrepo (issue4182)
1711 1718
1712 1719 $ cd main
1713 1720 $ echo secret >> b
1714 1721 $ echo secret >> s/b
1715 1722 $ hg commit --secret --subrepo -m "secret"
1716 1723 committing subrepository s
1717 1724 $ hg phase -r .
1718 1725 6: secret
1719 1726 $ cd s
1720 1727 $ hg phase -r .
1721 1728 6: secret
1722 1729 $ cd ../../
1723 1730
1724 1731 Test "subrepos" template keyword
1725 1732
1726 1733 $ cd t
1727 1734 $ hg update -q 15
1728 1735 $ cat > .hgsub <<EOF
1729 1736 > s = s
1730 1737 > EOF
1731 1738 $ hg commit -m "16"
1732 1739 warning: changes are committed in secret phase from subrepository s
1733 1740
1734 1741 (addition of ".hgsub" itself)
1735 1742
1736 1743 $ hg diff --nodates -c 1 .hgsubstate
1737 1744 diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate
1738 1745 --- /dev/null
1739 1746 +++ b/.hgsubstate
1740 1747 @@ -0,0 +1,1 @@
1741 1748 +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1742 1749 $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1743 1750 f7b1eb17ad24 000000000000
1744 1751 s
1745 1752
1746 1753 (modification of existing entry)
1747 1754
1748 1755 $ hg diff --nodates -c 2 .hgsubstate
1749 1756 diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate
1750 1757 --- a/.hgsubstate
1751 1758 +++ b/.hgsubstate
1752 1759 @@ -1,1 +1,1 @@
1753 1760 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1754 1761 +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s
1755 1762 $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1756 1763 7cf8cfea66e4 000000000000
1757 1764 s
1758 1765
1759 1766 (addition of entry)
1760 1767
1761 1768 $ hg diff --nodates -c 5 .hgsubstate
1762 1769 diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate
1763 1770 --- a/.hgsubstate
1764 1771 +++ b/.hgsubstate
1765 1772 @@ -1,1 +1,2 @@
1766 1773 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1767 1774 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1768 1775 $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1769 1776 7cf8cfea66e4 000000000000
1770 1777 t
1771 1778
1772 1779 (removal of existing entry)
1773 1780
1774 1781 $ hg diff --nodates -c 16 .hgsubstate
1775 1782 diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate
1776 1783 --- a/.hgsubstate
1777 1784 +++ b/.hgsubstate
1778 1785 @@ -1,2 +1,1 @@
1779 1786 0731af8ca9423976d3743119d0865097c07bdc1b s
1780 1787 -e202dc79b04c88a636ea8913d9182a1346d9b3dc t
1781 1788 $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1782 1789 8bec38d2bd0b 000000000000
1783 1790 t
1784 1791
1785 1792 (merging)
1786 1793
1787 1794 $ hg diff --nodates -c 9 .hgsubstate
1788 1795 diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate
1789 1796 --- a/.hgsubstate
1790 1797 +++ b/.hgsubstate
1791 1798 @@ -1,1 +1,2 @@
1792 1799 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1793 1800 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1794 1801 $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1795 1802 f6affe3fbfaa 1f14a2e2d3ec
1796 1803 t
1797 1804
1798 1805 (removal of ".hgsub" itself)
1799 1806
1800 1807 $ hg diff --nodates -c 8 .hgsubstate
1801 1808 diff -r f94576341bcf -r 96615c1dad2d .hgsubstate
1802 1809 --- a/.hgsubstate
1803 1810 +++ /dev/null
1804 1811 @@ -1,2 +0,0 @@
1805 1812 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1806 1813 -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t
1807 1814 $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1808 1815 f94576341bcf 000000000000
1809 1816
1810 1817 Test that '[paths]' is configured correctly at subrepo creation
1811 1818
1812 1819 $ cd $TESTTMP/tc
1813 1820 $ cat > .hgsub <<EOF
1814 1821 > # to clear bogus subrepo path 'bogus=[boguspath'
1815 1822 > s = s
1816 1823 > t = t
1817 1824 > EOF
1818 1825 $ hg update -q --clean null
1819 1826 $ rm -rf s t
1820 1827 $ cat >> .hg/hgrc <<EOF
1821 1828 > [paths]
1822 1829 > default-push = /foo/bar
1823 1830 > EOF
1824 1831 $ hg update -q
1825 1832 $ cat s/.hg/hgrc
1826 1833 [paths]
1827 1834 default = $TESTTMP/t/s
1828 1835 default-push = /foo/bar/s
1829 1836 $ cat s/ss/.hg/hgrc
1830 1837 [paths]
1831 1838 default = $TESTTMP/t/s/ss
1832 1839 default-push = /foo/bar/s/ss
1833 1840 $ cat t/.hg/hgrc
1834 1841 [paths]
1835 1842 default = $TESTTMP/t/t
1836 1843 default-push = /foo/bar/t
1837 1844
1838 1845 $ cd $TESTTMP/t
1839 1846 $ hg up -qC 0
1840 1847 $ echo 'bar' > bar.txt
1841 1848 $ hg ci -Am 'branch before subrepo add'
1842 1849 adding bar.txt
1843 1850 created new head
1844 1851 $ hg merge -r "first(subrepo('s'))"
1845 1852 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1846 1853 (branch merge, don't forget to commit)
1847 1854 $ hg status -S -X '.hgsub*'
1848 1855 A s/a
1849 1856 ? s/b
1850 1857 ? s/c
1851 1858 ? s/f1
1852 1859 $ hg status -S --rev 'p2()'
1853 1860 A bar.txt
1854 1861 ? s/b
1855 1862 ? s/c
1856 1863 ? s/f1
1857 1864 $ hg diff -S -X '.hgsub*' --nodates
1858 1865 diff -r 000000000000 s/a
1859 1866 --- /dev/null
1860 1867 +++ b/s/a
1861 1868 @@ -0,0 +1,1 @@
1862 1869 +a
1863 1870 $ hg diff -S --rev 'p2()' --nodates
1864 1871 diff -r 7cf8cfea66e4 bar.txt
1865 1872 --- /dev/null
1866 1873 +++ b/bar.txt
1867 1874 @@ -0,0 +1,1 @@
1868 1875 +bar
1869 1876
1870 1877 $ cd ..
1871 1878
1872 1879 test for ssh exploit 2017-07-25
1873 1880
1874 1881 $ cat >> $HGRCPATH << EOF
1875 1882 > [ui]
1876 1883 > ssh = sh -c "read l; read l; read l"
1877 1884 > EOF
1878 1885
1879 1886 $ hg init malicious-proxycommand
1880 1887 $ cd malicious-proxycommand
1881 1888 $ echo 's = [hg]ssh://-oProxyCommand=touch${IFS}owned/path' > .hgsub
1882 1889 $ hg init s
1883 1890 $ cd s
1884 1891 $ echo init > init
1885 1892 $ hg add
1886 1893 adding init
1887 1894 $ hg commit -m init
1888 1895 $ cd ..
1889 1896 $ hg add .hgsub
1890 1897 $ hg ci -m 'add subrepo'
1891 1898 $ cd ..
1892 1899 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1893 1900 updating to branch default
1894 1901 cloning subrepo s from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
1895 1902 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
1896 1903 [255]
1897 1904
1898 1905 also check that a percent encoded '-' (%2D) doesn't work
1899 1906
1900 1907 $ cd malicious-proxycommand
1901 1908 $ echo 's = [hg]ssh://%2DoProxyCommand=touch${IFS}owned/path' > .hgsub
1902 1909 $ hg ci -m 'change url to percent encoded'
1903 1910 $ cd ..
1904 1911 $ rm -r malicious-proxycommand-clone
1905 1912 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1906 1913 updating to branch default
1907 1914 cloning subrepo s from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
1908 1915 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
1909 1916 [255]
1910 1917
1911 1918 also check for a pipe
1912 1919
1913 1920 $ cd malicious-proxycommand
1914 1921 $ echo 's = [hg]ssh://fakehost|touch${IFS}owned/path' > .hgsub
1915 1922 $ hg ci -m 'change url to pipe'
1916 1923 $ cd ..
1917 1924 $ rm -r malicious-proxycommand-clone
1918 1925 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1919 1926 updating to branch default
1920 1927 cloning subrepo s from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path
1921 1928 abort: no suitable response from remote hg!
1922 1929 [255]
1923 1930 $ [ ! -f owned ] || echo 'you got owned'
1924 1931
1925 1932 also check that a percent encoded '|' (%7C) doesn't work
1926 1933
1927 1934 $ cd malicious-proxycommand
1928 1935 $ echo 's = [hg]ssh://fakehost%7Ctouch%20owned/path' > .hgsub
1929 1936 $ hg ci -m 'change url to percent encoded pipe'
1930 1937 $ cd ..
1931 1938 $ rm -r malicious-proxycommand-clone
1932 1939 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1933 1940 updating to branch default
1934 1941 cloning subrepo s from ssh://fakehost%7Ctouch%20owned/path
1935 1942 abort: no suitable response from remote hg!
1936 1943 [255]
1937 1944 $ [ ! -f owned ] || echo 'you got owned'
1938 1945
1939 1946 and bad usernames:
1940 1947 $ cd malicious-proxycommand
1941 1948 $ echo 's = [hg]ssh://-oProxyCommand=touch owned@example.com/path' > .hgsub
1942 1949 $ hg ci -m 'owned username'
1943 1950 $ cd ..
1944 1951 $ rm -r malicious-proxycommand-clone
1945 1952 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1946 1953 updating to branch default
1947 1954 cloning subrepo s from ssh://-oProxyCommand%3Dtouch%20owned@example.com/path
1948 1955 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s")
1949 1956 [255]
1950 1957
1951 1958 Test convert subrepositories including merge (issue5526):
1952 1959
1953 1960 $ hg init tconv
1954 1961 $ hg convert --config extensions.convert= -q t/s tconv/s
1955 1962 $ hg convert --config extensions.convert= -q t/s/ss tconv/s/ss
1956 1963 $ hg convert --config extensions.convert= -q t/t tconv/t
1957 1964
1958 1965 convert shouldn't fail because of pseudo filenode:
1959 1966
1960 1967 $ hg convert --config extensions.convert= t tconv
1961 1968 scanning source...
1962 1969 sorting...
1963 1970 converting...
1964 1971 17 0
1965 1972 16 1
1966 1973 15 2
1967 1974 14 3
1968 1975 13 4
1969 1976 12 5
1970 1977 11 6
1971 1978 10 7
1972 1979 9 8
1973 1980 8 9
1974 1981 7 10
1975 1982 6 11
1976 1983 5 12
1977 1984 4 13
1978 1985 3 rm2
1979 1986 2 phasecheck4
1980 1987 1 16
1981 1988 0 branch before subrepo add
1982 1989
1983 1990 converted .hgsubstate should point to valid nodes:
1984 1991
1985 1992 $ hg up -R tconv 9
1986 1993 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1987 1994 $ cat tconv/.hgsubstate
1988 1995 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1989 1996 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
General Comments 0
You need to be logged in to leave comments. Login now