Show More
@@ -1,29 +1,86 b'' | |||||
1 | #!/bin/sh |
|
1 | ||
|
2 | $ "$TESTDIR/hghave" svn svn-bindings || exit 80 | |||
2 |
|
3 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
4 | $ cat > $HGRCPATH <<EOF | |
|
5 | > [extensions] | |||
|
6 | > convert = | |||
|
7 | > graphlog = | |||
|
8 | > EOF | |||
|
9 | ||||
|
10 | $ svnadmin create svn-repo | |||
|
11 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/branches.svndump" | |||
|
12 | ||||
|
13 | Convert trunk and branches | |||
4 |
|
14 | |||
5 | echo "[extensions]" >> $HGRCPATH |
|
15 | $ cat > branchmap <<EOF | |
6 | echo "convert = " >> $HGRCPATH |
|
16 | > old3 newbranch | |
7 | echo "graphlog =" >> $HGRCPATH |
|
17 | > EOF | |
|
18 | $ hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg | |||
|
19 | initializing destination A-hg repository | |||
|
20 | scanning source... | |||
|
21 | sorting... | |||
|
22 | converting... | |||
|
23 | 10 init projA | |||
|
24 | 9 hello | |||
|
25 | 8 branch trunk, remove c and dir | |||
|
26 | 7 change a | |||
|
27 | 6 change b | |||
|
28 | 5 move and update c | |||
|
29 | 4 move and update c | |||
|
30 | 3 change b again | |||
|
31 | 2 move to old2 | |||
|
32 | 1 move back to old | |||
|
33 | 0 last change to a | |||
8 |
|
34 | |||
9 | svnadmin create svn-repo |
|
35 | Convert again | |
10 | cat "$TESTDIR/svn/branches.svndump" | svnadmin load svn-repo > /dev/null |
|
36 | ||
|
37 | $ hg convert --branchmap=branchmap --datesort svn-repo A-hg | |||
|
38 | scanning source... | |||
|
39 | sorting... | |||
|
40 | converting... | |||
|
41 | 0 branch trunk@1 into old3 | |||
11 |
|
42 | |||
12 | echo % convert trunk and branches |
|
43 | $ cd A-hg | |
13 | cat >branchmap <<EOF |
|
44 | $ hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n' | |
14 | old3 newbranch |
|
45 | o branch=newbranch 11 branch trunk@1 into old3 files: | |
15 | EOF |
|
46 | | | |
16 | hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg |
|
47 | | o branch= 10 last change to a files: a | |
17 |
|
48 | | | | ||
18 | echo % convert again |
|
49 | | | o branch=old 9 move back to old files: | |
19 | hg convert --branchmap=branchmap --datesort svn-repo A-hg |
|
50 | | | | | |
|
51 | | | o branch=old2 8 move to old2 files: | |||
|
52 | | | | | |||
|
53 | | | o branch=old 7 change b again files: b | |||
|
54 | | | | | |||
|
55 | | o | branch= 6 move and update c files: b | |||
|
56 | | | | | |||
|
57 | | | o branch=old 5 move and update c files: c | |||
|
58 | | | | | |||
|
59 | | | o branch=old 4 change b files: b | |||
|
60 | | | | | |||
|
61 | | o | branch= 3 change a files: a | |||
|
62 | | | | | |||
|
63 | | | o branch=old 2 branch trunk, remove c and dir files: c | |||
|
64 | | |/ | |||
|
65 | | o branch= 1 hello files: a b c dir/e | |||
|
66 | |/ | |||
|
67 | o branch= 0 init projA files: | |||
20 |
|
68 | |||
21 | cd A-hg |
|
|||
22 | hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n' |
|
|||
23 | hg branches | sed 's/:.*/:/' |
|
|||
24 | hg tags -q |
|
|||
25 | cd .. |
|
|||
26 |
|
69 | |||
27 | echo '% test hg failing to call itself' |
|
70 | $ hg branches | |
28 | HG=foobar hg convert svn-repo B-hg 2>&1 | grep itself |
|
71 | newbranch 11:08fca3ff8634 | |
|
72 | default 10:098988aa63ba | |||
|
73 | old 9:b308f345079b | |||
|
74 | old2 8:49f2336c7b8b (inactive) | |||
|
75 | $ hg tags -q | |||
|
76 | tip | |||
|
77 | $ cd .. | |||
29 |
|
78 | |||
|
79 | Test hg failing to call itself | |||
|
80 | ||||
|
81 | $ HG=foobar hg convert svn-repo B-hg | |||
|
82 | .* | |||
|
83 | initializing destination B-hg repository | |||
|
84 | abort: Mercurial failed to run itself, check hg executable is in PATH | |||
|
85 | [255] | |||
|
86 |
@@ -1,17 +1,135 b'' | |||||
1 | #!/bin/sh |
|
1 | ||
|
2 | $ "$TESTDIR/hghave" svn svn-bindings || exit 80 | |||
2 |
|
3 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
4 | $ cat > $HGRCPATH <<EOF | |
|
5 | > [extensions] | |||
|
6 | > convert = | |||
|
7 | > graphlog = | |||
|
8 | > EOF | |||
4 |
|
9 | |||
5 | echo "[extensions]" >> $HGRCPATH |
|
10 | $ svnadmin create svn-repo | |
6 | echo "convert = " >> $HGRCPATH |
|
11 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/encoding.svndump" | |
|
12 | ||||
|
13 | Convert while testing all possible outputs | |||
7 |
|
14 | |||
8 | svnadmin create svn-repo |
|
15 | $ hg --debug convert svn-repo A-hg | |
9 | cat "$TESTDIR/svn/encoding.svndump" | svnadmin load svn-repo > /dev/null |
|
16 | initializing destination A-hg repository | |
|
17 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo | |||
|
18 | run hg sink pre-conversion action | |||
|
19 | scanning source... | |||
|
20 | found trunk at 'trunk' | |||
|
21 | found tags at 'tags' | |||
|
22 | found branches at 'branches' | |||
|
23 | found branch branché at 5 | |||
|
24 | found branch branchée at 6 | |||
|
25 | scanning: 1 revisions | |||
|
26 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk | |||
|
27 | fetching revision log for "/trunk" from 4 to 0 | |||
|
28 | parsing revision 4 (2 changes) | |||
|
29 | parsing revision 3 (4 changes) | |||
|
30 | parsing revision 2 (3 changes) | |||
|
31 | parsing revision 1 (3 changes) | |||
|
32 | no copyfrom path, don't know what to do. | |||
|
33 | '/branches' is not under '/trunk', ignoring | |||
|
34 | '/tags' is not under '/trunk', ignoring | |||
|
35 | scanning: 2 revisions | |||
|
36 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9 | |||
|
37 | fetching revision log for "/branches/branché" from 5 to 0 | |||
|
38 | parsing revision 5 (1 changes) | |||
|
39 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo | |||
|
40 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9 | |||
|
41 | found parent of branch /branches/branché at 4: /trunk | |||
|
42 | scanning: 3 revisions | |||
|
43 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e | |||
|
44 | fetching revision log for "/branches/branchée" from 6 to 0 | |||
|
45 | parsing revision 6 (1 changes) | |||
|
46 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo | |||
|
47 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e | |||
|
48 | found parent of branch /branches/branchée at 5: /branches/branché | |||
|
49 | scanning: 4 revisions | |||
|
50 | scanning: 5 revisions | |||
|
51 | scanning: 6 revisions | |||
|
52 | sorting... | |||
|
53 | converting... | |||
|
54 | 5 init projA | |||
|
55 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@1 | |||
|
56 | converting: 0/6 revisions (0.00%) | |||
|
57 | 4 hello | |||
|
58 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@2 | |||
|
59 | converting: 1/6 revisions (16.67%) | |||
|
60 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk | |||
|
61 | scanning paths: /trunk/à 0/3 (0.00%) | |||
|
62 | scanning paths: /trunk/à/é 1/3 (33.33%) | |||
|
63 | scanning paths: /trunk/é 2/3 (66.67%) | |||
|
64 | à/é | |||
|
65 | getting files: à/é 1/2 (50.00%) | |||
|
66 | é | |||
|
67 | getting files: é 2/2 (100.00%) | |||
|
68 | 3 copy files | |||
|
69 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@3 | |||
|
70 | converting: 2/6 revisions (33.33%) | |||
|
71 | scanning paths: /trunk/à 0/4 (0.00%) | |||
|
72 | gone from -1 | |||
|
73 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo | |||
|
74 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk | |||
|
75 | scanning paths: /trunk/è 1/4 (25.00%) | |||
|
76 | copied to è from é@2 | |||
|
77 | scanning paths: /trunk/é 2/4 (50.00%) | |||
|
78 | gone from -1 | |||
|
79 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo | |||
|
80 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk | |||
|
81 | scanning paths: /trunk/ù 3/4 (75.00%) | |||
|
82 | mark /trunk/ù came from à:2 | |||
|
83 | à/é | |||
|
84 | getting files: à/é 1/4 (25.00%) | |||
|
85 | è | |||
|
86 | getting files: è 2/4 (50.00%) | |||
|
87 | è: copy é:6b67ccefd5ce6de77e7ead4f5292843a0255329f | |||
|
88 | é | |||
|
89 | getting files: é 3/4 (75.00%) | |||
|
90 | ù/é | |||
|
91 | getting files: ù/é 4/4 (100.00%) | |||
|
92 | ù/é: copy à/é:a9092a3d84a37b9993b5c73576f6de29b7ea50f6 | |||
|
93 | 2 remove files | |||
|
94 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@4 | |||
|
95 | converting: 3/6 revisions (50.00%) | |||
|
96 | scanning paths: /trunk/è 0/2 (0.00%) | |||
|
97 | gone from -1 | |||
|
98 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo | |||
|
99 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk | |||
|
100 | scanning paths: /trunk/ù 1/2 (50.00%) | |||
|
101 | gone from -1 | |||
|
102 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo | |||
|
103 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/trunk | |||
|
104 | è | |||
|
105 | getting files: è 1/2 (50.00%) | |||
|
106 | ù/é | |||
|
107 | getting files: ù/é 2/2 (100.00%) | |||
|
108 | 1 branch to branch? | |||
|
109 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?@5 | |||
|
110 | converting: 4/6 revisions (66.67%) | |||
|
111 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9 | |||
|
112 | scanning paths: /branches/branché 0/1 (0.00%) | |||
|
113 | 0 branch to branch?e | |||
|
114 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?e@6 | |||
|
115 | converting: 5/6 revisions (83.33%) | |||
|
116 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e | |||
|
117 | scanning paths: /branches/branchée 0/1 (0.00%) | |||
|
118 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo | |||
|
119 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e | |||
|
120 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo | |||
|
121 | reparent to file://.*/test-convert-svn-encoding.t/svn-repo/branches/branch%C3%A9e | |||
|
122 | updating tags | |||
|
123 | .hgtags | |||
|
124 | run hg sink post-conversion action | |||
|
125 | $ cd A-hg | |||
|
126 | $ hg up | |||
|
127 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
10 |
|
128 | |||
11 | echo '% convert while testing all possible outputs' |
|
129 | Check tags are in UTF-8 | |
12 | hg --debug convert svn-repo A-hg > /dev/null |
|
130 | ||
13 | cd A-hg |
|
131 | $ python -c "print '\n'.join([('%r' % l) for l in file('.hgtags', 'rb').readlines()])" | |
14 | hg up |
|
132 | '221c3fdaf24df5f14c0a64c597581e2eacfb47bb branch\xc3\xa9e\n' | |
15 | echo '% check tags are in UTF-8' |
|
133 | '7a40952c2db29cf00d9e31df3749e98d8a4bdcbf branch\xc3\xa9\n' | |
16 | python -c "print '\n'.join([('%r' % l) for l in file('.hgtags', 'rb').readlines()])" |
|
134 | ||
17 | cd .. |
|
135 | $ cd .. |
@@ -1,70 +1,202 b'' | |||||
1 | #!/bin/sh |
|
1 | ||
|
2 | $ "$TESTDIR/hghave" svn svn-bindings || exit 80 | |||
2 |
|
3 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
4 | $ fixpath() | |
|
5 | > { | |||
|
6 | > tr '\\' / | |||
|
7 | > } | |||
|
8 | $ cat > $HGRCPATH <<EOF | |||
|
9 | > [extensions] | |||
|
10 | > convert = | |||
|
11 | > graphlog = | |||
|
12 | > EOF | |||
|
13 | ||||
|
14 | $ svnadmin create svn-repo | |||
|
15 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/move.svndump" | |||
|
16 | $ svnpath=`pwd | fixpath` | |||
|
17 | ||||
|
18 | SVN wants all paths to start with a slash. Unfortunately, | |||
|
19 | Windows ones don't. Handle that. | |||
4 |
|
20 | |||
5 | fix_path() |
|
21 | $ expr "$svnpath" : "\/" > /dev/null | |
6 | { |
|
22 | > if [ $? -ne 0 ]; then | |
7 | tr '\\' / |
|
23 | > svnpath="/$svnpath" | |
8 | } |
|
24 | > fi | |
|
25 | > svnurl="file://$svnpath/svn-repo" | |||
|
26 | ||||
|
27 | Convert trunk and branches | |||
9 |
|
28 | |||
10 | echo "[extensions]" >> $HGRCPATH |
|
29 | $ hg convert --datesort "$svnurl"/subproject A-hg | |
11 | echo "convert = " >> $HGRCPATH |
|
30 | initializing destination A-hg repository | |
12 | echo "hgext.graphlog =" >> $HGRCPATH |
|
31 | scanning source... | |
|
32 | sorting... | |||
|
33 | converting... | |||
|
34 | 13 createtrunk | |||
|
35 | 12 moved1 | |||
|
36 | 11 moved1 | |||
|
37 | 10 moved2 | |||
|
38 | 9 changeb and rm d2 | |||
|
39 | 8 changeb and rm d2 | |||
|
40 | 7 moved1again | |||
|
41 | 6 moved1again | |||
|
42 | 5 copyfilefrompast | |||
|
43 | 4 copydirfrompast | |||
|
44 | 3 add d3 | |||
|
45 | 2 copy dir and remove subdir | |||
|
46 | 1 add d4old | |||
|
47 | 0 rename d4old into d4new | |||
13 |
|
48 | |||
14 | svnadmin create svn-repo |
|
49 | $ cd A-hg | |
15 | cat "$TESTDIR/svn/move.svndump" | svnadmin load svn-repo > /dev/null |
|
50 | $ hg glog --template '{rev} {desc|firstline} files: {files}\n' | |
|
51 | o 13 rename d4old into d4new files: d4new/g d4old/g | |||
|
52 | | | |||
|
53 | o 12 add d4old files: d4old/g | |||
|
54 | | | |||
|
55 | o 11 copy dir and remove subdir files: d3/d31/e d4/d31/e d4/f | |||
|
56 | | | |||
|
57 | o 10 add d3 files: d3/d31/e d3/f | |||
|
58 | | | |||
|
59 | o 9 copydirfrompast files: d2/d | |||
|
60 | | | |||
|
61 | o 8 copyfilefrompast files: d | |||
|
62 | | | |||
|
63 | o 7 moved1again files: d1/b d1/c | |||
|
64 | | | |||
|
65 | | o 6 moved1again files: | |||
|
66 | | | | |||
|
67 | o | 5 changeb and rm d2 files: d1/b d2/d | |||
|
68 | | | | |||
|
69 | | o 4 changeb and rm d2 files: b | |||
|
70 | | | | |||
|
71 | o | 3 moved2 files: d2/d | |||
|
72 | | | | |||
|
73 | o | 2 moved1 files: d1/b d1/c | |||
|
74 | | | | |||
|
75 | | o 1 moved1 files: b c | |||
|
76 | | | |||
|
77 | o 0 createtrunk files: | |||
16 |
|
78 | |||
17 | svnpath=`pwd | fix_path` |
|
79 | ||
18 | # SVN wants all paths to start with a slash. Unfortunately, |
|
80 | Check move copy records | |
19 | # Windows ones don't. Handle that. |
|
81 | ||
20 | expr "$svnpath" : "\/" > /dev/null |
|
82 | $ hg st --rev 12:13 --copies | |
21 | if [ $? -ne 0 ]; then |
|
83 | A d4new/g | |
22 | svnpath="/$svnpath" |
|
84 | d4old/g | |
23 | fi |
|
85 | R d4old/g | |
24 | svnurl="file://$svnpath/svn-repo" |
|
86 | ||
|
87 | Check branches | |||
25 |
|
88 | |||
26 | echo % convert trunk and branches |
|
89 | $ hg branches | |
27 | hg convert --datesort "$svnurl"/subproject A-hg |
|
90 | default 13:.* | |
|
91 | d1 6:.* | |||
|
92 | $ cd .. | |||
|
93 | ||||
|
94 | $ mkdir test-replace | |||
|
95 | $ cd test-replace | |||
|
96 | $ svnadmin create svn-repo | |||
|
97 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/replace.svndump" | |||
|
98 | ||||
|
99 | Convert files being replaced by directories | |||
28 |
|
100 | |||
29 | cd A-hg |
|
101 | $ hg convert svn-repo hg-repo | |
30 | hg glog --template '{rev} {desc|firstline} files: {files}\n' |
|
102 | initializing destination hg-repo repository | |
31 | echo '% check move copy records' |
|
103 | scanning source... | |
32 | hg st --rev 12:13 --copies |
|
104 | sorting... | |
33 | echo '% check branches' |
|
105 | converting... | |
34 | hg branches | sed 's/:.*/:/' |
|
106 | 3 initial | |
35 | cd .. |
|
107 | 2 clobber symlink | |
|
108 | 1 clobber1 | |||
|
109 | 0 clobber2 | |||
|
110 | ||||
|
111 | $ cd hg-repo | |||
|
112 | ||||
|
113 | Manifest before | |||
|
114 | ||||
|
115 | $ hg -v manifest -r 1 | |||
|
116 | 644 a | |||
|
117 | 644 d/b | |||
|
118 | 644 @ dlink | |||
|
119 | 644 @ dlink2 | |||
|
120 | 644 dlink3 | |||
|
121 | ||||
|
122 | Manifest after clobber1 | |||
36 |
|
123 | |||
37 | mkdir test-replace |
|
124 | $ hg -v manifest -r 2 | |
38 | cd test-replace |
|
125 | 644 a/b | |
39 | svnadmin create svn-repo |
|
126 | 644 d/b | |
40 | cat "$TESTDIR/svn/replace.svndump" | svnadmin load svn-repo > /dev/null |
|
127 | 644 dlink/b | |
|
128 | 644 @ dlink2 | |||
|
129 | 644 dlink3 | |||
|
130 | ||||
|
131 | Manifest after clobber2 | |||
|
132 | ||||
|
133 | $ hg -v manifest -r 3 | |||
|
134 | 644 a/b | |||
|
135 | 644 d/b | |||
|
136 | 644 dlink/b | |||
|
137 | 644 @ dlink2 | |||
|
138 | 644 @ dlink3 | |||
|
139 | ||||
|
140 | Try updating | |||
|
141 | ||||
|
142 | $ hg up -qC default | |||
|
143 | $ cd .. | |||
|
144 | ||||
|
145 | Test convert progress bar' | |||
41 |
|
146 | |||
42 | echo '% convert files being replaced by directories' |
|
147 | $ cat >> $HGRCPATH <<EOF | |
43 | hg convert svn-repo hg-repo |
|
148 | > [extensions] | |
44 | cd hg-repo |
|
149 | > progress = | |
45 | echo '% manifest before' |
|
150 | > [progress] | |
46 | hg -v manifest -r 1 |
|
151 | > assume-tty = 1 | |
47 | echo '% manifest after clobber1' |
|
152 | > delay = 0 | |
48 | hg -v manifest -r 2 |
|
153 | > refresh = 0 | |
49 | echo '% manifest after clobber2' |
|
154 | > EOF | |
50 | hg -v manifest -r 3 |
|
155 | $ cat > filtercr.py <<EOF | |
51 | echo '% try updating' |
|
156 | > import sys, re | |
52 | hg up -qC default |
|
157 | > for line in sys.stdin: | |
53 | cd .. |
|
158 | > line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line) | |
|
159 | > sys.stdout.write(line) | |||
|
160 | > EOF | |||
54 |
|
161 | |||
55 | echo '% test convert progress bar' |
|
162 | $ hg convert svn-repo hg-progress 2>&1 | python filtercr.py | |
|
163 | ||||
|
164 | scanning [ <=> ] 1 | |||
|
165 | scanning [ <=> ] 2 | |||
|
166 | scanning [ <=> ] 3 | |||
|
167 | scanning [ <=> ] 4 | |||
56 |
|
168 | |||
57 | echo "progress=" >> $HGRCPATH |
|
169 | converting [ ] 0/4 | |
58 | echo "[progress]" >> $HGRCPATH |
|
170 | getting files [==========> ] 1/5 | |
59 | echo "assume-tty=1" >> $HGRCPATH |
|
171 | getting files [======================> ] 2/5 | |
60 | echo "delay=0" >> $HGRCPATH |
|
172 | getting files [==================================> ] 3/5 | |
61 | echo "refresh=0" >> $HGRCPATH |
|
173 | getting files [==============================================> ] 4/5 | |
|
174 | getting files [==========================================================>] 5/5 | |||
|
175 | ||||
|
176 | converting [==============> ] 1/4 | |||
|
177 | scanning paths [ ] 0/1 | |||
|
178 | ||||
|
179 | getting files [==========================================================>] 1/1 | |||
|
180 | ||||
|
181 | converting [==============================> ] 2/4 | |||
|
182 | scanning paths [ ] 0/2 | |||
|
183 | scanning paths [============================> ] 1/2 | |||
62 |
|
184 | |||
63 | cat > filtercr.py <<EOF |
|
185 | getting files [=============> ] 1/4 | |
64 | import sys, re |
|
186 | getting files [============================> ] 2/4 | |
65 | for line in sys.stdin: |
|
187 | getting files [===========================================> ] 3/4 | |
66 | line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line) |
|
188 | getting files [==========================================================>] 4/4 | |
67 | sys.stdout.write(line) |
|
189 | ||
68 | EOF |
|
190 | converting [=============================================> ] 3/4 | |
|
191 | scanning paths [ ] 0/1 | |||
69 |
|
192 | |||
70 | hg convert svn-repo hg-progress 2>&1 | python filtercr.py |
|
193 | getting files [==========================================================>] 1/1 | |
|
194 | ||||
|
195 | initializing destination hg-progress repository | |||
|
196 | scanning source... | |||
|
197 | sorting... | |||
|
198 | converting... | |||
|
199 | 3 initial | |||
|
200 | 2 clobber symlink | |||
|
201 | 1 clobber1 | |||
|
202 | 0 clobber2 |
This diff has been collapsed as it changes many lines, (638 lines changed) Show them Hide them | |||||
@@ -1,150 +1,548 b'' | |||||
1 | #!/bin/sh |
|
1 | ||
|
2 | $ "$TESTDIR/hghave" svn svn-bindings no-outer-repo || exit 80 | |||
2 |
|
3 | |||
3 | "$TESTDIR/hghave" svn svn-bindings no-outer-repo || exit 80 |
|
4 | $ fixpath() | |
|
5 | > { | |||
|
6 | > tr '\\' / | |||
|
7 | > } | |||
|
8 | $ svnupanddisplay() | |||
|
9 | > { | |||
|
10 | > ( | |||
|
11 | > cd $1; | |||
|
12 | > svn up; | |||
|
13 | > svn st -v | fixpath | sed 's/ */ /g' | |||
|
14 | > limit='' | |||
|
15 | > if [ $2 -gt 0 ]; then | |||
|
16 | > limit="--limit=$2" | |||
|
17 | > fi | |||
|
18 | > svn log --xml -v $limit \ | |||
|
19 | > | fixpath \ | |||
|
20 | > | sed 's,<date>.*,<date/>,' \ | |||
|
21 | > | grep -v 'kind="' | |||
|
22 | > ) | |||
|
23 | > } | |||
4 |
|
24 | |||
5 | fixpath() |
|
25 | $ cat > $HGRCPATH <<EOF | |
6 | { |
|
26 | > [extensions] | |
7 | tr '\\' / |
|
27 | > convert = | |
8 | } |
|
28 | > graphlog = | |
|
29 | > EOF | |||
|
30 | ||||
|
31 | $ hg init a | |||
|
32 | ||||
|
33 | Add | |||
|
34 | ||||
|
35 | $ echo a > a/a | |||
|
36 | $ mkdir -p a/d1/d2 | |||
|
37 | $ echo b > a/d1/d2/b | |||
|
38 | $ ln -s a/missing a/link | |||
|
39 | $ hg --cwd a ci -d '0 0' -A -m 'add a file' | |||
|
40 | adding a | |||
|
41 | adding d1/d2/b | |||
|
42 | adding link | |||
|
43 | ||||
|
44 | Modify | |||
|
45 | ||||
|
46 | $ "$TESTDIR/svn-safe-append.py" a a/a | |||
|
47 | $ hg --cwd a ci -d '1 0' -m 'modify a file' | |||
|
48 | $ hg --cwd a tip -q | |||
|
49 | 1:8231f652da37 | |||
9 |
|
50 | |||
10 | svnupanddisplay() |
|
51 | $ hg convert -d svn a | |
11 | { |
|
52 | assuming destination a-hg | |
12 | ( |
|
53 | initializing svn repository 'a-hg' | |
13 | cd $1; |
|
54 | initializing svn working copy 'a-hg-wc' | |
14 | svn up; |
|
55 | scanning source... | |
15 | svn st -v | fixpath | sed 's/ */ /g' |
|
56 | sorting... | |
16 | limit='' |
|
57 | converting... | |
17 | if [ $2 -gt 0 ]; then |
|
58 | 1 add a file | |
18 | limit="--limit=$2" |
|
59 | 0 modify a file | |
19 | fi |
|
60 | $ svnupanddisplay a-hg-wc 2 | |
20 | svn log --xml -v $limit | fixpath | sed 's,<date>.*,<date/>,' | grep -v 'kind="' |
|
61 | At revision 2. | |
21 | ) |
|
62 | 2 2 test . | |
22 | } |
|
63 | 2 2 test a | |
|
64 | 2 1 test d1 | |||
|
65 | 2 1 test d1/d2 | |||
|
66 | 2 1 test d1/d2/b | |||
|
67 | 2 1 test link | |||
|
68 | <?xml version="1.0"?> | |||
|
69 | <log> | |||
|
70 | <logentry | |||
|
71 | revision="2"> | |||
|
72 | <author>test</author> | |||
|
73 | <date/> | |||
|
74 | <paths> | |||
|
75 | <path | |||
|
76 | action="M">/a</path> | |||
|
77 | </paths> | |||
|
78 | <msg>modify a file</msg> | |||
|
79 | </logentry> | |||
|
80 | <logentry | |||
|
81 | revision="1"> | |||
|
82 | <author>test</author> | |||
|
83 | <date/> | |||
|
84 | <paths> | |||
|
85 | <path | |||
|
86 | action="A">/a</path> | |||
|
87 | <path | |||
|
88 | action="A">/d1</path> | |||
|
89 | <path | |||
|
90 | action="A">/d1/d2</path> | |||
|
91 | <path | |||
|
92 | action="A">/d1/d2/b</path> | |||
|
93 | <path | |||
|
94 | action="A">/link</path> | |||
|
95 | </paths> | |||
|
96 | <msg>add a file</msg> | |||
|
97 | </logentry> | |||
|
98 | </log> | |||
|
99 | $ ls a a-hg-wc | |||
|
100 | a: | |||
|
101 | a | |||
|
102 | d1 | |||
|
103 | link | |||
23 |
|
104 | |||
24 | echo "[extensions]" >> $HGRCPATH |
|
105 | a-hg-wc: | |
25 | echo "convert = " >> $HGRCPATH |
|
106 | a | |
26 |
|
107 | d1 | ||
27 | hg init a |
|
108 | link | |
|
109 | $ cmp a/a a-hg-wc/a | |||
28 |
|
110 | |||
29 | echo a > a/a |
|
111 | Rename | |
30 | mkdir -p a/d1/d2 |
|
112 | ||
31 | echo b > a/d1/d2/b |
|
113 | $ hg --cwd a mv a b | |
32 | ln -s a/missing a/link |
|
114 | $ hg --cwd a mv link newlink | |
33 | echo % add |
|
115 | ||
34 |
hg --cwd a ci -d ' |
|
116 | $ hg --cwd a ci -d '2 0' -m 'rename a file' | |
|
117 | $ hg --cwd a tip -q | |||
|
118 | 2:a67e26ccec09 | |||
35 |
|
119 | |||
36 | "$TESTDIR/svn-safe-append.py" a a/a |
|
120 | $ hg convert -d svn a | |
37 | echo % modify |
|
121 | assuming destination a-hg | |
38 | hg --cwd a ci -d '1 0' -m 'modify a file' |
|
122 | initializing svn working copy 'a-hg-wc' | |
39 | hg --cwd a tip -q |
|
123 | scanning source... | |
|
124 | sorting... | |||
|
125 | converting... | |||
|
126 | 0 rename a file | |||
|
127 | $ svnupanddisplay a-hg-wc 1 | |||
|
128 | At revision 3. | |||
|
129 | 3 3 test . | |||
|
130 | 3 3 test b | |||
|
131 | 3 1 test d1 | |||
|
132 | 3 1 test d1/d2 | |||
|
133 | 3 1 test d1/d2/b | |||
|
134 | 3 3 test newlink | |||
|
135 | <?xml version="1.0"?> | |||
|
136 | <log> | |||
|
137 | <logentry | |||
|
138 | revision="3"> | |||
|
139 | <author>test</author> | |||
|
140 | <date/> | |||
|
141 | <paths> | |||
|
142 | <path | |||
|
143 | action="D">/a</path> | |||
|
144 | <path | |||
|
145 | copyfrom-path="/a" | |||
|
146 | copyfrom-rev="2" | |||
|
147 | action="A">/b</path> | |||
|
148 | <path | |||
|
149 | copyfrom-path="/link" | |||
|
150 | copyfrom-rev="2" | |||
|
151 | action="A">/newlink</path> | |||
|
152 | <path | |||
|
153 | action="D">/link</path> | |||
|
154 | </paths> | |||
|
155 | <msg>rename a file</msg> | |||
|
156 | </logentry> | |||
|
157 | </log> | |||
|
158 | $ ls a a-hg-wc | |||
|
159 | a: | |||
|
160 | b | |||
|
161 | d1 | |||
|
162 | newlink | |||
40 |
|
163 | |||
41 | hg convert -d svn a |
|
164 | a-hg-wc: | |
42 | svnupanddisplay a-hg-wc 2 |
|
165 | b | |
43 | ls a a-hg-wc |
|
166 | d1 | |
44 | cmp a/a a-hg-wc/a && echo same || echo different |
|
167 | newlink | |
45 |
|
168 | |||
46 | hg --cwd a mv a b |
|
169 | Copy | |
47 | hg --cwd a mv link newlink |
|
170 | ||
48 | echo % rename |
|
171 | $ hg --cwd a cp b c | |
49 | hg --cwd a ci -d '2 0' -m 'rename a file' |
|
172 | ||
50 | hg --cwd a tip -q |
|
173 | $ hg --cwd a ci -d '3 0' -m 'copy a file' | |
|
174 | $ hg --cwd a tip -q | |||
|
175 | 3:0cf087b9ab02 | |||
51 |
|
176 | |||
52 | hg convert -d svn a |
|
177 | $ hg convert -d svn a | |
53 | svnupanddisplay a-hg-wc 1 |
|
178 | assuming destination a-hg | |
54 | ls a a-hg-wc |
|
179 | initializing svn working copy 'a-hg-wc' | |
|
180 | scanning source... | |||
|
181 | sorting... | |||
|
182 | converting... | |||
|
183 | 0 copy a file | |||
|
184 | $ svnupanddisplay a-hg-wc 1 | |||
|
185 | At revision 4. | |||
|
186 | 4 4 test . | |||
|
187 | 4 3 test b | |||
|
188 | 4 4 test c | |||
|
189 | 4 1 test d1 | |||
|
190 | 4 1 test d1/d2 | |||
|
191 | 4 1 test d1/d2/b | |||
|
192 | 4 3 test newlink | |||
|
193 | <?xml version="1.0"?> | |||
|
194 | <log> | |||
|
195 | <logentry | |||
|
196 | revision="4"> | |||
|
197 | <author>test</author> | |||
|
198 | <date/> | |||
|
199 | <paths> | |||
|
200 | <path | |||
|
201 | copyfrom-path="/b" | |||
|
202 | copyfrom-rev="3" | |||
|
203 | action="A">/c</path> | |||
|
204 | </paths> | |||
|
205 | <msg>copy a file</msg> | |||
|
206 | </logentry> | |||
|
207 | </log> | |||
|
208 | $ ls a a-hg-wc | |||
|
209 | a: | |||
|
210 | b | |||
|
211 | c | |||
|
212 | d1 | |||
|
213 | newlink | |||
55 |
|
214 | |||
56 | hg --cwd a cp b c |
|
215 | a-hg-wc: | |
57 | echo % copy |
|
216 | b | |
58 | hg --cwd a ci -d '3 0' -m 'copy a file' |
|
217 | c | |
59 | hg --cwd a tip -q |
|
218 | d1 | |
|
219 | newlink | |||
60 |
|
220 | |||
61 | hg convert -d svn a |
|
221 | $ hg --cwd a rm b | |
62 | svnupanddisplay a-hg-wc 1 |
|
222 | $ echo % remove | |
63 | ls a a-hg-wc |
|
223 | % remove | |
|
224 | $ hg --cwd a ci -d '4 0' -m 'remove a file' | |||
|
225 | $ hg --cwd a tip -q | |||
|
226 | 4:07b2e34a5b17 | |||
64 |
|
227 | |||
65 | hg --cwd a rm b |
|
228 | $ hg convert -d svn a | |
66 | echo % remove |
|
229 | assuming destination a-hg | |
67 | hg --cwd a ci -d '4 0' -m 'remove a file' |
|
230 | initializing svn working copy 'a-hg-wc' | |
68 | hg --cwd a tip -q |
|
231 | scanning source... | |
|
232 | sorting... | |||
|
233 | converting... | |||
|
234 | 0 remove a file | |||
|
235 | $ svnupanddisplay a-hg-wc 1 | |||
|
236 | At revision 5. | |||
|
237 | 5 5 test . | |||
|
238 | 5 4 test c | |||
|
239 | 5 1 test d1 | |||
|
240 | 5 1 test d1/d2 | |||
|
241 | 5 1 test d1/d2/b | |||
|
242 | 5 3 test newlink | |||
|
243 | <?xml version="1.0"?> | |||
|
244 | <log> | |||
|
245 | <logentry | |||
|
246 | revision="5"> | |||
|
247 | <author>test</author> | |||
|
248 | <date/> | |||
|
249 | <paths> | |||
|
250 | <path | |||
|
251 | action="D">/b</path> | |||
|
252 | </paths> | |||
|
253 | <msg>remove a file</msg> | |||
|
254 | </logentry> | |||
|
255 | </log> | |||
|
256 | $ ls a a-hg-wc | |||
|
257 | a: | |||
|
258 | c | |||
|
259 | d1 | |||
|
260 | newlink | |||
69 |
|
261 | |||
70 | hg convert -d svn a |
|
262 | a-hg-wc: | |
71 | svnupanddisplay a-hg-wc 1 |
|
263 | c | |
72 | ls a a-hg-wc |
|
264 | d1 | |
|
265 | newlink | |||
|
266 | ||||
|
267 | Exectutable | |||
|
268 | ||||
|
269 | $ chmod +x a/c | |||
|
270 | $ hg --cwd a ci -d '5 0' -m 'make a file executable' | |||
|
271 | $ hg --cwd a tip -q | |||
|
272 | 5:31093672760b | |||
73 |
|
273 | |||
74 | chmod +x a/c |
|
274 | $ hg convert -d svn a | |
75 | echo % executable |
|
275 | assuming destination a-hg | |
76 | hg --cwd a ci -d '5 0' -m 'make a file executable' |
|
276 | initializing svn working copy 'a-hg-wc' | |
77 | hg --cwd a tip -q |
|
277 | scanning source... | |
78 |
|
278 | sorting... | ||
79 | hg convert -d svn a |
|
279 | converting... | |
80 | svnupanddisplay a-hg-wc 1 |
|
280 | 0 make a file executable | |
81 | test -x a-hg-wc/c && echo executable || echo not executable |
|
281 | $ svnupanddisplay a-hg-wc 1 | |
|
282 | At revision 6. | |||
|
283 | 6 6 test . | |||
|
284 | 6 6 test c | |||
|
285 | 6 1 test d1 | |||
|
286 | 6 1 test d1/d2 | |||
|
287 | 6 1 test d1/d2/b | |||
|
288 | 6 3 test newlink | |||
|
289 | <?xml version="1.0"?> | |||
|
290 | <log> | |||
|
291 | <logentry | |||
|
292 | revision="6"> | |||
|
293 | <author>test</author> | |||
|
294 | <date/> | |||
|
295 | <paths> | |||
|
296 | <path | |||
|
297 | action="M">/c</path> | |||
|
298 | </paths> | |||
|
299 | <msg>make a file executable</msg> | |||
|
300 | </logentry> | |||
|
301 | </log> | |||
|
302 | $ test -x a-hg-wc/c | |||
82 |
|
303 | |||
83 |
|
|
304 | Executable in new directory | |
84 |
|
305 | |||
85 | rm -rf a a-hg a-hg-wc |
|
306 | $ rm -rf a a-hg a-hg-wc | |
86 | hg init a |
|
307 | $ hg init a | |
87 |
|
308 | |||
88 | mkdir a/d1 |
|
309 | $ mkdir a/d1 | |
89 | echo a > a/d1/a |
|
310 | $ echo a > a/d1/a | |
90 | chmod +x a/d1/a |
|
311 | $ chmod +x a/d1/a | |
91 | hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory' |
|
312 | $ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory' | |
|
313 | adding d1/a | |||
92 |
|
314 | |||
93 | hg convert -d svn a |
|
315 | $ hg convert -d svn a | |
94 | svnupanddisplay a-hg-wc 1 |
|
316 | assuming destination a-hg | |
95 | test -x a-hg-wc/d1/a && echo executable || echo not executable |
|
317 | initializing svn repository 'a-hg' | |
|
318 | initializing svn working copy 'a-hg-wc' | |||
|
319 | scanning source... | |||
|
320 | sorting... | |||
|
321 | converting... | |||
|
322 | 0 add executable file in new directory | |||
|
323 | $ svnupanddisplay a-hg-wc 1 | |||
|
324 | At revision 1. | |||
|
325 | 1 1 test . | |||
|
326 | 1 1 test d1 | |||
|
327 | 1 1 test d1/a | |||
|
328 | <?xml version="1.0"?> | |||
|
329 | <log> | |||
|
330 | <logentry | |||
|
331 | revision="1"> | |||
|
332 | <author>test</author> | |||
|
333 | <date/> | |||
|
334 | <paths> | |||
|
335 | <path | |||
|
336 | action="A">/d1</path> | |||
|
337 | <path | |||
|
338 | action="A">/d1/a</path> | |||
|
339 | </paths> | |||
|
340 | <msg>add executable file in new directory</msg> | |||
|
341 | </logentry> | |||
|
342 | </log> | |||
|
343 | $ test -x a-hg-wc/d1/a | |||
96 |
|
344 | |||
97 |
|
|
345 | Copy to new directory | |
|
346 | ||||
|
347 | $ mkdir a/d2 | |||
|
348 | $ hg --cwd a cp d1/a d2/a | |||
|
349 | $ hg --cwd a ci -d '1 0' -A -m 'copy file to new directory' | |||
98 |
|
350 | |||
99 | mkdir a/d2 |
|
351 | $ hg convert -d svn a | |
100 | hg --cwd a cp d1/a d2/a |
|
352 | assuming destination a-hg | |
101 | hg --cwd a ci -d '1 0' -A -m 'copy file to new directory' |
|
353 | initializing svn working copy 'a-hg-wc' | |
|
354 | scanning source... | |||
|
355 | sorting... | |||
|
356 | converting... | |||
|
357 | 0 copy file to new directory | |||
|
358 | $ svnupanddisplay a-hg-wc 1 | |||
|
359 | At revision 2. | |||
|
360 | 2 2 test . | |||
|
361 | 2 1 test d1 | |||
|
362 | 2 1 test d1/a | |||
|
363 | 2 2 test d2 | |||
|
364 | 2 2 test d2/a | |||
|
365 | <?xml version="1.0"?> | |||
|
366 | <log> | |||
|
367 | <logentry | |||
|
368 | revision="2"> | |||
|
369 | <author>test</author> | |||
|
370 | <date/> | |||
|
371 | <paths> | |||
|
372 | <path | |||
|
373 | action="A">/d2</path> | |||
|
374 | <path | |||
|
375 | copyfrom-path="/d1/a" | |||
|
376 | copyfrom-rev="1" | |||
|
377 | action="A">/d2/a</path> | |||
|
378 | </paths> | |||
|
379 | <msg>copy file to new directory</msg> | |||
|
380 | </logentry> | |||
|
381 | </log> | |||
102 |
|
382 | |||
103 | hg convert -d svn a |
|
383 | Branchy history | |
104 | svnupanddisplay a-hg-wc 1 |
|
384 | ||
|
385 | $ hg init b | |||
|
386 | $ echo base > b/b | |||
|
387 | $ hg --cwd b ci -d '0 0' -Ambase | |||
|
388 | adding b | |||
|
389 | ||||
|
390 | $ "$TESTDIR/svn-safe-append.py" left-1 b/b | |||
|
391 | $ echo left-1 > b/left-1 | |||
|
392 | $ hg --cwd b ci -d '1 0' -Amleft-1 | |||
|
393 | adding left-1 | |||
105 |
|
394 | |||
106 | echo % branchy history |
|
395 | $ "$TESTDIR/svn-safe-append.py" left-2 b/b | |
|
396 | $ echo left-2 > b/left-2 | |||
|
397 | $ hg --cwd b ci -d '2 0' -Amleft-2 | |||
|
398 | adding left-2 | |||
107 |
|
399 | |||
108 | hg init b |
|
400 | $ hg --cwd b up 0 | |
109 | echo base > b/b |
|
401 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
110 | hg --cwd b ci -d '0 0' -Ambase |
|
402 | ||
|
403 | $ "$TESTDIR/svn-safe-append.py" right-1 b/b | |||
|
404 | $ echo right-1 > b/right-1 | |||
|
405 | $ hg --cwd b ci -d '3 0' -Amright-1 | |||
|
406 | adding right-1 | |||
|
407 | created new head | |||
111 |
|
408 | |||
112 |
"$TESTDIR/svn-safe-append.py" |
|
409 | $ "$TESTDIR/svn-safe-append.py" right-2 b/b | |
113 | echo left-1 > b/left-1 |
|
410 | $ echo right-2 > b/right-2 | |
114 |
hg --cwd b ci -d ' |
|
411 | $ hg --cwd b ci -d '4 0' -Amright-2 | |
115 |
|
412 | adding right-2 | ||
116 | "$TESTDIR/svn-safe-append.py" left-2 b/b |
|
|||
117 | echo left-2 > b/left-2 |
|
|||
118 | hg --cwd b ci -d '2 0' -Amleft-2 |
|
|||
119 |
|
413 | |||
120 |
hg --cwd b up |
|
414 | $ hg --cwd b up -C 2 | |
|
415 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
416 | $ hg --cwd b merge | |||
|
417 | merging b | |||
|
418 | warning: conflicts during merge. | |||
|
419 | merging b failed! | |||
|
420 | 2 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
421 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |||
|
422 | [1] | |||
|
423 | $ hg --cwd b revert -r 2 b | |||
|
424 | $ hg resolve -m b | |||
|
425 | $ hg --cwd b ci -d '5 0' -m 'merge' | |||
121 |
|
426 | |||
122 | "$TESTDIR/svn-safe-append.py" right-1 b/b |
|
427 | Expect 4 changes | |
123 | echo right-1 > b/right-1 |
|
|||
124 | hg --cwd b ci -d '3 0' -Amright-1 |
|
|||
125 |
|
428 | |||
126 | "$TESTDIR/svn-safe-append.py" right-2 b/b |
|
429 | $ hg convert -d svn b | |
127 | echo right-2 > b/right-2 |
|
430 | assuming destination b-hg | |
128 | hg --cwd b ci -d '4 0' -Amright-2 |
|
431 | initializing svn repository 'b-hg' | |
|
432 | initializing svn working copy 'b-hg-wc' | |||
|
433 | scanning source... | |||
|
434 | sorting... | |||
|
435 | converting... | |||
|
436 | 5 base | |||
|
437 | 4 left-1 | |||
|
438 | 3 left-2 | |||
|
439 | 2 right-1 | |||
|
440 | 1 right-2 | |||
|
441 | 0 merge | |||
129 |
|
442 | |||
130 | hg --cwd b up -C 2 |
|
443 | $ svnupanddisplay b-hg-wc 0 | |
131 | hg --cwd b merge |
|
444 | At revision 4. | |
132 | hg --cwd b revert -r 2 b |
|
445 | 4 4 test . | |
133 | hg resolve -m b |
|
446 | 4 3 test b | |
134 | hg --cwd b ci -d '5 0' -m 'merge' |
|
447 | 4 2 test left-1 | |
135 |
|
448 | 4 3 test left-2 | ||
136 | hg convert -d svn b |
|
449 | 4 4 test right-1 | |
137 | echo % expect 4 changes |
|
450 | 4 4 test right-2 | |
138 | svnupanddisplay b-hg-wc 0 |
|
451 | <?xml version="1.0"?> | |
|
452 | <log> | |||
|
453 | <logentry | |||
|
454 | revision="4"> | |||
|
455 | <author>test</author> | |||
|
456 | <date/> | |||
|
457 | <paths> | |||
|
458 | <path | |||
|
459 | action="A">/right-1</path> | |||
|
460 | <path | |||
|
461 | action="A">/right-2</path> | |||
|
462 | </paths> | |||
|
463 | <msg>merge</msg> | |||
|
464 | </logentry> | |||
|
465 | <logentry | |||
|
466 | revision="3"> | |||
|
467 | <author>test</author> | |||
|
468 | <date/> | |||
|
469 | <paths> | |||
|
470 | <path | |||
|
471 | action="M">/b</path> | |||
|
472 | <path | |||
|
473 | action="A">/left-2</path> | |||
|
474 | </paths> | |||
|
475 | <msg>left-2</msg> | |||
|
476 | </logentry> | |||
|
477 | <logentry | |||
|
478 | revision="2"> | |||
|
479 | <author>test</author> | |||
|
480 | <date/> | |||
|
481 | <paths> | |||
|
482 | <path | |||
|
483 | action="M">/b</path> | |||
|
484 | <path | |||
|
485 | action="A">/left-1</path> | |||
|
486 | </paths> | |||
|
487 | <msg>left-1</msg> | |||
|
488 | </logentry> | |||
|
489 | <logentry | |||
|
490 | revision="1"> | |||
|
491 | <author>test</author> | |||
|
492 | <date/> | |||
|
493 | <paths> | |||
|
494 | <path | |||
|
495 | action="A">/b</path> | |||
|
496 | </paths> | |||
|
497 | <msg>base</msg> | |||
|
498 | </logentry> | |||
|
499 | </log> | |||
139 |
|
500 | |||
140 |
|
|
501 | Tags are not supported, but must not break conversion | |
|
502 | ||||
|
503 | $ rm -rf a a-hg a-hg-wc | |||
|
504 | $ hg init a | |||
|
505 | $ echo a > a/a | |||
|
506 | $ hg --cwd a ci -d '0 0' -A -m 'Add file a' | |||
|
507 | adding a | |||
|
508 | $ hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0 | |||
141 |
|
509 | |||
142 | rm -rf a a-hg a-hg-wc |
|
510 | $ hg convert -d svn a | |
143 | hg init a |
|
511 | assuming destination a-hg | |
144 | echo a > a/a |
|
512 | initializing svn repository 'a-hg' | |
145 | hg --cwd a ci -d '0 0' -A -m 'Add file a' |
|
513 | initializing svn working copy 'a-hg-wc' | |
146 | hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0 |
|
514 | scanning source... | |
147 |
|
515 | sorting... | ||
148 | hg convert -d svn a |
|
516 | converting... | |
149 | svnupanddisplay a-hg-wc 2 |
|
517 | 1 Add file a | |
150 | rm -rf a a-hg a-hg-wc |
|
518 | 0 Tagged as v1.0 | |
|
519 | writing Subversion tags is not yet implemented | |||
|
520 | $ svnupanddisplay a-hg-wc 2 | |||
|
521 | At revision 2. | |||
|
522 | 2 2 test . | |||
|
523 | 2 1 test a | |||
|
524 | 2 2 test .hgtags | |||
|
525 | <?xml version="1.0"?> | |||
|
526 | <log> | |||
|
527 | <logentry | |||
|
528 | revision="2"> | |||
|
529 | <author>test</author> | |||
|
530 | <date/> | |||
|
531 | <paths> | |||
|
532 | <path | |||
|
533 | action="A">/.hgtags</path> | |||
|
534 | </paths> | |||
|
535 | <msg>Tagged as v1.0</msg> | |||
|
536 | </logentry> | |||
|
537 | <logentry | |||
|
538 | revision="1"> | |||
|
539 | <author>test</author> | |||
|
540 | <date/> | |||
|
541 | <paths> | |||
|
542 | <path | |||
|
543 | action="A">/a</path> | |||
|
544 | </paths> | |||
|
545 | <msg>Add file a</msg> | |||
|
546 | </logentry> | |||
|
547 | </log> | |||
|
548 | $ rm -rf a a-hg a-hg-wc |
@@ -1,89 +1,179 b'' | |||||
1 | #!/bin/sh |
|
|||
2 |
|
1 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
2 | $ "$TESTDIR/hghave" svn svn-bindings || exit 80 | |
4 |
|
||||
5 | fix_path() |
|
|||
6 | { |
|
|||
7 | tr '\\' / |
|
|||
8 | } |
|
|||
9 |
|
||||
10 | echo "[extensions]" >> $HGRCPATH |
|
|||
11 | echo "convert = " >> $HGRCPATH |
|
|||
12 | echo 'graphlog =' >> $HGRCPATH |
|
|||
13 |
|
||||
14 | svnadmin create svn-repo |
|
|||
15 |
|
3 | |||
16 | svnpath=`pwd | fix_path` |
|
4 | $ fixpath() | |
17 | # SVN wants all paths to start with a slash. Unfortunately, |
|
5 | > { | |
18 | # Windows ones don't. Handle that. |
|
6 | > tr '\\' / | |
19 | expr "$svnpath" : "\/" > /dev/null |
|
7 | > } | |
20 | if [ $? -ne 0 ]; then |
|
8 | $ cat > $HGRCPATH <<EOF | |
21 | svnpath="/$svnpath" |
|
9 | > [extensions] | |
22 | fi |
|
10 | > convert = | |
|
11 | > graphlog = | |||
|
12 | > EOF | |||
23 |
|
13 | |||
24 | echo "# now tests that it works with trunk/tags layout, but no branches yet" |
|
14 | $ svnadmin create svn-repo | |
25 | echo |
|
15 | $ svnadmin setuuid svn-repo 00000000-0000-0000-0000-000000000000 | |
26 | echo % initial svn import |
|
16 | $ svnpath=`pwd | fixpath` | |
27 | mkdir projB |
|
|||
28 | cd projB |
|
|||
29 | mkdir trunk |
|
|||
30 | mkdir tags |
|
|||
31 | cd .. |
|
|||
32 |
|
||||
33 | svnurl="file://$svnpath/svn-repo/proj%20B" |
|
|||
34 | svn import -m "init projB" projB "$svnurl" | fix_path |
|
|||
35 |
|
17 | |||
36 |
|
18 | |||
37 | echo % update svn repository |
|
19 | $ expr "$svnpath" : "\/" > /dev/null | |
38 | svn co "$svnurl"/trunk B | fix_path |
|
20 | > if [ $? -ne 0 ]; then | |
39 | cd B |
|
21 | > svnpath="/$svnpath" | |
40 | echo hello > 'letter .txt' |
|
22 | > fi | |
41 | svn add 'letter .txt' |
|
23 | > svnurl="file://$svnpath/svn-repo" | |
42 | svn ci -m hello |
|
24 | ||
|
25 | Now test that it works with trunk/tags layout, but no branches yet. | |||
|
26 | ||||
|
27 | Initial svn import | |||
|
28 | ||||
|
29 | $ mkdir projB | |||
|
30 | $ cd projB | |||
|
31 | $ mkdir trunk | |||
|
32 | $ mkdir tags | |||
|
33 | $ cd .. | |||
|
34 | ||||
|
35 | $ svnurl="file://$svnpath/svn-repo/proj%20B" | |||
|
36 | $ svn import -m "init projB" projB "$svnurl" | fixpath | |||
|
37 | Adding projB/trunk | |||
|
38 | Adding projB/tags | |||
43 |
|
39 | |||
44 | "$TESTDIR/svn-safe-append.py" world 'letter .txt' |
|
40 | Committed revision 1. | |
45 | svn ci -m world |
|
41 | ||
|
42 | Update svn repository | |||
46 |
|
43 | |||
47 | svn copy -m "tag v0.1" "$svnurl"/trunk "$svnurl"/tags/v0.1 |
|
44 | $ svn co "$svnurl"/trunk B | fixpath | |
|
45 | Checked out revision 1. | |||
|
46 | $ cd B | |||
|
47 | $ echo hello > 'letter .txt' | |||
|
48 | $ svn add 'letter .txt' | |||
|
49 | A letter .txt | |||
|
50 | $ svn ci -m hello | |||
|
51 | Adding letter .txt | |||
|
52 | Transmitting file data . | |||
|
53 | Committed revision 2. | |||
48 |
|
54 | |||
49 |
"$TESTDIR/svn-safe-append.py" |
|
55 | $ "$TESTDIR/svn-safe-append.py" world 'letter .txt' | |
50 | svn ci -m "nice day" |
|
56 | $ svn ci -m world | |
51 | cd .. |
|
57 | Sending letter .txt | |
|
58 | Transmitting file data . | |||
|
59 | Committed revision 3. | |||
|
60 | ||||
|
61 | $ svn copy -m "tag v0.1" "$svnurl"/trunk "$svnurl"/tags/v0.1 | |||
52 |
|
62 | |||
53 | echo % convert to hg once |
|
63 | Committed revision 4. | |
54 | hg convert "$svnurl" B-hg |
|
64 | ||
|
65 | $ "$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt' | |||
|
66 | $ svn ci -m "nice day" | |||
|
67 | Sending letter .txt | |||
|
68 | Transmitting file data . | |||
|
69 | Committed revision 5. | |||
|
70 | $ cd .. | |||
|
71 | ||||
|
72 | Convert to hg once | |||
|
73 | ||||
|
74 | $ hg convert "$svnurl" B-hg | |||
|
75 | initializing destination B-hg repository | |||
|
76 | scanning source... | |||
|
77 | sorting... | |||
|
78 | converting... | |||
|
79 | 3 init projB | |||
|
80 | 2 hello | |||
|
81 | 1 world | |||
|
82 | 0 nice day | |||
|
83 | updating tags | |||
55 |
|
84 | |||
56 |
|
|
85 | Update svn repository again | |
57 | cd B |
|
|||
58 | "$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt' |
|
|||
59 | echo "nice to meet you" > letter2.txt |
|
|||
60 | svn add letter2.txt |
|
|||
61 | svn ci -m "second letter" |
|
|||
62 |
|
86 | |||
63 | svn copy -m "tag v0.2" "$svnurl"/trunk "$svnurl"/tags/v0.2 |
|
87 | $ cd B | |
|
88 | $ "$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt' | |||
|
89 | $ echo "nice to meet you" > letter2.txt | |||
|
90 | $ svn add letter2.txt | |||
|
91 | A letter2.txt | |||
|
92 | $ svn ci -m "second letter" | |||
|
93 | Sending letter .txt | |||
|
94 | Adding letter2.txt | |||
|
95 | Transmitting file data .. | |||
|
96 | Committed revision 6. | |||
64 |
|
97 | |||
65 | "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt |
|
98 | $ svn copy -m "tag v0.2" "$svnurl"/trunk "$svnurl"/tags/v0.2 | |
66 | svn ci -m "work in progress" |
|
99 | ||
67 | cd .. |
|
100 | Committed revision 7. | |
|
101 | ||||
|
102 | $ "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt | |||
|
103 | $ svn ci -m "work in progress" | |||
|
104 | Sending letter2.txt | |||
|
105 | Transmitting file data . | |||
|
106 | Committed revision 8. | |||
|
107 | $ cd .. | |||
68 |
|
108 | |||
69 | ######################################## |
|
109 | ######################################## | |
70 |
|
110 | |||
71 |
|
|
111 | Test incremental conversion | |
72 | hg convert "$svnurl" B-hg |
|
112 | ||
|
113 | $ hg convert "$svnurl" B-hg | |||
|
114 | scanning source... | |||
|
115 | sorting... | |||
|
116 | converting... | |||
|
117 | 1 second letter | |||
|
118 | 0 work in progress | |||
|
119 | updating tags | |||
73 |
|
120 | |||
74 | cd B-hg |
|
121 | $ cd B-hg | |
75 | hg glog --template '{rev} {desc|firstline} files: {files}\n' |
|
122 | $ hg glog --template '{rev} {desc|firstline} files: {files}\n' | |
76 | hg tags -q |
|
123 | o 7 update tags files: .hgtags | |
77 | cd .. |
|
124 | | | |
|
125 | o 6 work in progress files: letter2.txt | |||
|
126 | | | |||
|
127 | o 5 second letter files: letter .txt letter2.txt | |||
|
128 | | | |||
|
129 | o 4 update tags files: .hgtags | |||
|
130 | | | |||
|
131 | o 3 nice day files: letter .txt | |||
|
132 | | | |||
|
133 | o 2 world files: letter .txt | |||
|
134 | | | |||
|
135 | o 1 hello files: letter .txt | |||
|
136 | | | |||
|
137 | o 0 init projB files: | |||
|
138 | ||||
|
139 | $ hg tags -q | |||
|
140 | tip | |||
|
141 | v0.2 | |||
|
142 | v0.1 | |||
|
143 | $ cd .. | |||
78 |
|
144 | |||
79 |
|
|
145 | Test filemap | |
80 | echo 'include letter2.txt' > filemap |
|
146 | $ echo 'include letter2.txt' > filemap | |
81 | hg convert --filemap filemap "$svnurl"/trunk fmap |
|
147 | $ hg convert --filemap filemap "$svnurl"/trunk fmap | |
82 | hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n' |
|
148 | initializing destination fmap repository | |
|
149 | scanning source... | |||
|
150 | sorting... | |||
|
151 | converting... | |||
|
152 | 5 init projB | |||
|
153 | 4 hello | |||
|
154 | 3 world | |||
|
155 | 2 nice day | |||
|
156 | 1 second letter | |||
|
157 | 0 work in progress | |||
|
158 | $ hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n' | |||
|
159 | o 1 work in progress files: letter2.txt | |||
|
160 | | | |||
|
161 | o 0 second letter files: letter2.txt | |||
83 |
|
162 | |||
84 | echo % test stop revision |
|
163 | ||
85 | hg convert --rev 1 "$svnurl"/trunk stoprev |
|
164 | Test stop revision | |
86 | # Check convert_revision extra-records. |
|
165 | $ hg convert --rev 1 "$svnurl"/trunk stoprev | |
87 | # This is also the only place testing more than one extra field |
|
166 | initializing destination stoprev repository | |
88 | # in a revision. |
|
167 | scanning source... | |
89 | hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/' |
|
168 | sorting... | |
|
169 | converting... | |||
|
170 | 0 init projB | |||
|
171 | ||||
|
172 | Check convert_revision extra-records. | |||
|
173 | This is also the only place testing more than one extra field in a revision. | |||
|
174 | ||||
|
175 | $ cd stoprev | |||
|
176 | $ hg tip --debug | grep extra | |||
|
177 | extra: branch=default | |||
|
178 | extra: convert_revision=svn:00000000-0000-0000-0000-000000000000/proj B/trunk@1 | |||
|
179 | $ cd .. |
@@ -1,32 +1,90 b'' | |||||
1 | #!/bin/sh |
|
1 | ||
|
2 | $ "$TESTDIR/hghave" svn svn-bindings || exit 80 | |||
2 |
|
3 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
4 | $ cat > $HGRCPATH <<EOF | |
|
5 | > [extensions] | |||
|
6 | > convert = | |||
|
7 | > graphlog = | |||
|
8 | > EOF | |||
|
9 | $ convert() | |||
|
10 | > { | |||
|
11 | > startrev=$1 | |||
|
12 | > repopath=A-r$startrev-hg | |||
|
13 | > hg convert --config convert.svn.startrev=$startrev \ | |||
|
14 | > --config convert.svn.trunk=branches/branch1 \ | |||
|
15 | > --config convert.svn.branches=" " \ | |||
|
16 | > --config convert.svn.tags= \ | |||
|
17 | > --datesort svn-repo $repopath | |||
|
18 | > hg -R $repopath glog \ | |||
|
19 | > --template '{rev} {desc|firstline} files: {files}\n' | |||
|
20 | > echo | |||
|
21 | > } | |||
4 |
|
22 | |||
5 | echo "[extensions]" >> $HGRCPATH |
|
23 | $ svnadmin create svn-repo | |
6 | echo "convert = " >> $HGRCPATH |
|
24 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/startrev.svndump" | |
7 | echo "graphlog =" >> $HGRCPATH |
|
25 | ||
|
26 | Convert before branching point | |||
8 |
|
27 | |||
9 | svnadmin create svn-repo |
|
28 | $ convert 3 | |
10 | cat "$TESTDIR/svn/startrev.svndump" | svnadmin load svn-repo > /dev/null |
|
29 | initializing destination A-r3-hg repository | |
|
30 | scanning source... | |||
|
31 | sorting... | |||
|
32 | converting... | |||
|
33 | 3 removeb | |||
|
34 | 2 changeaa | |||
|
35 | 1 branch, changeaaa | |||
|
36 | 0 addc,changeaaaa | |||
|
37 | o 3 addc,changeaaaa files: a c | |||
|
38 | | | |||
|
39 | o 2 branch, changeaaa files: a | |||
|
40 | | | |||
|
41 | o 1 changeaa files: a | |||
|
42 | | | |||
|
43 | o 0 removeb files: a | |||
|
44 | ||||
11 |
|
45 | |||
12 | convert() |
|
46 | ||
13 | { |
|
47 | Convert before branching point | |
14 | startrev=$1 |
|
48 | ||
15 | repopath=A-r$startrev-hg |
|
49 | $ convert 4 | |
16 | hg convert --config convert.svn.startrev=$startrev \ |
|
50 | initializing destination A-r4-hg repository | |
17 | --config convert.svn.trunk=branches/branch1 \ |
|
51 | scanning source... | |
18 | --config convert.svn.branches=" " \ |
|
52 | sorting... | |
19 | --config convert.svn.tags= \ |
|
53 | converting... | |
20 | --datesort svn-repo $repopath |
|
54 | 2 changeaa | |
21 | hg -R $repopath glog --template '{rev} {desc|firstline} files: {files}\n' |
|
55 | 1 branch, changeaaa | |
22 | echo |
|
56 | 0 addc,changeaaaa | |
23 | } |
|
57 | o 2 addc,changeaaaa files: a c | |
|
58 | | | |||
|
59 | o 1 branch, changeaaa files: a | |||
|
60 | | | |||
|
61 | o 0 changeaa files: a | |||
|
62 | ||||
|
63 | ||||
|
64 | ||||
|
65 | Convert at branching point | |||
24 |
|
66 | |||
25 | echo % convert before branching point |
|
67 | $ convert 5 | |
26 | convert 3 |
|
68 | initializing destination A-r5-hg repository | |
27 | echo % convert before branching point |
|
69 | scanning source... | |
28 | convert 4 |
|
70 | sorting... | |
29 | echo % convert at branching point |
|
71 | converting... | |
30 | convert 5 |
|
72 | 1 branch, changeaaa | |
31 | echo % convert last revision only |
|
73 | 0 addc,changeaaaa | |
32 | convert 6 |
|
74 | o 1 addc,changeaaaa files: a c | |
|
75 | | | |||
|
76 | o 0 branch, changeaaa files: a | |||
|
77 | ||||
|
78 | ||||
|
79 | ||||
|
80 | Convert last revision only | |||
|
81 | ||||
|
82 | $ convert 6 | |||
|
83 | initializing destination A-r6-hg repository | |||
|
84 | scanning source... | |||
|
85 | sorting... | |||
|
86 | converting... | |||
|
87 | 0 addc,changeaaaa | |||
|
88 | o 0 addc,changeaaaa files: a c | |||
|
89 | ||||
|
90 |
@@ -1,23 +1,67 b'' | |||||
1 | #!/bin/sh |
|
1 | ||
|
2 | $ "$TESTDIR/hghave" svn svn-bindings || exit 80 | |||
2 |
|
3 | |||
3 | "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
4 | $ cat > $HGRCPATH <<EOF | |
|
5 | > [extensions] | |||
|
6 | > convert = | |||
|
7 | > graphlog = | |||
|
8 | > EOF | |||
|
9 | ||||
|
10 | $ svnadmin create svn-repo | |||
|
11 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/tags.svndump" | |||
4 |
|
12 | |||
5 | echo "[extensions]" >> $HGRCPATH |
|
13 | Convert | |
6 | echo "convert = " >> $HGRCPATH |
|
14 | $ hg convert --datesort svn-repo A-hg | |
7 | echo "graphlog =" >> $HGRCPATH |
|
15 | initializing destination A-hg repository | |
8 |
|
16 | scanning source... | ||
9 | svnadmin create svn-repo |
|
17 | sorting... | |
10 | cat "$TESTDIR/svn/tags.svndump" | svnadmin load svn-repo > /dev/null |
|
18 | converting... | |
|
19 | 5 init projA | |||
|
20 | 4 adda | |||
|
21 | 3 changea | |||
|
22 | 2 changea2 | |||
|
23 | 1 changea3 | |||
|
24 | 0 changea | |||
|
25 | updating tags | |||
11 |
|
26 | |||
12 | echo % convert |
|
27 | $ cd A-hg | |
13 | hg convert --datesort svn-repo A-hg |
|
28 | $ hg glog --template '{rev} {desc|firstline} tags: {tags}\n' | |
|
29 | o 6 update tags tags: tip | |||
|
30 | | | |||
|
31 | o 5 changea tags: trunk.goodtag | |||
|
32 | | | |||
|
33 | o 4 changea3 tags: | |||
|
34 | | | |||
|
35 | o 3 changea2 tags: trunk.v1 | |||
|
36 | | | |||
|
37 | o 2 changea tags: | |||
|
38 | | | |||
|
39 | o 1 adda tags: | |||
|
40 | | | |||
|
41 | o 0 init projA tags: | |||
|
42 | ||||
14 |
|
43 | |||
15 | cd A-hg |
|
44 | $ hg tags -q | |
16 | hg glog --template '{rev} {desc|firstline} tags: {tags}\n' |
|
45 | tip | |
17 | hg tags | sed 's/:.*/:/' |
|
46 | trunk.goodtag | |
18 | cd .. |
|
47 | trunk.v1 | |
|
48 | ||||
|
49 | $ cd .. | |||
|
50 | ||||
|
51 | Convert without tags | |||
19 |
|
52 | |||
20 | echo % convert without tags |
|
53 | $ hg convert --datesort --config convert.svn.tags= svn-repo A-notags-hg | |
21 | hg convert --datesort --config convert.svn.tags= svn-repo A-notags-hg |
|
54 | initializing destination A-notags-hg repository | |
22 | hg -R A-notags-hg tags -q |
|
55 | scanning source... | |
|
56 | sorting... | |||
|
57 | converting... | |||
|
58 | 5 init projA | |||
|
59 | 4 adda | |||
|
60 | 3 changea | |||
|
61 | 2 changea2 | |||
|
62 | 1 changea3 | |||
|
63 | 0 changea | |||
23 |
|
64 | |||
|
65 | $ hg -R A-notags-hg tags -q | |||
|
66 | tip | |||
|
67 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now