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