##// END OF EJS Templates
test-convert-cvs: test fuzz
Mads Kiilerich <mads at kiilerich.com> -
r12029:84a09639 stable
parent child Browse files
Show More
@@ -1,143 +1,153
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" cvs || exit 80
3 "$TESTDIR/hghave" cvs || exit 80
4
4
5 cvscall()
5 cvscall()
6 {
6 {
7 cvs -f "$@"
7 cvs -f "$@"
8 }
8 }
9
9
10 hgcat()
10 hgcat()
11 {
11 {
12 hg --cwd src-hg cat -r tip "$1"
12 hg --cwd src-hg cat -r tip "$1"
13 }
13 }
14
14
15 echo "[extensions]" >> $HGRCPATH
15 echo "[extensions]" >> $HGRCPATH
16 echo "convert = " >> $HGRCPATH
16 echo "convert = " >> $HGRCPATH
17 echo "graphlog = " >> $HGRCPATH
17 echo "graphlog = " >> $HGRCPATH
18
18
19 cat > cvshooks.py <<EOF
19 cat > cvshooks.py <<EOF
20 def cvslog(ui,repo,hooktype,log):
20 def cvslog(ui,repo,hooktype,log):
21 print "%s hook: %d entries"%(hooktype,len(log))
21 print "%s hook: %d entries"%(hooktype,len(log))
22
22
23 def cvschangesets(ui,repo,hooktype,changesets):
23 def cvschangesets(ui,repo,hooktype,changesets):
24 print "%s hook: %d changesets"%(hooktype,len(changesets))
24 print "%s hook: %d changesets"%(hooktype,len(changesets))
25 EOF
25 EOF
26 hookpath=`pwd`
26 hookpath=`pwd`
27
27
28 echo "[hooks]" >> $HGRCPATH
28 echo "[hooks]" >> $HGRCPATH
29 echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH
29 echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH
30 echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH
30 echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH
31
31
32 echo % create cvs repository
32 echo % create cvs repository
33 mkdir cvsrepo
33 mkdir cvsrepo
34 cd cvsrepo
34 cd cvsrepo
35 CVSROOT=`pwd`
35 CVSROOT=`pwd`
36 export CVSROOT
36 export CVSROOT
37 CVS_OPTIONS=-f
37 CVS_OPTIONS=-f
38 export CVS_OPTIONS
38 export CVS_OPTIONS
39 cd ..
39 cd ..
40
40
41 cvscall -q -d "$CVSROOT" init
41 cvscall -q -d "$CVSROOT" init
42
42
43 echo % create source directory
43 echo % create source directory
44 mkdir src-temp
44 mkdir src-temp
45 cd src-temp
45 cd src-temp
46 echo a > a
46 echo a > a
47 mkdir b
47 mkdir b
48 cd b
48 cd b
49 echo c > c
49 echo c > c
50 cd ..
50 cd ..
51
51
52 echo % import source directory
52 echo % import source directory
53 cvscall -q import -m import src INITIAL start
53 cvscall -q import -m import src INITIAL start
54 cd ..
54 cd ..
55
55
56 echo % checkout source directory
56 echo % checkout source directory
57 cvscall -q checkout src
57 cvscall -q checkout src
58
58
59 echo % commit a new revision changing b/c
59 echo % commit a new revision changing b/c
60 cd src
60 cd src
61 sleep 1
61 sleep 1
62 echo c >> b/c
62 echo c >> b/c
63 cvscall -q commit -mci0 . | grep '<--' |\
63 cvscall -q commit -mci0 . | grep '<--' |\
64 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
64 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
65 cd ..
65 cd ..
66
66
67 echo % convert fresh repo
67 echo % convert fresh repo
68 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
68 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
69 hgcat a
69 hgcat a
70 hgcat b/c
70 hgcat b/c
71
71
72 echo % convert fresh repo with --filemap
72 echo % convert fresh repo with --filemap
73 echo include b/c > filemap
73 echo include b/c > filemap
74 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
74 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
75 hgcat b/c
75 hgcat b/c
76 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
76 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
77
77
78 echo % 'convert full repository (issue1649)'
78 echo % 'convert full repository (issue1649)'
79 cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT
79 cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT
80 ls srcfull
80 ls srcfull
81 hg convert srcfull srcfull-hg \
81 hg convert srcfull srcfull-hg \
82 | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' \
82 | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' \
83 | grep -v 'log entries' | grep -v 'hook:' \
83 | grep -v 'log entries' | grep -v 'hook:' \
84 | grep -v '^[0-3] .*' # filter instable changeset order
84 | grep -v '^[0-3] .*' # filter instable changeset order
85 hg cat -r tip srcfull-hg/src/a
85 hg cat -r tip srcfull-hg/src/a
86 hg cat -r tip srcfull-hg/src/b/c
86 hg cat -r tip srcfull-hg/src/b/c
87
87
88 echo % commit new file revisions
88 echo % commit new file revisions
89 cd src
89 cd src
90 echo a >> a
90 echo a >> a
91 echo c >> b/c
91 echo c >> b/c
92 cvscall -q commit -mci1 . | grep '<--' |\
92 cvscall -q commit -mci1 . | grep '<--' |\
93 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
93 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
94 cd ..
94 cd ..
95
95
96 echo % convert again
96 echo % convert again
97 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
97 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
98 hgcat a
98 hgcat a
99 hgcat b/c
99 hgcat b/c
100
100
101 echo % convert again with --filemap
101 echo % convert again with --filemap
102 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
102 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
103 hgcat b/c
103 hgcat b/c
104 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
104 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
105
105
106 echo % commit branch
106 echo % commit branch
107 cd src
107 cd src
108 cvs -q update -r1.1 b/c
108 cvs -q update -r1.1 b/c
109 cvs -q tag -b branch
109 cvs -q tag -b branch
110 cvs -q update -r branch > /dev/null
110 cvs -q update -r branch > /dev/null
111 echo d >> b/c
111 echo d >> b/c
112 cvs -q commit -mci2 . | grep '<--' |\
112 cvs -q commit -mci2 . | grep '<--' |\
113 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
113 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
114 cd ..
114 cd ..
115
115
116 echo % convert again
116 echo % convert again
117 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
117 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
118 hgcat b/c
118 hgcat b/c
119
119
120 echo % convert again with --filemap
120 echo % convert again with --filemap
121 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
121 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
122 hgcat b/c
122 hgcat b/c
123 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
123 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
124
124
125 echo % commit a new revision with funny log message
125 echo % commit a new revision with funny log message
126 cd src
126 cd src
127 sleep 1
127 sleep 1
128 echo e >> a
128 echo e >> a
129 cvscall -q commit -m'funny
129 cvscall -q commit -m'funny
130 ----------------------------
130 ----------------------------
131 log message' . | grep '<--' |\
131 log message' . | grep '<--' |\
132 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
132 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
133 cd ..
133 cd ..
134
134
135 echo % commit new file revisions with some fuzz
136 cd src
137 echo f >> a
138 cvscall -q commit -mfuzzy . | grep '<--' |\
139 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
140 sleep 4 # the two changes will be split if fuzz < 4
141 echo g >> b/c
142 cvscall -q commit -mfuzzy . | grep '<--' |\
143 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
144 cd ..
145
135 echo % convert again
146 echo % convert again
136 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
147 hg convert --config convert.cvsps.fuzz=2 src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
137
148
138 echo "graphlog = " >> $HGRCPATH
139 hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
149 hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
140
150
141 echo % testing debugcvsps
151 echo % testing debugcvsps
142 cd src
152 cd src
143 hg debugcvsps | sed -e 's/Author:.*/Author:/' -e 's/Date:.*/Date:/'
153 hg debugcvsps --fuzz=2 | sed -e 's/Author:.*/Author:/' -e 's/Date:.*/Date:/'
@@ -1,288 +1,321
1 % create cvs repository
1 % create cvs repository
2 % create source directory
2 % create source directory
3 % import source directory
3 % import source directory
4 N src/a
4 N src/a
5 N src/b/c
5 N src/b/c
6
6
7 No conflicts created by this import
7 No conflicts created by this import
8
8
9 % checkout source directory
9 % checkout source directory
10 U src/a
10 U src/a
11 U src/b/c
11 U src/b/c
12 % commit a new revision changing b/c
12 % commit a new revision changing b/c
13 checking in src/b/c,v
13 checking in src/b/c,v
14 % convert fresh repo
14 % convert fresh repo
15 initializing destination src-hg repository
15 initializing destination src-hg repository
16 connecting to cvsrepo
16 connecting to cvsrepo
17 scanning source...
17 scanning source...
18 collecting CVS rlog
18 collecting CVS rlog
19 5 log entries
19 5 log entries
20 cvslog hook: 5 entries
20 cvslog hook: 5 entries
21 creating changesets
21 creating changesets
22 3 changeset entries
22 3 changeset entries
23 cvschangesets hook: 3 changesets
23 cvschangesets hook: 3 changesets
24 sorting...
24 sorting...
25 converting...
25 converting...
26 2 Initial revision
26 2 Initial revision
27 1 import
27 1 import
28 0 ci0
28 0 ci0
29 updating tags
29 updating tags
30 a
30 a
31 c
31 c
32 c
32 c
33 % convert fresh repo with --filemap
33 % convert fresh repo with --filemap
34 initializing destination src-filemap repository
34 initializing destination src-filemap repository
35 connecting to cvsrepo
35 connecting to cvsrepo
36 scanning source...
36 scanning source...
37 collecting CVS rlog
37 collecting CVS rlog
38 5 log entries
38 5 log entries
39 cvslog hook: 5 entries
39 cvslog hook: 5 entries
40 creating changesets
40 creating changesets
41 3 changeset entries
41 3 changeset entries
42 cvschangesets hook: 3 changesets
42 cvschangesets hook: 3 changesets
43 sorting...
43 sorting...
44 converting...
44 converting...
45 2 Initial revision
45 2 Initial revision
46 1 import
46 1 import
47 filtering out empty revision
47 filtering out empty revision
48 rolling back to revision 0 (undo commit)
48 rolling back to revision 0 (undo commit)
49 0 ci0
49 0 ci0
50 updating tags
50 updating tags
51 c
51 c
52 c
52 c
53 2 update tags files: .hgtags
53 2 update tags files: .hgtags
54 1 ci0 files: b/c
54 1 ci0 files: b/c
55 0 Initial revision files: b/c
55 0 Initial revision files: b/c
56 % convert full repository (issue1649)
56 % convert full repository (issue1649)
57 U srcfull/src/a
57 U srcfull/src/a
58 U srcfull/src/b/c
58 U srcfull/src/b/c
59 CVS
59 CVS
60 CVSROOT
60 CVSROOT
61 src
61 src
62 initializing destination srcfull-hg repository
62 initializing destination srcfull-hg repository
63 connecting to cvsrepo
63 connecting to cvsrepo
64 scanning source...
64 scanning source...
65 collecting CVS rlog
65 collecting CVS rlog
66 creating changesets
66 creating changesets
67 4 changeset entries
67 4 changeset entries
68 sorting...
68 sorting...
69 converting...
69 converting...
70 updating tags
70 updating tags
71 a
71 a
72 c
72 c
73 c
73 c
74 % commit new file revisions
74 % commit new file revisions
75 checking in src/a,v
75 checking in src/a,v
76 checking in src/b/c,v
76 checking in src/b/c,v
77 % convert again
77 % convert again
78 connecting to cvsrepo
78 connecting to cvsrepo
79 scanning source...
79 scanning source...
80 collecting CVS rlog
80 collecting CVS rlog
81 7 log entries
81 7 log entries
82 cvslog hook: 7 entries
82 cvslog hook: 7 entries
83 creating changesets
83 creating changesets
84 4 changeset entries
84 4 changeset entries
85 cvschangesets hook: 4 changesets
85 cvschangesets hook: 4 changesets
86 sorting...
86 sorting...
87 converting...
87 converting...
88 0 ci1
88 0 ci1
89 a
89 a
90 a
90 a
91 c
91 c
92 c
92 c
93 c
93 c
94 % convert again with --filemap
94 % convert again with --filemap
95 connecting to cvsrepo
95 connecting to cvsrepo
96 scanning source...
96 scanning source...
97 collecting CVS rlog
97 collecting CVS rlog
98 7 log entries
98 7 log entries
99 cvslog hook: 7 entries
99 cvslog hook: 7 entries
100 creating changesets
100 creating changesets
101 4 changeset entries
101 4 changeset entries
102 cvschangesets hook: 4 changesets
102 cvschangesets hook: 4 changesets
103 sorting...
103 sorting...
104 converting...
104 converting...
105 0 ci1
105 0 ci1
106 c
106 c
107 c
107 c
108 c
108 c
109 3 ci1 files: b/c
109 3 ci1 files: b/c
110 2 update tags files: .hgtags
110 2 update tags files: .hgtags
111 1 ci0 files: b/c
111 1 ci0 files: b/c
112 0 Initial revision files: b/c
112 0 Initial revision files: b/c
113 % commit branch
113 % commit branch
114 U b/c
114 U b/c
115 T a
115 T a
116 T b/c
116 T b/c
117 checking in src/b/c,v
117 checking in src/b/c,v
118 % convert again
118 % convert again
119 connecting to cvsrepo
119 connecting to cvsrepo
120 scanning source...
120 scanning source...
121 collecting CVS rlog
121 collecting CVS rlog
122 8 log entries
122 8 log entries
123 cvslog hook: 8 entries
123 cvslog hook: 8 entries
124 creating changesets
124 creating changesets
125 5 changeset entries
125 5 changeset entries
126 cvschangesets hook: 5 changesets
126 cvschangesets hook: 5 changesets
127 sorting...
127 sorting...
128 converting...
128 converting...
129 0 ci2
129 0 ci2
130 c
130 c
131 d
131 d
132 % convert again with --filemap
132 % convert again with --filemap
133 connecting to cvsrepo
133 connecting to cvsrepo
134 scanning source...
134 scanning source...
135 collecting CVS rlog
135 collecting CVS rlog
136 8 log entries
136 8 log entries
137 cvslog hook: 8 entries
137 cvslog hook: 8 entries
138 creating changesets
138 creating changesets
139 5 changeset entries
139 5 changeset entries
140 cvschangesets hook: 5 changesets
140 cvschangesets hook: 5 changesets
141 sorting...
141 sorting...
142 converting...
142 converting...
143 0 ci2
143 0 ci2
144 c
144 c
145 d
145 d
146 4 ci2 files: b/c
146 4 ci2 files: b/c
147 3 ci1 files: b/c
147 3 ci1 files: b/c
148 2 update tags files: .hgtags
148 2 update tags files: .hgtags
149 1 ci0 files: b/c
149 1 ci0 files: b/c
150 0 Initial revision files: b/c
150 0 Initial revision files: b/c
151 % commit a new revision with funny log message
151 % commit a new revision with funny log message
152 checking in src/a,v
152 checking in src/a,v
153 % commit new file revisions with some fuzz
154 checking in src/a,v
155 checking in src/b/c,v
153 % convert again
156 % convert again
154 connecting to cvsrepo
157 connecting to cvsrepo
155 scanning source...
158 scanning source...
156 collecting CVS rlog
159 collecting CVS rlog
157 9 log entries
160 11 log entries
158 cvslog hook: 9 entries
161 cvslog hook: 11 entries
159 creating changesets
162 creating changesets
160 6 changeset entries
163 8 changeset entries
161 cvschangesets hook: 6 changesets
164 cvschangesets hook: 8 changesets
162 sorting...
165 sorting...
163 converting...
166 converting...
164 0 funny
167 2 funny
168 1 fuzzy
169 0 fuzzy
170 o 8 (branch) fuzzy files: b/c
171 |
172 o 7 (branch) fuzzy files: a
173 |
165 o 6 (branch) funny
174 o 6 (branch) funny
166 | ----------------------------
175 | ----------------------------
167 | log message files: a
176 | log message files: a
168 o 5 (branch) ci2 files: b/c
177 o 5 (branch) ci2 files: b/c
169
178
170 o 4 () ci1 files: a b/c
179 o 4 () ci1 files: a b/c
171 |
180 |
172 o 3 () update tags files: .hgtags
181 o 3 () update tags files: .hgtags
173 |
182 |
174 o 2 () ci0 files: b/c
183 o 2 () ci0 files: b/c
175 |
184 |
176 | o 1 (INITIAL) import files:
185 | o 1 (INITIAL) import files:
177 |/
186 |/
178 o 0 () Initial revision files: a b/c
187 o 0 () Initial revision files: a b/c
179
188
180 % testing debugcvsps
189 % testing debugcvsps
181 collecting CVS rlog
190 collecting CVS rlog
182 9 log entries
191 11 log entries
183 cvslog hook: 9 entries
192 cvslog hook: 11 entries
184 creating changesets
193 creating changesets
185 8 changeset entries
194 10 changeset entries
186 cvschangesets hook: 8 changesets
195 cvschangesets hook: 10 changesets
187 ---------------------
196 ---------------------
188 PatchSet 1
197 PatchSet 1
189 Date:
198 Date:
190 Author:
199 Author:
191 Branch: HEAD
200 Branch: HEAD
192 Tag: (none)
201 Tag: (none)
193 Branchpoints: INITIAL
202 Branchpoints: INITIAL
194 Log:
203 Log:
195 Initial revision
204 Initial revision
196
205
197 Members:
206 Members:
198 a:INITIAL->1.1
207 a:INITIAL->1.1
199
208
200 ---------------------
209 ---------------------
201 PatchSet 2
210 PatchSet 2
202 Date:
211 Date:
203 Author:
212 Author:
204 Branch: HEAD
213 Branch: HEAD
205 Tag: (none)
214 Tag: (none)
206 Branchpoints: INITIAL, branch
215 Branchpoints: INITIAL, branch
207 Log:
216 Log:
208 Initial revision
217 Initial revision
209
218
210 Members:
219 Members:
211 b/c:INITIAL->1.1
220 b/c:INITIAL->1.1
212
221
213 ---------------------
222 ---------------------
214 PatchSet 3
223 PatchSet 3
215 Date:
224 Date:
216 Author:
225 Author:
217 Branch: INITIAL
226 Branch: INITIAL
218 Tag: start
227 Tag: start
219 Log:
228 Log:
220 import
229 import
221
230
222 Members:
231 Members:
223 a:1.1->1.1.1.1
232 a:1.1->1.1.1.1
224 b/c:1.1->1.1.1.1
233 b/c:1.1->1.1.1.1
225
234
226 ---------------------
235 ---------------------
227 PatchSet 4
236 PatchSet 4
228 Date:
237 Date:
229 Author:
238 Author:
230 Branch: HEAD
239 Branch: HEAD
231 Tag: (none)
240 Tag: (none)
232 Log:
241 Log:
233 ci0
242 ci0
234
243
235 Members:
244 Members:
236 b/c:1.1->1.2
245 b/c:1.1->1.2
237
246
238 ---------------------
247 ---------------------
239 PatchSet 5
248 PatchSet 5
240 Date:
249 Date:
241 Author:
250 Author:
242 Branch: HEAD
251 Branch: HEAD
243 Tag: (none)
252 Tag: (none)
244 Branchpoints: branch
253 Branchpoints: branch
245 Log:
254 Log:
246 ci1
255 ci1
247
256
248 Members:
257 Members:
249 a:1.1->1.2
258 a:1.1->1.2
250
259
251 ---------------------
260 ---------------------
252 PatchSet 6
261 PatchSet 6
253 Date:
262 Date:
254 Author:
263 Author:
255 Branch: HEAD
264 Branch: HEAD
256 Tag: (none)
265 Tag: (none)
257 Log:
266 Log:
258 ci1
267 ci1
259
268
260 Members:
269 Members:
261 b/c:1.2->1.3
270 b/c:1.2->1.3
262
271
263 ---------------------
272 ---------------------
264 PatchSet 7
273 PatchSet 7
265 Date:
274 Date:
266 Author:
275 Author:
267 Branch: branch
276 Branch: branch
268 Tag: (none)
277 Tag: (none)
269 Log:
278 Log:
270 ci2
279 ci2
271
280
272 Members:
281 Members:
273 b/c:1.1->1.1.2.1
282 b/c:1.1->1.1.2.1
274
283
275 ---------------------
284 ---------------------
276 PatchSet 8
285 PatchSet 8
277 Date:
286 Date:
278 Author:
287 Author:
279 Branch: branch
288 Branch: branch
280 Tag: (none)
289 Tag: (none)
281 Log:
290 Log:
282 funny
291 funny
283 ----------------------------
292 ----------------------------
284 log message
293 log message
285
294
286 Members:
295 Members:
287 a:1.2->1.2.2.1
296 a:1.2->1.2.2.1
288
297
298 ---------------------
299 PatchSet 9
300 Date:
301 Author:
302 Branch: branch
303 Tag: (none)
304 Log:
305 fuzzy
306
307 Members:
308 a:1.2.2.1->1.2.2.2
309
310 ---------------------
311 PatchSet 10
312 Date:
313 Author:
314 Branch: branch
315 Tag: (none)
316 Log:
317 fuzzy
318
319 Members:
320 b/c:1.1.2.1->1.1.2.2
321
General Comments 0
You need to be logged in to leave comments. Login now