Debian Codegraph @

tests/test-fastexport.t

raw
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
3 > fastexport=
4 > [subrepos]
5 > git:allowed = true
6 > EOF
7
8 $ hg init test
9 $ cd test
10
11 $ hg fastexport
12 abort: no revisions matched
13 [255]
14
15 $ hg debugbuilddag -mon '+2:tbase @name1 +3:thead1 <tbase @name2 +4:thead2 @both /thead1 +2:tmaintip'
16
17 $ hg up -r 10
18 13 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 $ hg rm nf10
20 $ hg commit -u debugbuilddag --date 'Thu Jan 01 02:30:12 1970 +0230' -m r12
21 created new head
22 $ hg up -r 11
23 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 $ hg merge -r 12
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
26 (branch merge, don't forget to commit)
27 $ hg commit -m debugbuilddag --date 'Thu Jan 01 00:00:13 1970 +0000'
28
29 $ hg log -G
30 @ changeset: 13:5544befcb7ce
31 |\ branch: both
32 | | tag: tip
33 | | parent: 11:2cbd52c10e88
34 | | parent: 12:66d0c21243be
35 | | user: test
36 | | date: Thu Jan 01 00:00:13 1970 +0000
37 | | summary: debugbuilddag
38 | |
39 | o changeset: 12:66d0c21243be
40 | | branch: both
41 | | parent: 10:9220596cb068
42 | | user: debugbuilddag
43 | | date: Thu Jan 01 02:30:12 1970 +0230
44 | | summary: r12
45 | |
46 o | changeset: 11:2cbd52c10e88
47 |/ branch: both
48 | tag: tmaintip
49 | user: debugbuilddag
50 | date: Thu Jan 01 00:00:11 1970 +0000
51 | summary: r11
52 |
53 o changeset: 10:9220596cb068
54 | branch: both
55 | user: debugbuilddag
56 | date: Thu Jan 01 00:00:10 1970 +0000
57 | summary: r10
58 |
59 o changeset: 9:0767d147d86e
60 |\ branch: both
61 | | parent: 8:0d0219415f18
62 | | parent: 4:e8bc3a6ab9ae
63 | | user: debugbuilddag
64 | | date: Thu Jan 01 00:00:09 1970 +0000
65 | | summary: r9
66 | |
67 | o changeset: 8:0d0219415f18
68 | | branch: name2
69 | | tag: thead2
70 | | user: debugbuilddag
71 | | date: Thu Jan 01 00:00:08 1970 +0000
72 | | summary: r8
73 | |
74 | o changeset: 7:82c6c8b3ac68
75 | | branch: name2
76 | | user: debugbuilddag
77 | | date: Thu Jan 01 00:00:07 1970 +0000
78 | | summary: r7
79 | |
80 | o changeset: 6:94093a13175f
81 | | branch: name2
82 | | user: debugbuilddag
83 | | date: Thu Jan 01 00:00:06 1970 +0000
84 | | summary: r6
85 | |
86 | o changeset: 5:4baee2f72e9e
87 | | branch: name2
88 | | parent: 1:bf4022f1addd
89 | | user: debugbuilddag
90 | | date: Thu Jan 01 00:00:05 1970 +0000
91 | | summary: r5
92 | |
93 o | changeset: 4:e8bc3a6ab9ae
94 | | branch: name1
95 | | tag: thead1
96 | | user: debugbuilddag
97 | | date: Thu Jan 01 00:00:04 1970 +0000
98 | | summary: r4
99 | |
100 o | changeset: 3:46148e496a8a
101 | | branch: name1
102 | | user: debugbuilddag
103 | | date: Thu Jan 01 00:00:03 1970 +0000
104 | | summary: r3
105 | |
106 o | changeset: 2:29863c4219cd
107 |/ branch: name1
108 | user: debugbuilddag
109 | date: Thu Jan 01 00:00:02 1970 +0000
110 | summary: r2
111 |
112 o changeset: 1:bf4022f1addd
113 | tag: tbase
114 | user: debugbuilddag
115 | date: Thu Jan 01 00:00:01 1970 +0000
116 | summary: r1
117 |
118 o changeset: 0:ae6ae30a671b
119 user: debugbuilddag
120 date: Thu Jan 01 00:00:00 1970 +0000
121 summary: r0
122
123
124 $ hg fastexport --export-marks fastexport.marks
125 blob
126 mark :1
127 data 65
128 0 r0
129 1
130 2
131 3
132 4
133 5
134 6
135 7
136 8
137 9
138 10
139 11
140 12
141 13
142 14
143 15
144 16
145 17
146 18
147 19
148 20
149 21
150 22
151 23
152
153 blob
154 mark :2
155 data 3
156 r0
157
158 commit refs/heads/default
159 mark :3
160 committer "debugbuilddag" <debugbuilddag> 0 +0000
161 data 2
162 r0
163 M 644 :1 mf
164 M 644 :2 nf0
165 M 644 :2 of
166
167 blob
168 mark :4
169 data 68
170 0 r0
171 1
172 2 r1
173 3
174 4
175 5
176 6
177 7
178 8
179 9
180 10
181 11
182 12
183 13
184 14
185 15
186 16
187 17
188 18
189 19
190 20
191 21
192 22
193 23
194
195 blob
196 mark :5
197 data 3
198 r1
199
200 blob
201 mark :6
202 data 3
203 r1
204
205 commit refs/heads/default
206 mark :7
207 committer "debugbuilddag" <debugbuilddag> 1 +0000
208 data 2
209 r1
210 from :3
211 M 644 :4 mf
212 M 644 :5 nf1
213 M 644 :6 of
214
215 blob
216 mark :8
217 data 71
218 0 r0
219 1
220 2 r1
221 3
222 4 r2
223 5
224 6
225 7
226 8
227 9
228 10
229 11
230 12
231 13
232 14
233 15
234 16
235 17
236 18
237 19
238 20
239 21
240 22
241 23
242
243 blob
244 mark :9
245 data 3
246 r2
247
248 blob
249 mark :10
250 data 3
251 r2
252
253 commit refs/heads/name1
254 mark :11
255 committer "debugbuilddag" <debugbuilddag> 2 +0000
256 data 2
257 r2
258 from :7
259 M 644 :8 mf
260 M 644 :9 nf2
261 M 644 :10 of
262
263 blob
264 mark :12
265 data 74
266 0 r0
267 1
268 2 r1
269 3
270 4 r2
271 5
272 6 r3
273 7
274 8
275 9
276 10
277 11
278 12
279 13
280 14
281 15
282 16
283 17
284 18
285 19
286 20
287 21
288 22
289 23
290
291 blob
292 mark :13
293 data 3
294 r3
295
296 blob
297 mark :14
298 data 3
299 r3
300
301 commit refs/heads/name1
302 mark :15
303 committer "debugbuilddag" <debugbuilddag> 3 +0000
304 data 2
305 r3
306 from :11
307 M 644 :12 mf
308 M 644 :13 nf3
309 M 644 :14 of
310
311 blob
312 mark :16
313 data 77
314 0 r0
315 1
316 2 r1
317 3
318 4 r2
319 5
320 6 r3
321 7
322 8 r4
323 9
324 10
325 11
326 12
327 13
328 14
329 15
330 16
331 17
332 18
333 19
334 20
335 21
336 22
337 23
338
339 blob
340 mark :17
341 data 3
342 r4
343
344 blob
345 mark :18
346 data 3
347 r4
348
349 commit refs/heads/name1
350 mark :19
351 committer "debugbuilddag" <debugbuilddag> 4 +0000
352 data 2
353 r4
354 from :15
355 M 644 :16 mf
356 M 644 :17 nf4
357 M 644 :18 of
358
359 blob
360 mark :20
361 data 71
362 0 r0
363 1
364 2 r1
365 3
366 4
367 5
368 6
369 7
370 8
371 9
372 10 r5
373 11
374 12
375 13
376 14
377 15
378 16
379 17
380 18
381 19
382 20
383 21
384 22
385 23
386
387 blob
388 mark :21
389 data 3
390 r5
391
392 blob
393 mark :22
394 data 3
395 r5
396
397 commit refs/heads/name2
398 mark :23
399 committer "debugbuilddag" <debugbuilddag> 5 +0000
400 data 2
401 r5
402 from :7
403 M 644 :20 mf
404 M 644 :21 nf5
405 M 644 :22 of
406
407 blob
408 mark :24
409 data 74
410 0 r0
411 1
412 2 r1
413 3
414 4
415 5
416 6
417 7
418 8
419 9
420 10 r5
421 11
422 12 r6
423 13
424 14
425 15
426 16
427 17
428 18
429 19
430 20
431 21
432 22
433 23
434
435 blob
436 mark :25
437 data 3
438 r6
439
440 blob
441 mark :26
442 data 3
443 r6
444
445 commit refs/heads/name2
446 mark :27
447 committer "debugbuilddag" <debugbuilddag> 6 +0000
448 data 2
449 r6
450 from :23
451 M 644 :24 mf
452 M 644 :25 nf6
453 M 644 :26 of
454
455 blob
456 mark :28
457 data 77
458 0 r0
459 1
460 2 r1
461 3
462 4
463 5
464 6
465 7
466 8
467 9
468 10 r5
469 11
470 12 r6
471 13
472 14 r7
473 15
474 16
475 17
476 18
477 19
478 20
479 21
480 22
481 23
482
483 blob
484 mark :29
485 data 3
486 r7
487
488 blob
489 mark :30
490 data 3
491 r7
492
493 commit refs/heads/name2
494 mark :31
495 committer "debugbuilddag" <debugbuilddag> 7 +0000
496 data 2
497 r7
498 from :27
499 M 644 :28 mf
500 M 644 :29 nf7
501 M 644 :30 of
502
503 blob
504 mark :32
505 data 80
506 0 r0
507 1
508 2 r1
509 3
510 4
511 5
512 6
513 7
514 8
515 9
516 10 r5
517 11
518 12 r6
519 13
520 14 r7
521 15
522 16 r8
523 17
524 18
525 19
526 20
527 21
528 22
529 23
530
531 blob
532 mark :33
533 data 3
534 r8
535
536 blob
537 mark :34
538 data 3
539 r8
540
541 commit refs/heads/name2
542 mark :35
543 committer "debugbuilddag" <debugbuilddag> 8 +0000
544 data 2
545 r8
546 from :31
547 M 644 :32 mf
548 M 644 :33 nf8
549 M 644 :34 of
550
551 blob
552 mark :36
553 data 92
554 0 r0
555 1
556 2 r1
557 3
558 4 r2
559 5
560 6 r3
561 7
562 8 r4
563 9
564 10 r5
565 11
566 12 r6
567 13
568 14 r7
569 15
570 16 r8
571 17
572 18 r9
573 19
574 20
575 21
576 22
577 23
578
579 blob
580 mark :37
581 data 3
582 r9
583
584 blob
585 mark :38
586 data 3
587 r9
588
589 commit refs/heads/both
590 mark :39
591 committer "debugbuilddag" <debugbuilddag> 9 +0000
592 data 2
593 r9
594 from :35
595 merge :19
596 M 644 :36 mf
597 M 644 :9 nf2
598 M 644 :13 nf3
599 M 644 :17 nf4
600 M 644 :37 nf9
601 M 644 :38 of
602
603 blob
604 mark :40
605 data 96
606 0 r0
607 1
608 2 r1
609 3
610 4 r2
611 5
612 6 r3
613 7
614 8 r4
615 9
616 10 r5
617 11
618 12 r6
619 13
620 14 r7
621 15
622 16 r8
623 17
624 18 r9
625 19
626 20 r10
627 21
628 22
629 23
630
631 blob
632 mark :41
633 data 4
634 r10
635
636 blob
637 mark :42
638 data 4
639 r10
640
641 commit refs/heads/both
642 mark :43
643 committer "debugbuilddag" <debugbuilddag> 10 +0000
644 data 3
645 r10
646 from :39
647 M 644 :40 mf
648 M 644 :41 nf10
649 M 644 :42 of
650
651 blob
652 mark :44
653 data 100
654 0 r0
655 1
656 2 r1
657 3
658 4 r2
659 5
660 6 r3
661 7
662 8 r4
663 9
664 10 r5
665 11
666 12 r6
667 13
668 14 r7
669 15
670 16 r8
671 17
672 18 r9
673 19
674 20 r10
675 21
676 22 r11
677 23
678
679 blob
680 mark :45
681 data 4
682 r11
683
684 blob
685 mark :46
686 data 4
687 r11
688
689 commit refs/heads/both
690 mark :47
691 committer "debugbuilddag" <debugbuilddag> 11 +0000
692 data 3
693 r11
694 from :43
695 M 644 :44 mf
696 M 644 :45 nf11
697 M 644 :46 of
698
699 commit refs/heads/both
700 mark :48
701 committer "debugbuilddag" <debugbuilddag> 12 +0230
702 data 3
703 r12
704 from :43
705 D nf10
706
707 commit refs/heads/both
708 mark :49
709 committer "test" <test> 13 +0000
710 data 13
711 debugbuilddag
712 from :47
713 merge :48
714 D nf10
715
716 $ cat fastexport.marks
717 e1767c7564f83127d75331428473dd0512b36cc6
718 2c436e3f677d989438ddd9a7e5e4d56e016dfd35
719 ae6ae30a671be09096aaaf51217b3691eec0eee0
720 016f8fd6128ac4bd19ec5a6ae128dadc3873b13f
721 a0e6fc91007068df3bc60f46ce0a893a73189b54
722 1a085e1daf625e186ee0064c64ff41731a901f24
723 bf4022f1addd28523fb1122ac6166a29da58d34c
724 2c45ad1c720111830380baa89a6a16cae1bef688
725 180506669a19f4b8317009fc6fa0043966d1ffb4
726 1ebc486e6a5c2c8ca7e531cf0b63dfcc071ec324
727 29863c4219cd68e0f57aecd5ffc12ba83313f26b
728 d20e5eeac6991189eefad45cd8ea0f6a32ce8122
729 710c4580a600b8aadc63fa3d7bb0fab71b127c04
730 fa27314b56d7b6f90c1caeebb2a74730b3747574
731 46148e496a8a75fde9e203b1ded69ec99289af27
732 e5548c667d7eeb6c326e723c579888341329c9fe
733 3c1407305701051cbed9f9cb9a68bdfb5997c235
734 e2ed51893b0a54bd7fef5a406a0c489d668f19c3
735 e8bc3a6ab9aef589f5db504f401953449a3c3a10
736 558f3a23efc0a1a972e14d5314a65918791b77be
737 0dbd89c185f53a1727c54cd1ce256482fa23968e
738 f84faeb138605b36d74324c6d0ea76a9099c3567
739 4baee2f72e9eeae2aef5b9e1ec416020090672ef
740 412c5793886eaaabb31debd36695f6215a719865
741 a0eafc60760d32b690564b8588ba042cc63e0c74
742 a53842517de32d2f926c38a170c29dc90ae3348a
743 94093a13175f1cfcbbfddaa0ceafbd3a89784b91
744 d2f0d76af0be0da17ec88190215eadb8706689ab
745 639939af794373d6c2ab12c2ef637cd220174389
746 cc8921e2b19a88147643ea825459ffa140e3d704
747 82c6c8b3ac6873fadd9083323b02cc6a53659130
748 c6cc0b14a3e6e61906242d6fce28b9510c9f9208
749 093593169cb4716f94e52ed7561bb84b36b7eb9d
750 034df75dc138e7507e061d26170b4c44321a5d92
751 0d0219415f18c43636163fff4160f41600951a25
752 f13693f6e6052eeb189521945fef56892e812fdb
753 1239c633b8a7a7283825dba9171bf285e5790852
754 34b655bd51e8573b8e85c1c1476a94d8573babef
755 0767d147d86e1546593bda50f1e11276c0ac8f1a
756 284ca43bbbe82e89c0f1d977e8ac6cfb969c05ec
757 15315ab9e272ec81ae8d847996e5bdecd5635b0b
758 78c10aaf21f49d518c7ccb8318c29abb5d4e5db7
759 9220596cb068dfc73e2f7e695dc8ad0858a936db
760 32abd0da49b7c7ee756298fc46a15584d6aedc99
761 33fbc651630ffa7ccbebfe4eb91320a873e7291c
762 868d828870663d075cdcff502d26cf8445ce068e
763 2cbd52c10e88ce604402dc83a869ec4f07765b3d
764 66d0c21243be072f82ced64aa730ab0367252451
765 5544befcb7ce4a558ed9e19909e16af574a2a3c6
766
767 $ hg fastexport --export-marks fastexport.marks2 -r 0
768 blob
769 mark :1
770 data 65
771 0 r0
772 1
773 2
774 3
775 4
776 5
777 6
778 7
779 8
780 9
781 10
782 11
783 12
784 13
785 14
786 15
787 16
788 17
789 18
790 19
791 20
792 21
793 22
794 23
795
796 blob
797 mark :2
798 data 3
799 r0
800
801 commit refs/heads/default
802 mark :3
803 committer "debugbuilddag" <debugbuilddag> 0 +0000
804 data 2
805 r0
806 M 644 :1 mf
807 M 644 :2 nf0
808 M 644 :2 of
809
810 $ cat fastexport.marks2
811 e1767c7564f83127d75331428473dd0512b36cc6
812 2c436e3f677d989438ddd9a7e5e4d56e016dfd35
813 ae6ae30a671be09096aaaf51217b3691eec0eee0
814 $ hg fastexport --import-marks fastexport.marks2 -r 1
815 blob
816 mark :4
817 data 68
818 0 r0
819 1
820 2 r1
821 3
822 4
823 5
824 6
825 7
826 8
827 9
828 10
829 11
830 12
831 13
832 14
833 15
834 16
835 17
836 18
837 19
838 20
839 21
840 22
841 23
842
843 blob
844 mark :5
845 data 3
846 r1
847
848 blob
849 mark :6
850 data 3
851 r1
852
853 commit refs/heads/default
854 mark :7
855 committer "debugbuilddag" <debugbuilddag> 1 +0000
856 data 2
857 r1
858 from :3
859 M 644 :4 mf
860 M 644 :5 nf1
861 M 644 :6 of
862
863 $ echo foo > of
864 $ hg commit --user '<badname> <bad email>' --date 'Fri Jan 02 00:00:00 1970 +0000' -m 'Testcommit'
865 $ hg fastexport --import-marks fastexport.marks -r tip
866 blob
867 mark :50
868 data 4
869 foo
870
871 abort: Unable to parse user into person and email for revision 65a3f69b9b519de73d755472c1ab05990ab8a7f7
872 [255]
873
874 #if symlink
875
876 test symlink conversion
877
878 $ cd ..
879
880 $ hg init test_symlinks
881 $ cd test_symlinks
882 $ ln -s linktarget linkname
883 $ hg add linkname
884 $ hg commit -m symlink --date 'Thu Jan 01 00:00:01 1970 +0000'
885 $ hg fastexport
886 blob
887 mark :1
888 data 10
889 linktarget
890 commit refs/heads/default
891 mark :2
892 committer "test" <test> 1 +0000
893 data 7
894 symlink
895 M 120000 :1 linkname
896
897
898 #endif
899
900 Test error message in case that UTC offset is not a multiple of minutes
901
902 $ cd ..
903
904 $ hg init test_invalid_date
905 $ cd test_invalid_date
906 $ echo a > a
907 $ hg add a
908 $ hg commit -m test_invalid_date --date '0 1'
909 $ hg fastexport --color=never >/dev/null
910 abort: UTC offset in (0.0, 1) is not an integer number of minutes
911 [255]
912
913 $ cd ..
914
915 Mercurial subrepositories are currently not supported. Test that a warning is printed.
916
917 $ hg init test_hg_subrepo
918 $ cd test_hg_subrepo
919 $ echo 'subrepo1 = subrepo1' >> .hgsub
920 $ echo 'subrepo2 = subrepo2' >> .hgsub
921 $ hg add .hgsub
922 $ hg commit -m 'add subrepo'
923 $ hg fastexport
924 blob
925 mark :1
926 data 40
927 subrepo1 = subrepo1
928 subrepo2 = subrepo2
929
930 blob
931 mark :2
932 data 100
933 0000000000000000000000000000000000000000 subrepo1
934 0000000000000000000000000000000000000000 subrepo2
935
936 warning: subrepositories of kind hg are not supported
937 commit refs/heads/default
938 mark :3
939 committer "test" <test> 0 +0000
940 data 11
941 add subrepo
942 M 644 :1 .hgsub
943 M 644 :2 .hgsubstate
944
945 $ cd ..
946
947 #if git
948
949 make git commits repeatable
950
951 $ echo "[core]" >> $HOME/.gitconfig
952 $ echo "autocrlf = false" >> $HOME/.gitconfig
953 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
954 $ GIT_AUTHOR_EMAIL='[email protected]'; export GIT_AUTHOR_EMAIL
955 $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE
956 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
957 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
958 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
959 $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM
960
961 set default branch to value compatible with new and old git version
962
963 $ git config --global init.defaultBranch master
964
965 Test that Git subrepositories are converted to gitlinks and .gitmodules.
966
967 $ hg init test_subrepos
968 $ cd test_subrepos
969
970 $ git init subrepo1_path --quiet
971 $ cd subrepo1_path
972 $ touch first
973 $ git add first
974 $ git commit -m first --quiet
975 $ cd ..
976 $ echo 'subrepo1_path = [git]subrepo1_source' > .hgsub
977 $ hg add .hgsub
978 $ hg commit -m 'add subrepo1'
979
980 $ cd subrepo1_path
981 $ touch second
982 $ git add second
983 $ git commit -m second --quiet
984 $ cd ..
985 $ hg commit -m 'change subrepo1'
986
987 $ git init subrepo2_path --quiet
988 $ cd subrepo2_path
989 $ touch first
990 $ git add first
991 $ git commit -m first --quiet
992 $ cd ..
993 $ echo 'subrepo2_path = [git]subrepo2_source' >> .hgsub
994 $ hg commit -m 'add subrepo2'
995
996 $ mv subrepo2_path subrepo3_path
997 $ sed -e 's/subrepo2/subrepo3/g' .hgsub > tmp
998 $ mv tmp .hgsub
999 $ hg commit -m 'rename subrepo2 -> subrepo3'
1000
1001 $ sed -e '/subrepo3/d' .hgsub > tmp
1002 $ mv tmp .hgsub
1003 $ hg commit -m 'remove subrepo3'
1004
1005 $ hg remove .hgsub
1006 $ hg commit -m 'remove subrepo1'
1007 $ hg fastexport
1008 blob
1009 mark :1
1010 data 37
1011 subrepo1_path = [git]subrepo1_source
1012
1013 blob
1014 mark :2
1015 data 55
1016 f85179a08dbd445ed4b79ad3452de978c54bf8f1 subrepo1_path
1017
1018 commit refs/heads/default
1019 mark :3
1020 committer "test" <test> 0 +0000
1021 data 12
1022 add subrepo1
1023 M 644 inline .gitmodules
1024 data 73
1025 [submodule "subrepo1_path"]
1026 path = subrepo1_path
1027 url = subrepo1_source
1028
1029 M 644 :1 .hgsub
1030 M 644 :2 .hgsubstate
1031 M 160000 f85179a08dbd445ed4b79ad3452de978c54bf8f1 subrepo1_path
1032
1033 blob
1034 mark :4
1035 data 55
1036 eaacdbf2e355ca4095d0230d052a2f979783f181 subrepo1_path
1037
1038 commit refs/heads/default
1039 mark :5
1040 committer "test" <test> 0 +0000
1041 data 15
1042 change subrepo1
1043 from :3
1044 M 644 :4 .hgsubstate
1045 M 160000 eaacdbf2e355ca4095d0230d052a2f979783f181 subrepo1_path
1046
1047 blob
1048 mark :6
1049 data 74
1050 subrepo1_path = [git]subrepo1_source
1051 subrepo2_path = [git]subrepo2_source
1052
1053 blob
1054 mark :7
1055 data 110
1056 eaacdbf2e355ca4095d0230d052a2f979783f181 subrepo1_path
1057 f85179a08dbd445ed4b79ad3452de978c54bf8f1 subrepo2_path
1058
1059 commit refs/heads/default
1060 mark :8
1061 committer "test" <test> 0 +0000
1062 data 12
1063 add subrepo2
1064 from :5
1065 M 644 inline .gitmodules
1066 data 146
1067 [submodule "subrepo1_path"]
1068 path = subrepo1_path
1069 url = subrepo1_source
1070 [submodule "subrepo2_path"]
1071 path = subrepo2_path
1072 url = subrepo2_source
1073
1074 M 644 :6 .hgsub
1075 M 644 :7 .hgsubstate
1076 M 160000 f85179a08dbd445ed4b79ad3452de978c54bf8f1 subrepo2_path
1077
1078 blob
1079 mark :9
1080 data 74
1081 subrepo1_path = [git]subrepo1_source
1082 subrepo3_path = [git]subrepo3_source
1083
1084 blob
1085 mark :10
1086 data 110
1087 eaacdbf2e355ca4095d0230d052a2f979783f181 subrepo1_path
1088 f85179a08dbd445ed4b79ad3452de978c54bf8f1 subrepo3_path
1089
1090 commit refs/heads/default
1091 mark :11
1092 committer "test" <test> 0 +0000
1093 data 27
1094 rename subrepo2 -> subrepo3
1095 from :8
1096 M 644 inline .gitmodules
1097 data 146
1098 [submodule "subrepo1_path"]
1099 path = subrepo1_path
1100 url = subrepo1_source
1101 [submodule "subrepo3_path"]
1102 path = subrepo3_path
1103 url = subrepo3_source
1104
1105 M 644 :9 .hgsub
1106 M 644 :10 .hgsubstate
1107 D subrepo2_path
1108 M 160000 f85179a08dbd445ed4b79ad3452de978c54bf8f1 subrepo3_path
1109
1110 blob
1111 mark :12
1112 data 37
1113 subrepo1_path = [git]subrepo1_source
1114
1115 blob
1116 mark :13
1117 data 55
1118 eaacdbf2e355ca4095d0230d052a2f979783f181 subrepo1_path
1119
1120 commit refs/heads/default
1121 mark :14
1122 committer "test" <test> 0 +0000
1123 data 15
1124 remove subrepo3
1125 from :11
1126 M 644 inline .gitmodules
1127 data 73
1128 [submodule "subrepo1_path"]
1129 path = subrepo1_path
1130 url = subrepo1_source
1131
1132 M 644 :12 .hgsub
1133 M 644 :13 .hgsubstate
1134 D subrepo3_path
1135
1136 commit refs/heads/default
1137 mark :15
1138 committer "test" <test> 0 +0000
1139 data 15
1140 remove subrepo1
1141 from :14
1142 D .gitmodules
1143 D .hgsub
1144 D .hgsubstate
1145 D subrepo1_path
1146
1147
1148 $ cd ..
1149
1150 Test that the presence of .gitmodules in the source repository aborts by default.
1151
1152 $ hg init test_existing_gitmodules-abort
1153 $ cd test_existing_gitmodules-abort
1154
1155 $ git init subrepo_path --quiet
1156 $ cd subrepo_path
1157 $ touch first
1158 $ git add first
1159 $ git commit -m first --quiet
1160 $ cd ..
1161 $ echo 'subrepo_path = [git]subrepo_source' > .hgsub
1162 $ hg add .hgsub
1163 $ cat >> .gitmodules << EOF
1164 > [submodule "subrepo_path"]
1165 > path = subrepo_path
1166 > url = subrepo_source
1167 > EOF
1168 $ hg add .gitmodules
1169 $ hg commit -m 'add subrepo'
1170 $ hg fastexport --color=never >/dev/null
1171 abort: .gitmodules already present in source repository
1172 (to ignore this error, set config fastexport.on-pre-existing-gitmodules=ignore)
1173 [255]
1174
1175 $ cd ..
1176
1177 Test that it is possible to configure that .gitmodules in the source repository is ignored.
1178
1179 $ hg init test_existing_gitmodules-ignore
1180 $ cd test_existing_gitmodules-ignore
1181
1182 $ cat >> .hg/hgrc << EOF
1183 > [fastexport]
1184 > on-pre-existing-gitmodules = ignore
1185 > EOF
1186 $ git init subrepo_path --quiet
1187 $ cd subrepo_path
1188 $ touch first
1189 $ git add first
1190 $ git commit -m first --quiet
1191 $ cd ..
1192 $ echo 'subrepo_path = [git]subrepo_source' > .hgsub
1193 $ hg add .hgsub
1194 $ cat >> .gitmodules << EOF
1195 > [submodule "ignored"]
1196 > path = subrepo_path
1197 > url = subrepo_source
1198 > EOF
1199 $ hg add .gitmodules
1200 $ hg commit -m 'add subrepo'
1201 $ hg fastexport --export-marks fastexport.marks
1202 blob
1203 mark :1
1204 data 35
1205 subrepo_path = [git]subrepo_source
1206
1207 blob
1208 mark :2
1209 data 54
1210 f85179a08dbd445ed4b79ad3452de978c54bf8f1 subrepo_path
1211
1212 warning: ignoring change of .gitmodules in revision b55ff90e601e922957f29294f4eb98ebd2589618
1213 instead, .gitmodules is generated from .hgsub)
1214 commit refs/heads/default
1215 mark :3
1216 committer "test" <test> 0 +0000
1217 data 11
1218 add subrepo
1219 M 644 inline .gitmodules
1220 data 70
1221 [submodule "subrepo_path"]
1222 path = subrepo_path
1223 url = subrepo_source
1224
1225 M 644 :1 .hgsub
1226 M 644 :2 .hgsubstate
1227 M 160000 f85179a08dbd445ed4b79ad3452de978c54bf8f1 subrepo_path
1228
1229
1230 Test that removing .gitmodules from the source repository does not remove the generated .gitmodules.
1231
1232 $ hg rm .gitmodules
1233 $ hg commit -m 'remove .gitmodules'
1234 $ hg fastexport --import-marks fastexport.marks
1235 warning: ignoring change of .gitmodules in revision f592781e95d5fcb42218365b85ff9db1307aabd0
1236 instead, .gitmodules is generated from .hgsub)
1237 commit refs/heads/default
1238 mark :4
1239 committer "test" <test> 0 +0000
1240 data 18
1241 remove .gitmodules
1242 from :3
1243
1244
1245 $ cd ..
1246
1247 $ hg init test_existing_gitmodules-invalid_config
1248 $ cd test_existing_gitmodules-invalid_config
1249
1250 $ cat >> .hg/hgrc << EOF
1251 > [fastexport]
1252 > on-pre-existing-gitmodules = invalid
1253 > EOF
1254 $ touch .gitmodules
1255 $ hg add .gitmodules
1256 $ hg commit -m 'add .gitmodules'
1257 $ hg fastexport --color=never >/dev/null
1258 config error: fastexport.on-pre-existing-gitmodules not valid
1259 (should be 'abort' or 'ignore', but is 'invalid')
1260 [30]
1261
1262 #endif git