##// END OF EJS Templates
test-subrepo-git: ignore global git config...
Matt Mackall -
r23693:9a02f751 default
parent child Browse files
Show More
@@ -1,803 +1,804 b''
1 1 #require git
2 2
3 3 make git commits repeatable
4 4
5 5 $ echo "[core]" >> $HOME/.gitconfig
6 6 $ echo "autocrlf = false" >> $HOME/.gitconfig
7 7 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
8 8 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
9 9 $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE
10 10 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
11 11 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
12 12 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
13 $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM
13 14
14 15 root hg repo
15 16
16 17 $ hg init t
17 18 $ cd t
18 19 $ echo a > a
19 20 $ hg add a
20 21 $ hg commit -m a
21 22 $ cd ..
22 23
23 24 new external git repo
24 25
25 26 $ mkdir gitroot
26 27 $ cd gitroot
27 28 $ git init -q
28 29 $ echo g > g
29 30 $ git add g
30 31 $ git commit -q -m g
31 32
32 33 add subrepo clone
33 34
34 35 $ cd ../t
35 36 $ echo 's = [git]../gitroot' > .hgsub
36 37 $ git clone -q ../gitroot s
37 38 $ hg add .hgsub
38 39 $ hg commit -m 'new git subrepo'
39 40 $ hg debugsub
40 41 path s
41 42 source ../gitroot
42 43 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
43 44
44 45 record a new commit from upstream from a different branch
45 46
46 47 $ cd ../gitroot
47 48 $ git checkout -q -b testing
48 49 $ echo gg >> g
49 50 $ git commit -q -a -m gg
50 51
51 52 $ cd ../t/s
52 53 $ git pull -q >/dev/null 2>/dev/null
53 54 $ git checkout -q -b testing origin/testing >/dev/null
54 55
55 56 $ cd ..
56 57 $ hg status --subrepos
57 58 M s/g
58 59 $ hg commit -m 'update git subrepo'
59 60 $ hg debugsub
60 61 path s
61 62 source ../gitroot
62 63 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
63 64
64 65 make $GITROOT pushable, by replacing it with a clone with nothing checked out
65 66
66 67 $ cd ..
67 68 $ git clone gitroot gitrootbare --bare -q
68 69 $ rm -rf gitroot
69 70 $ mv gitrootbare gitroot
70 71
71 72 clone root
72 73
73 74 $ cd t
74 75 $ hg clone . ../tc 2> /dev/null
75 76 updating to branch default
76 77 cloning subrepo s from $TESTTMP/gitroot
77 78 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 79 $ cd ../tc
79 80 $ hg debugsub
80 81 path s
81 82 source ../gitroot
82 83 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
83 84
84 85 update to previous substate
85 86
86 87 $ hg update 1 -q
87 88 $ cat s/g
88 89 g
89 90 $ hg debugsub
90 91 path s
91 92 source ../gitroot
92 93 revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
93 94
94 95 clone root, make local change
95 96
96 97 $ cd ../t
97 98 $ hg clone . ../ta 2> /dev/null
98 99 updating to branch default
99 100 cloning subrepo s from $TESTTMP/gitroot
100 101 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 102
102 103 $ cd ../ta
103 104 $ echo ggg >> s/g
104 105 $ hg status --subrepos
105 106 M s/g
106 107 $ hg diff --subrepos
107 108 diff --git a/s/g b/s/g
108 109 index 089258f..85341ee 100644
109 110 --- a/s/g
110 111 +++ b/s/g
111 112 @@ -1,2 +1,3 @@
112 113 g
113 114 gg
114 115 +ggg (no-eol)
115 116 $ hg commit --subrepos -m ggg
116 117 committing subrepository s
117 118 $ hg debugsub
118 119 path s
119 120 source ../gitroot
120 121 revision 79695940086840c99328513acbe35f90fcd55e57
121 122
122 123 clone root separately, make different local change
123 124
124 125 $ cd ../t
125 126 $ hg clone . ../tb 2> /dev/null
126 127 updating to branch default
127 128 cloning subrepo s from $TESTTMP/gitroot
128 129 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
129 130
130 131 $ cd ../tb/s
131 132 $ hg status --subrepos
132 133 $ echo f > f
133 134 $ hg status --subrepos
134 135 ? s/f
135 136 $ git add f
136 137 $ cd ..
137 138
138 139 $ hg status --subrepos
139 140 A s/f
140 141 $ hg commit --subrepos -m f
141 142 committing subrepository s
142 143 $ hg debugsub
143 144 path s
144 145 source ../gitroot
145 146 revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
146 147
147 148 user b push changes
148 149
149 150 $ hg push 2>/dev/null
150 151 pushing to $TESTTMP/t (glob)
151 152 pushing branch testing of subrepo s
152 153 searching for changes
153 154 adding changesets
154 155 adding manifests
155 156 adding file changes
156 157 added 1 changesets with 1 changes to 1 files
157 158
158 159 user a pulls, merges, commits
159 160
160 161 $ cd ../ta
161 162 $ hg pull
162 163 pulling from $TESTTMP/t (glob)
163 164 searching for changes
164 165 adding changesets
165 166 adding manifests
166 167 adding file changes
167 168 added 1 changesets with 1 changes to 1 files (+1 heads)
168 169 (run 'hg heads' to see heads, 'hg merge' to merge)
169 170 $ hg merge 2>/dev/null
170 171 subrepository s diverged (local revision: 7969594, remote revision: aa84837)
171 172 (M)erge, keep (l)ocal or keep (r)emote? m
172 173 pulling subrepo s from $TESTTMP/gitroot
173 174 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
174 175 (branch merge, don't forget to commit)
175 176 $ cat s/f
176 177 f
177 178 $ cat s/g
178 179 g
179 180 gg
180 181 ggg
181 182 $ hg commit --subrepos -m 'merge'
182 183 committing subrepository s
183 184 $ hg status --subrepos --rev 1:5
184 185 M .hgsubstate
185 186 M s/g
186 187 A s/f
187 188 $ hg debugsub
188 189 path s
189 190 source ../gitroot
190 191 revision f47b465e1bce645dbf37232a00574aa1546ca8d3
191 192 $ hg push 2>/dev/null
192 193 pushing to $TESTTMP/t (glob)
193 194 pushing branch testing of subrepo s
194 195 searching for changes
195 196 adding changesets
196 197 adding manifests
197 198 adding file changes
198 199 added 2 changesets with 2 changes to 1 files
199 200
200 201 make upstream git changes
201 202
202 203 $ cd ..
203 204 $ git clone -q gitroot gitclone
204 205 $ cd gitclone
205 206 $ echo ff >> f
206 207 $ git commit -q -a -m ff
207 208 $ echo fff >> f
208 209 $ git commit -q -a -m fff
209 210 $ git push origin testing 2>/dev/null
210 211
211 212 make and push changes to hg without updating the subrepo
212 213
213 214 $ cd ../t
214 215 $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.'
215 216 updating to branch default
216 217 cloning subrepo s from $TESTTMP/gitroot
217 218 checking out detached HEAD in subrepo s
218 219 check out a git branch if you intend to make changes
219 220 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
220 221 $ cd ../td
221 222 $ echo aa >> a
222 223 $ hg commit -m aa
223 224 $ hg push
224 225 pushing to $TESTTMP/t (glob)
225 226 searching for changes
226 227 adding changesets
227 228 adding manifests
228 229 adding file changes
229 230 added 1 changesets with 1 changes to 1 files
230 231
231 232 sync to upstream git, distribute changes
232 233
233 234 $ cd ../ta
234 235 $ hg pull -u -q
235 236 $ cd s
236 237 $ git pull -q >/dev/null 2>/dev/null
237 238 $ cd ..
238 239 $ hg commit -m 'git upstream sync'
239 240 $ hg debugsub
240 241 path s
241 242 source ../gitroot
242 243 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
243 244 $ hg push -q
244 245
245 246 $ cd ../tb
246 247 $ hg pull -q
247 248 $ hg update 2>/dev/null
248 249 pulling subrepo s from $TESTTMP/gitroot
249 250 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
250 251 $ hg debugsub
251 252 path s
252 253 source ../gitroot
253 254 revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc
254 255
255 256 create a new git branch
256 257
257 258 $ cd s
258 259 $ git checkout -b b2
259 260 Switched to a new branch 'b2'
260 261 $ echo a>a
261 262 $ git add a
262 263 $ git commit -qm 'add a'
263 264 $ cd ..
264 265 $ hg commit -m 'add branch in s'
265 266
266 267 pulling new git branch should not create tracking branch named 'origin/b2'
267 268 (issue3870)
268 269 $ cd ../td/s
269 270 $ git remote set-url origin $TESTTMP/tb/s
270 271 $ git branch --no-track oldtesting
271 272 $ cd ..
272 273 $ hg pull -q ../tb
273 274 $ hg up
274 275 From $TESTTMP/tb/s
275 276 * [new branch] b2 -> origin/b2
276 277 Previous HEAD position was f47b465... merge
277 278 Switched to a new branch 'b2'
278 279 pulling subrepo s from $TESTTMP/tb/s
279 280 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
280 281
281 282 update to a revision without the subrepo, keeping the local git repository
282 283
283 284 $ cd ../t
284 285 $ hg up 0
285 286 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
286 287 $ ls -a s
287 288 .
288 289 ..
289 290 .git
290 291
291 292 $ hg up 2
292 293 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 294 $ ls -a s
294 295 .
295 296 ..
296 297 .git
297 298 g
298 299
299 300 archive subrepos
300 301
301 302 $ cd ../tc
302 303 $ hg pull -q
303 304 $ hg archive --subrepos -r 5 ../archive 2>/dev/null
304 305 pulling subrepo s from $TESTTMP/gitroot
305 306 $ cd ../archive
306 307 $ cat s/f
307 308 f
308 309 $ cat s/g
309 310 g
310 311 gg
311 312 ggg
312 313
313 314 $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null
314 315 $ find ../archive_x | sort | grep -v pax_global_header
315 316 ../archive_x
316 317 ../archive_x/.hg_archival.txt
317 318 ../archive_x/.hgsub
318 319 ../archive_x/.hgsubstate
319 320 ../archive_x/a
320 321 ../archive_x/s
321 322 ../archive_x/s/g
322 323
323 324 create nested repo
324 325
325 326 $ cd ..
326 327 $ hg init outer
327 328 $ cd outer
328 329 $ echo b>b
329 330 $ hg add b
330 331 $ hg commit -m b
331 332
332 333 $ hg clone ../t inner 2> /dev/null
333 334 updating to branch default
334 335 cloning subrepo s from $TESTTMP/gitroot
335 336 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
336 337 $ echo inner = inner > .hgsub
337 338 $ hg add .hgsub
338 339 $ hg commit -m 'nested sub'
339 340
340 341 nested commit
341 342
342 343 $ echo ffff >> inner/s/f
343 344 $ hg status --subrepos
344 345 M inner/s/f
345 346 $ hg commit --subrepos -m nested
346 347 committing subrepository inner
347 348 committing subrepository inner/s (glob)
348 349
349 350 nested archive
350 351
351 352 $ hg archive --subrepos ../narchive
352 353 $ ls ../narchive/inner/s | grep -v pax_global_header
353 354 f
354 355 g
355 356
356 357 relative source expansion
357 358
358 359 $ cd ..
359 360 $ mkdir d
360 361 $ hg clone t d/t 2> /dev/null
361 362 updating to branch default
362 363 cloning subrepo s from $TESTTMP/gitroot
363 364 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
364 365
365 366 Don't crash if the subrepo is missing
366 367
367 368 $ hg clone t missing -q
368 369 $ cd missing
369 370 $ rm -rf s
370 371 $ hg status -S
371 372 $ hg sum | grep commit
372 373 commit: 1 subrepos
373 374 $ hg push -q
374 375 abort: subrepo s is missing (in subrepo s)
375 376 [255]
376 377 $ hg commit --subrepos -qm missing
377 378 abort: subrepo s is missing (in subrepo s)
378 379 [255]
379 380 $ hg update -C 2> /dev/null
380 381 cloning subrepo s from $TESTTMP/gitroot
381 382 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
382 383 $ hg sum | grep commit
383 384 commit: (clean)
384 385
385 386 Don't crash if the .hgsubstate entry is missing
386 387
387 388 $ hg update 1 -q
388 389 $ hg rm .hgsubstate
389 390 $ hg commit .hgsubstate -m 'no substate'
390 391 nothing changed
391 392 [1]
392 393 $ hg tag -l nosubstate
393 394 $ hg manifest
394 395 .hgsub
395 396 .hgsubstate
396 397 a
397 398
398 399 $ hg status -S
399 400 R .hgsubstate
400 401 $ hg sum | grep commit
401 402 commit: 1 removed, 1 subrepos (new branch head)
402 403
403 404 $ hg commit -m 'restore substate'
404 405 nothing changed
405 406 [1]
406 407 $ hg manifest
407 408 .hgsub
408 409 .hgsubstate
409 410 a
410 411 $ hg sum | grep commit
411 412 commit: 1 removed, 1 subrepos (new branch head)
412 413
413 414 $ hg update -qC nosubstate
414 415 $ ls s
415 416 g
416 417
417 418 issue3109: false positives in git diff-index
418 419
419 420 $ hg update -q
420 421 $ touch -t 200001010000 s/g
421 422 $ hg status --subrepos
422 423 $ touch -t 200001010000 s/g
423 424 $ hg sum | grep commit
424 425 commit: (clean)
425 426
426 427 Check hg update --clean
427 428 $ cd $TESTTMP/ta
428 429 $ echo > s/g
429 430 $ cd s
430 431 $ echo c1 > f1
431 432 $ echo c1 > f2
432 433 $ git add f1
433 434 $ cd ..
434 435 $ hg status -S
435 436 M s/g
436 437 A s/f1
437 438 ? s/f2
438 439 $ ls s
439 440 f
440 441 f1
441 442 f2
442 443 g
443 444 $ hg update --clean
444 445 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 446 $ hg status -S
446 447 ? s/f1
447 448 ? s/f2
448 449 $ ls s
449 450 f
450 451 f1
451 452 f2
452 453 g
453 454
454 455 Sticky subrepositories, no changes
455 456 $ cd $TESTTMP/ta
456 457 $ hg id -n
457 458 7
458 459 $ cd s
459 460 $ git rev-parse HEAD
460 461 32a343883b74769118bb1d3b4b1fbf9156f4dddc
461 462 $ cd ..
462 463 $ hg update 1 > /dev/null 2>&1
463 464 $ hg id -n
464 465 1
465 466 $ cd s
466 467 $ git rev-parse HEAD
467 468 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
468 469 $ cd ..
469 470
470 471 Sticky subrepositories, file changes
471 472 $ touch s/f1
472 473 $ cd s
473 474 $ git add f1
474 475 $ cd ..
475 476 $ hg id -n
476 477 1+
477 478 $ cd s
478 479 $ git rev-parse HEAD
479 480 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
480 481 $ cd ..
481 482 $ hg update 4
482 483 subrepository s diverged (local revision: da5f5b1, remote revision: aa84837)
483 484 (M)erge, keep (l)ocal or keep (r)emote? m
484 485 subrepository sources for s differ
485 486 use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l
486 487 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
487 488 $ hg id -n
488 489 4+
489 490 $ cd s
490 491 $ git rev-parse HEAD
491 492 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
492 493 $ cd ..
493 494 $ hg update --clean tip > /dev/null 2>&1
494 495
495 496 Sticky subrepository, revision updates
496 497 $ hg id -n
497 498 7
498 499 $ cd s
499 500 $ git rev-parse HEAD
500 501 32a343883b74769118bb1d3b4b1fbf9156f4dddc
501 502 $ cd ..
502 503 $ cd s
503 504 $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
504 505 Previous HEAD position was 32a3438... fff
505 506 HEAD is now at aa84837... f
506 507 $ cd ..
507 508 $ hg update 1
508 509 subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1)
509 510 (M)erge, keep (l)ocal or keep (r)emote? m
510 511 subrepository sources for s differ (in checked out version)
511 512 use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l
512 513 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
513 514 $ hg id -n
514 515 1+
515 516 $ cd s
516 517 $ git rev-parse HEAD
517 518 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
518 519 $ cd ..
519 520
520 521 Sticky subrepository, file changes and revision updates
521 522 $ touch s/f1
522 523 $ cd s
523 524 $ git add f1
524 525 $ git rev-parse HEAD
525 526 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
526 527 $ cd ..
527 528 $ hg id -n
528 529 1+
529 530 $ hg update 7
530 531 subrepository s diverged (local revision: 32a3438, remote revision: 32a3438)
531 532 (M)erge, keep (l)ocal or keep (r)emote? m
532 533 subrepository sources for s differ
533 534 use (l)ocal source (32a3438) or (r)emote source (32a3438)? l
534 535 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
535 536 $ hg id -n
536 537 7+
537 538 $ cd s
538 539 $ git rev-parse HEAD
539 540 aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
540 541 $ cd ..
541 542
542 543 Sticky repository, update --clean
543 544 $ hg update --clean tip 2>/dev/null
544 545 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
545 546 $ hg id -n
546 547 7
547 548 $ cd s
548 549 $ git rev-parse HEAD
549 550 32a343883b74769118bb1d3b4b1fbf9156f4dddc
550 551 $ cd ..
551 552
552 553 Test subrepo already at intended revision:
553 554 $ cd s
554 555 $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc
555 556 HEAD is now at 32a3438... fff
556 557 $ cd ..
557 558 $ hg update 1
558 559 Previous HEAD position was 32a3438... fff
559 560 HEAD is now at da5f5b1... g
560 561 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
561 562 $ hg id -n
562 563 1
563 564 $ cd s
564 565 $ git rev-parse HEAD
565 566 da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
566 567 $ cd ..
567 568
568 569 Test forgetting files, not implemented in git subrepo, used to
569 570 traceback
570 571 #if no-windows
571 572 $ hg forget 'notafile*'
572 573 notafile*: No such file or directory
573 574 [1]
574 575 #else
575 576 $ hg forget 'notafile'
576 577 notafile: * (glob)
577 578 [1]
578 579 #endif
579 580
580 581 $ cd ..
581 582
582 583 Test sanitizing ".hg/hgrc" in subrepo
583 584
584 585 $ cd t
585 586 $ hg tip -q
586 587 7:af6d2edbb0d3
587 588 $ hg update -q -C af6d2edbb0d3
588 589 $ cd s
589 590 $ git checkout -q -b sanitize-test
590 591 $ mkdir .hg
591 592 $ echo '.hg/hgrc in git repo' > .hg/hgrc
592 593 $ mkdir -p sub/.hg
593 594 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
594 595 $ git add .hg sub
595 596 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update'
596 597 $ git push -q origin sanitize-test
597 598 $ cd ..
598 599 $ grep ' s$' .hgsubstate
599 600 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
600 601 $ hg commit -qm 'commit with git revision including .hg/hgrc'
601 602 $ hg parents -q
602 603 8:3473d20bddcf
603 604 $ grep ' s$' .hgsubstate
604 605 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
605 606 $ cd ..
606 607
607 608 $ hg -R tc pull -q
608 609 $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort
609 610 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
610 611 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
611 612 $ cd tc
612 613 $ hg parents -q
613 614 8:3473d20bddcf
614 615 $ grep ' s$' .hgsubstate
615 616 c4069473b459cf27fd4d7c2f50c4346b4e936599 s
616 617 $ test -f s/.hg/hgrc
617 618 [1]
618 619 $ test -f s/sub/.hg/hgrc
619 620 [1]
620 621 $ cd ..
621 622
622 623 additional test for "git merge --ff" route:
623 624
624 625 $ cd t
625 626 $ hg tip -q
626 627 8:3473d20bddcf
627 628 $ hg update -q -C af6d2edbb0d3
628 629 $ cd s
629 630 $ git checkout -q testing
630 631 $ mkdir .hg
631 632 $ echo '.hg/hgrc in git repo' > .hg/hgrc
632 633 $ mkdir -p sub/.hg
633 634 $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc
634 635 $ git add .hg sub
635 636 $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)'
636 637 $ git push -q origin testing
637 638 $ cd ..
638 639 $ grep ' s$' .hgsubstate
639 640 32a343883b74769118bb1d3b4b1fbf9156f4dddc s
640 641 $ hg commit -qm 'commit with git revision including .hg/hgrc'
641 642 $ hg parents -q
642 643 9:ed23f7fe024e
643 644 $ grep ' s$' .hgsubstate
644 645 f262643c1077219fbd3858d54e78ef050ef84fbf s
645 646 $ cd ..
646 647
647 648 $ cd tc
648 649 $ hg update -q -C af6d2edbb0d3
649 650 $ test -f s/.hg/hgrc
650 651 [1]
651 652 $ test -f s/sub/.hg/hgrc
652 653 [1]
653 654 $ cd ..
654 655 $ hg -R tc pull -q
655 656 $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort
656 657 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob)
657 658 warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob)
658 659 $ cd tc
659 660 $ hg parents -q
660 661 9:ed23f7fe024e
661 662 $ grep ' s$' .hgsubstate
662 663 f262643c1077219fbd3858d54e78ef050ef84fbf s
663 664 $ test -f s/.hg/hgrc
664 665 [1]
665 666 $ test -f s/sub/.hg/hgrc
666 667 [1]
667 668
668 669 Test that sanitizing is omitted in meta data area:
669 670
670 671 $ mkdir s/.git/.hg
671 672 $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc
672 673 $ hg update -q -C af6d2edbb0d3
673 674 checking out detached HEAD in subrepo s
674 675 check out a git branch if you intend to make changes
675 676
676 677 check differences made by most recent change
677 678 $ cd s
678 679 $ cat > foobar << EOF
679 680 > woopwoop
680 681 >
681 682 > foo
682 683 > bar
683 684 > EOF
684 685 $ git add foobar
685 686 $ cd ..
686 687
687 688 $ hg diff --subrepos
688 689 diff --git a/s/foobar b/s/foobar
689 690 new file mode 100644
690 691 index 0000000..8a5a5e2
691 692 --- /dev/null
692 693 +++ b/s/foobar
693 694 @@ -0,0 +1,4 @@
694 695 +woopwoop
695 696 +
696 697 +foo
697 698 +bar (no-eol)
698 699
699 700 $ hg commit --subrepos -m "Added foobar"
700 701 committing subrepository s
701 702 created new head
702 703
703 704 $ hg diff -c . --subrepos --nodates
704 705 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
705 706 --- a/.hgsubstate
706 707 +++ b/.hgsubstate
707 708 @@ -1,1 +1,1 @@
708 709 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
709 710 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
710 711 diff --git a/s/foobar b/s/foobar
711 712 new file mode 100644
712 713 index 0000000..8a5a5e2
713 714 --- /dev/null
714 715 +++ b/s/foobar
715 716 @@ -0,0 +1,4 @@
716 717 +woopwoop
717 718 +
718 719 +foo
719 720 +bar (no-eol)
720 721
721 722 check output when only diffing the subrepository
722 723 $ hg diff -c . --subrepos s
723 724 diff --git a/s/foobar b/s/foobar
724 725 new file mode 100644
725 726 index 0000000..8a5a5e2
726 727 --- /dev/null
727 728 +++ b/s/foobar
728 729 @@ -0,0 +1,4 @@
729 730 +woopwoop
730 731 +
731 732 +foo
732 733 +bar (no-eol)
733 734
734 735 check output when diffing something else
735 736 $ hg diff -c . --subrepos .hgsubstate --nodates
736 737 diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate
737 738 --- a/.hgsubstate
738 739 +++ b/.hgsubstate
739 740 @@ -1,1 +1,1 @@
740 741 -32a343883b74769118bb1d3b4b1fbf9156f4dddc s
741 742 +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s
742 743
743 744 add new changes, including whitespace
744 745 $ cd s
745 746 $ cat > foobar << EOF
746 747 > woop woop
747 748 >
748 749 > foo
749 750 > bar
750 751 > EOF
751 752 $ echo foo > barfoo
752 753 $ git add barfoo
753 754 $ cd ..
754 755
755 756 $ hg diff --subrepos --ignore-all-space
756 757 diff --git a/s/barfoo b/s/barfoo
757 758 new file mode 100644
758 759 index 0000000..257cc56
759 760 --- /dev/null
760 761 +++ b/s/barfoo
761 762 @@ -0,0 +1 @@
762 763 +foo (no-eol)
763 764 $ hg diff --subrepos s/foobar
764 765 diff --git a/s/foobar b/s/foobar
765 766 index 8a5a5e2..bd5812a 100644
766 767 --- a/s/foobar
767 768 +++ b/s/foobar
768 769 @@ -1,4 +1,4 @@
769 770 -woopwoop
770 771 +woop woop
771 772
772 773 foo
773 774 bar (no-eol)
774 775
775 776 execute a diffstat
776 777 the output contains a regex, because git 1.7.10 and 1.7.11
777 778 change the amount of whitespace
778 779 $ hg diff --subrepos --stat
779 780 \s*barfoo |\s*1 + (re)
780 781 \s*foobar |\s*2 +- (re)
781 782 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) \(no-eol\) (re)
782 783
783 784 ensure adding include/exclude ignores the subrepo
784 785 $ hg diff --subrepos -I s/foobar
785 786 $ hg diff --subrepos -X s/foobar
786 787
787 788 revert the subrepository
788 789 $ hg revert --all
789 790 reverting subrepo ../gitroot (glob)
790 791
791 792 $ hg status --subrepos
792 793 ? s/barfoo
793 794 ? s/foobar.orig
794 795
795 796 $ mv s/foobar.orig s/foobar
796 797
797 798 $ hg revert --no-backup s
798 799 reverting subrepo ../gitroot (glob)
799 800
800 801 $ hg status --subrepos
801 802 ? s/barfoo
802 803
803 804 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now