Show More
@@ -1,659 +1,659 b'' | |||
|
1 | 1 | #require cvs |
|
2 | 2 | |
|
3 | 3 | $ cvscall() |
|
4 | 4 | > { |
|
5 | 5 | > cvs -f "$@" |
|
6 | 6 | > } |
|
7 | 7 | $ hgcat() |
|
8 | 8 | > { |
|
9 | 9 | > hg --cwd src-hg cat -r tip "$1" |
|
10 | 10 | > } |
|
11 | 11 | $ echo "[extensions]" >> $HGRCPATH |
|
12 | 12 | $ echo "convert = " >> $HGRCPATH |
|
13 | 13 | $ cat > cvshooks.py <<EOF |
|
14 | 14 | > def cvslog(ui,repo,hooktype,log): |
|
15 | 15 | > ui.write(b'%s hook: %d entries\n' % (hooktype,len(log))) |
|
16 | 16 | > |
|
17 | 17 | > def cvschangesets(ui,repo,hooktype,changesets): |
|
18 | 18 | > ui.write(b'%s hook: %d changesets\n' % (hooktype,len(changesets))) |
|
19 | 19 | > EOF |
|
20 | 20 | $ hookpath=`pwd` |
|
21 | 21 | $ cat <<EOF >> $HGRCPATH |
|
22 | 22 | > [hooks] |
|
23 | 23 | > cvslog = python:$hookpath/cvshooks.py:cvslog |
|
24 | 24 | > cvschangesets = python:$hookpath/cvshooks.py:cvschangesets |
|
25 | 25 | > EOF |
|
26 | 26 | |
|
27 | 27 | create cvs repository |
|
28 | 28 | |
|
29 | 29 | $ mkdir cvsrepo |
|
30 | 30 | $ cd cvsrepo |
|
31 | 31 | $ CVSROOT=`pwd` |
|
32 | 32 | $ export CVSROOT |
|
33 | 33 | $ CVS_OPTIONS=-f |
|
34 | 34 | $ export CVS_OPTIONS |
|
35 | 35 | $ cd .. |
|
36 | 36 | $ rmdir cvsrepo |
|
37 | 37 | $ cvscall -q -d "$CVSROOT" init |
|
38 | 38 | |
|
39 | 39 | create source directory |
|
40 | 40 | |
|
41 | 41 | $ mkdir src-temp |
|
42 | 42 | $ cd src-temp |
|
43 | 43 | $ echo a > a |
|
44 | 44 | $ mkdir b |
|
45 | 45 | $ cd b |
|
46 | 46 | $ echo c > c |
|
47 | 47 | $ cd .. |
|
48 | 48 | |
|
49 | 49 | import source directory |
|
50 | 50 | |
|
51 | 51 | $ cvscall -q import -m import src INITIAL start |
|
52 | 52 | N src/a |
|
53 | 53 | N src/b/c |
|
54 | 54 | |
|
55 | 55 | No conflicts created by this import |
|
56 | 56 | |
|
57 | 57 | $ cd .. |
|
58 | 58 | |
|
59 | 59 | checkout source directory |
|
60 | 60 | |
|
61 | 61 | $ cvscall -q checkout src |
|
62 | 62 | U src/a |
|
63 | 63 | U src/b/c |
|
64 | 64 | |
|
65 | 65 | commit a new revision changing b/c |
|
66 | 66 | |
|
67 | 67 | $ cd src |
|
68 | 68 | $ sleep 1 |
|
69 | 69 | $ echo c >> b/c |
|
70 | 70 | $ cvscall -q commit -mci0 . | grep '<--' |
|
71 | 71 | $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob) |
|
72 | 72 | $ cd .. |
|
73 | 73 | |
|
74 | 74 | convert fresh repo and also check localtimezone option |
|
75 | 75 | |
|
76 | 76 | NOTE: This doesn't check all time zones -- it merely determines that |
|
77 | 77 | the configuration option is taking effect. |
|
78 | 78 | |
|
79 | 79 | An arbitrary (U.S.) time zone is used here. TZ=US/Hawaii is selected |
|
80 | 80 | since it does not use DST (unlike other U.S. time zones) and is always |
|
81 | 81 | a fixed difference from UTC. |
|
82 | 82 | |
|
83 | 83 | This choice is limited to work on Linux environments. At least on |
|
84 | 84 | FreeBSD 11 this timezone is not known. A better choice is |
|
85 | 85 | TZ=Pacific/Johnston. On Linux "US/Hawaii" is just a symlink to this |
|
86 | 86 | name and also it is known on FreeBSD and on Solaris. |
|
87 | 87 | |
|
88 | 88 | $ TZ=Pacific/Johnston hg convert --config convert.localtimezone=True src src-hg |
|
89 | 89 | initializing destination src-hg repository |
|
90 | 90 | connecting to $TESTTMP/cvsrepo |
|
91 | 91 | scanning source... |
|
92 | 92 | collecting CVS rlog |
|
93 | 93 | 5 log entries |
|
94 | 94 | cvslog hook: 5 entries |
|
95 | 95 | creating changesets |
|
96 | 96 | 3 changeset entries |
|
97 | 97 | cvschangesets hook: 3 changesets |
|
98 | 98 | sorting... |
|
99 | 99 | converting... |
|
100 | 100 | 2 Initial revision |
|
101 | 101 | 1 ci0 |
|
102 | 102 | 0 import |
|
103 | 103 | updating tags |
|
104 | 104 | $ hgcat a |
|
105 | 105 | a |
|
106 | 106 | $ hgcat b/c |
|
107 | 107 | c |
|
108 | 108 | c |
|
109 | 109 | |
|
110 | 110 | convert fresh repo with --filemap |
|
111 | 111 | |
|
112 | 112 | $ echo include b/c > filemap |
|
113 | 113 | $ hg convert --filemap filemap src src-filemap |
|
114 | 114 | initializing destination src-filemap repository |
|
115 | 115 | connecting to $TESTTMP/cvsrepo |
|
116 | 116 | scanning source... |
|
117 | 117 | collecting CVS rlog |
|
118 | 118 | 5 log entries |
|
119 | 119 | cvslog hook: 5 entries |
|
120 | 120 | creating changesets |
|
121 | 121 | 3 changeset entries |
|
122 | 122 | cvschangesets hook: 3 changesets |
|
123 | 123 | sorting... |
|
124 | 124 | converting... |
|
125 | 125 | 2 Initial revision |
|
126 | 126 | 1 ci0 |
|
127 | 127 | 0 import |
|
128 | 128 | filtering out empty revision |
|
129 | 129 | repository tip rolled back to revision 1 (undo convert) |
|
130 | 130 | updating tags |
|
131 | 131 | $ hgcat b/c |
|
132 | 132 | c |
|
133 | 133 | c |
|
134 | 134 | $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n' |
|
135 | 135 | 2 update tags files: .hgtags |
|
136 | 136 | 1 ci0 files: b/c |
|
137 | 137 | 0 Initial revision files: b/c |
|
138 | 138 | |
|
139 | 139 | convert full repository (issue1649) |
|
140 | 140 | |
|
141 | 141 | $ cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT |
|
142 | 142 | U srcfull/src/a |
|
143 | 143 | U srcfull/src/b/c |
|
144 | 144 | $ ls srcfull |
|
145 | 145 | CVS |
|
146 | 146 | CVSROOT |
|
147 | 147 | src |
|
148 | 148 | $ hg convert srcfull srcfull-hg \ |
|
149 | 149 | > | grep -v 'log entries' | grep -v 'hook:' \ |
|
150 | 150 | > | grep -v '^[0-3] .*' # filter instable changeset order |
|
151 | 151 | initializing destination srcfull-hg repository |
|
152 | 152 | connecting to $TESTTMP/cvsrepo |
|
153 | 153 | scanning source... |
|
154 | 154 | collecting CVS rlog |
|
155 | 155 | creating changesets |
|
156 | 156 | 4 changeset entries |
|
157 | 157 | sorting... |
|
158 | 158 | converting... |
|
159 | 159 | updating tags |
|
160 | 160 | $ hg cat -r tip --cwd srcfull-hg src/a |
|
161 | 161 | a |
|
162 | 162 | $ hg cat -r tip --cwd srcfull-hg src/b/c |
|
163 | 163 | c |
|
164 | 164 | c |
|
165 | 165 | |
|
166 | 166 | commit new file revisions |
|
167 | 167 | |
|
168 | 168 | $ cd src |
|
169 | 169 | $ echo a >> a |
|
170 | 170 | $ echo c >> b/c |
|
171 | 171 | $ cvscall -q commit -mci1 . | grep '<--' |
|
172 | 172 | $TESTTMP/cvsrepo/src/a,v <-- a |
|
173 | 173 | $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob) |
|
174 | 174 | $ cd .. |
|
175 | 175 | |
|
176 | 176 | convert again |
|
177 | 177 | |
|
178 | 178 | $ TZ=Pacific/Johnston hg convert --config convert.localtimezone=True src src-hg |
|
179 | 179 | connecting to $TESTTMP/cvsrepo |
|
180 | 180 | scanning source... |
|
181 | 181 | collecting CVS rlog |
|
182 | 182 | 7 log entries |
|
183 | 183 | cvslog hook: 7 entries |
|
184 | 184 | creating changesets |
|
185 | 185 | 4 changeset entries |
|
186 | 186 | cvschangesets hook: 4 changesets |
|
187 | 187 | sorting... |
|
188 | 188 | converting... |
|
189 | 189 | 0 ci1 |
|
190 | 190 | $ hgcat a |
|
191 | 191 | a |
|
192 | 192 | a |
|
193 | 193 | $ hgcat b/c |
|
194 | 194 | c |
|
195 | 195 | c |
|
196 | 196 | c |
|
197 | 197 | |
|
198 | 198 | convert again with --filemap |
|
199 | 199 | |
|
200 | 200 | $ hg convert --filemap filemap src src-filemap |
|
201 | 201 | connecting to $TESTTMP/cvsrepo |
|
202 | 202 | scanning source... |
|
203 | 203 | collecting CVS rlog |
|
204 | 204 | 7 log entries |
|
205 | 205 | cvslog hook: 7 entries |
|
206 | 206 | creating changesets |
|
207 | 207 | 4 changeset entries |
|
208 | 208 | cvschangesets hook: 4 changesets |
|
209 | 209 | sorting... |
|
210 | 210 | converting... |
|
211 | 211 | 0 ci1 |
|
212 | 212 | $ hgcat b/c |
|
213 | 213 | c |
|
214 | 214 | c |
|
215 | 215 | c |
|
216 | 216 | $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n' |
|
217 | 217 | 3 ci1 files: b/c |
|
218 | 218 | 2 update tags files: .hgtags |
|
219 | 219 | 1 ci0 files: b/c |
|
220 | 220 | 0 Initial revision files: b/c |
|
221 | 221 | |
|
222 | 222 | commit branch |
|
223 | 223 | |
|
224 | 224 | $ cd src |
|
225 | 225 | $ cvs -q update -r1.1 b/c |
|
226 | 226 | U b/c |
|
227 | 227 | $ cvs -q tag -b branch |
|
228 | 228 | T a |
|
229 | 229 | T b/c |
|
230 | 230 | $ cvs -q update -r branch > /dev/null |
|
231 | 231 | $ sleep 1 |
|
232 | 232 | $ echo d >> b/c |
|
233 | 233 | $ cvs -q commit -mci2 . | grep '<--' |
|
234 | 234 | $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob) |
|
235 | 235 | $ cd .. |
|
236 | 236 | |
|
237 | 237 | convert again |
|
238 | 238 | |
|
239 | 239 | $ TZ=Pacific/Johnston hg convert --config convert.localtimezone=True src src-hg |
|
240 | 240 | connecting to $TESTTMP/cvsrepo |
|
241 | 241 | scanning source... |
|
242 | 242 | collecting CVS rlog |
|
243 | 243 | 8 log entries |
|
244 | 244 | cvslog hook: 8 entries |
|
245 | 245 | creating changesets |
|
246 | 246 | 5 changeset entries |
|
247 | 247 | cvschangesets hook: 5 changesets |
|
248 | 248 | sorting... |
|
249 | 249 | converting... |
|
250 | 250 | 0 ci2 |
|
251 | 251 | $ hgcat b/c |
|
252 | 252 | c |
|
253 | 253 | d |
|
254 | 254 | |
|
255 | 255 | convert again with --filemap |
|
256 | 256 | |
|
257 | 257 | $ TZ=Pacific/Johnston hg convert --config convert.localtimezone=True --filemap filemap src src-filemap |
|
258 | 258 | connecting to $TESTTMP/cvsrepo |
|
259 | 259 | scanning source... |
|
260 | 260 | collecting CVS rlog |
|
261 | 261 | 8 log entries |
|
262 | 262 | cvslog hook: 8 entries |
|
263 | 263 | creating changesets |
|
264 | 264 | 5 changeset entries |
|
265 | 265 | cvschangesets hook: 5 changesets |
|
266 | 266 | sorting... |
|
267 | 267 | converting... |
|
268 | 268 | 0 ci2 |
|
269 | 269 | $ hgcat b/c |
|
270 | 270 | c |
|
271 | 271 | d |
|
272 | 272 | $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n' |
|
273 | 273 | 4 ci2 files: b/c |
|
274 | 274 | 3 ci1 files: b/c |
|
275 | 275 | 2 update tags files: .hgtags |
|
276 | 276 | 1 ci0 files: b/c |
|
277 | 277 | 0 Initial revision files: b/c |
|
278 | 278 | |
|
279 | 279 | commit a new revision with funny log message |
|
280 | 280 | |
|
281 | 281 | $ cd src |
|
282 | 282 | $ sleep 1 |
|
283 | 283 | $ echo e >> a |
|
284 | 284 | $ cvscall -q commit -m'funny |
|
285 | 285 | > ---------------------------- |
|
286 | 286 | > log message' . | grep '<--' |\ |
|
287 | 287 | > sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' |
|
288 | 288 | checking in src/a,v |
|
289 | 289 | |
|
290 | 290 | commit new file revisions with some fuzz |
|
291 | 291 | |
|
292 | 292 | $ sleep 1 |
|
293 | 293 | $ echo f >> a |
|
294 | 294 | $ cvscall -q commit -mfuzzy . | grep '<--' |
|
295 | 295 | $TESTTMP/cvsrepo/src/a,v <-- a |
|
296 | 296 | $ sleep 4 # the two changes will be split if fuzz < 4 |
|
297 | 297 | $ echo g >> b/c |
|
298 | 298 | $ cvscall -q commit -mfuzzy . | grep '<--' |
|
299 | 299 | $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob) |
|
300 | 300 | $ cd .. |
|
301 | 301 | |
|
302 | 302 | convert again |
|
303 | 303 | |
|
304 | 304 | $ TZ=Pacific/Johnston hg convert --config convert.cvsps.fuzz=2 --config convert.localtimezone=True src src-hg |
|
305 | 305 | connecting to $TESTTMP/cvsrepo |
|
306 | 306 | scanning source... |
|
307 | 307 | collecting CVS rlog |
|
308 | 308 | 11 log entries |
|
309 | 309 | cvslog hook: 11 entries |
|
310 | 310 | creating changesets |
|
311 | 311 | 8 changeset entries |
|
312 | 312 | cvschangesets hook: 8 changesets |
|
313 | 313 | sorting... |
|
314 | 314 | converting... |
|
315 | 315 | 2 funny |
|
316 | 316 | 1 fuzzy |
|
317 | 317 | 0 fuzzy |
|
318 | 318 | $ hg -R src-hg log -G --template '{rev} ({branches}) {desc} date: {date|date} files: {files}\n' |
|
319 | 319 | o 8 (branch) fuzzy date: * -1000 files: b/c (glob) |
|
320 | 320 | | |
|
321 | 321 | o 7 (branch) fuzzy date: * -1000 files: a (glob) |
|
322 | 322 | | |
|
323 | 323 | o 6 (branch) funny |
|
324 | 324 | | ---------------------------- |
|
325 | 325 | | log message date: * -1000 files: a (glob) |
|
326 | 326 | o 5 (branch) ci2 date: * -1000 files: b/c (glob) |
|
327 | 327 | |
|
328 | 328 | o 4 () ci1 date: * -1000 files: a b/c (glob) |
|
329 | 329 | | |
|
330 | 330 | o 3 () update tags date: * +0000 files: .hgtags (glob) |
|
331 | 331 | | |
|
332 | 332 | | o 2 (INITIAL) import date: * -1000 files: (glob) |
|
333 | 333 | | | |
|
334 | 334 | o | 1 () ci0 date: * -1000 files: b/c (glob) |
|
335 | 335 | |/ |
|
336 | 336 | o 0 () Initial revision date: * -1000 files: a b/c (glob) |
|
337 | 337 | |
|
338 | 338 | |
|
339 | 339 | testing debugcvsps |
|
340 | 340 | |
|
341 | 341 | $ cd src |
|
342 | 342 | $ hg debugcvsps --fuzz=2 -x >/dev/null |
|
343 | 343 | |
|
344 | 344 | commit a new revision changing a and removing b/c |
|
345 | 345 | |
|
346 | 346 | $ cvscall -q update -A |
|
347 | 347 | U a |
|
348 | 348 | U b/c |
|
349 | 349 | $ sleep 1 |
|
350 | 350 | $ echo h >> a |
|
351 | 351 | $ cvscall -Q remove -f b/c |
|
352 | 352 | $ cvscall -q commit -mci | grep '<--' |
|
353 | 353 | $TESTTMP/cvsrepo/src/a,v <-- a |
|
354 | 354 | $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob) |
|
355 | 355 | |
|
356 | 356 | update and verify the cvsps cache |
|
357 | 357 | |
|
358 | 358 | $ hg debugcvsps --fuzz=2 -u |
|
359 | 359 | collecting CVS rlog |
|
360 | 360 | 13 log entries |
|
361 | 361 | cvslog hook: 13 entries |
|
362 | 362 | creating changesets |
|
363 | 363 | 11 changeset entries |
|
364 | 364 | cvschangesets hook: 11 changesets |
|
365 | 365 | --------------------- |
|
366 | 366 | PatchSet 1 |
|
367 | 367 | Date: * (glob) |
|
368 | 368 | Author: * (glob) |
|
369 | 369 | Branch: HEAD |
|
370 | 370 | Tag: (none) |
|
371 | 371 | Branchpoints: INITIAL |
|
372 | 372 | Log: |
|
373 | 373 | Initial revision |
|
374 | 374 | |
|
375 | 375 | Members: |
|
376 | 376 | a:INITIAL->1.1 |
|
377 | 377 | |
|
378 | 378 | --------------------- |
|
379 | 379 | PatchSet 2 |
|
380 | 380 | Date: * (glob) |
|
381 | 381 | Author: * (glob) |
|
382 | 382 | Branch: HEAD |
|
383 | 383 | Tag: (none) |
|
384 | 384 | Branchpoints: INITIAL, branch |
|
385 | 385 | Log: |
|
386 | 386 | Initial revision |
|
387 | 387 | |
|
388 | 388 | Members: |
|
389 | 389 | b/c:INITIAL->1.1 |
|
390 | 390 | |
|
391 | 391 | --------------------- |
|
392 | 392 | PatchSet 3 |
|
393 | 393 | Date: * (glob) |
|
394 | 394 | Author: * (glob) |
|
395 | 395 | Branch: INITIAL |
|
396 | 396 | Tag: start |
|
397 | 397 | Log: |
|
398 | 398 | import |
|
399 | 399 | |
|
400 | 400 | Members: |
|
401 | 401 | a:1.1->1.1.1.1 |
|
402 | 402 | b/c:1.1->1.1.1.1 |
|
403 | 403 | |
|
404 | 404 | --------------------- |
|
405 | 405 | PatchSet 4 |
|
406 | 406 | Date: * (glob) |
|
407 | 407 | Author: * (glob) |
|
408 | 408 | Branch: HEAD |
|
409 | 409 | Tag: (none) |
|
410 | 410 | Log: |
|
411 | 411 | ci0 |
|
412 | 412 | |
|
413 | 413 | Members: |
|
414 | 414 | b/c:1.1->1.2 |
|
415 | 415 | |
|
416 | 416 | --------------------- |
|
417 | 417 | PatchSet 5 |
|
418 | 418 | Date: * (glob) |
|
419 | 419 | Author: * (glob) |
|
420 | 420 | Branch: HEAD |
|
421 | 421 | Tag: (none) |
|
422 | 422 | Branchpoints: branch |
|
423 | 423 | Log: |
|
424 | 424 | ci1 |
|
425 | 425 | |
|
426 | 426 | Members: |
|
427 | 427 | a:1.1->1.2 |
|
428 | 428 | |
|
429 | 429 | --------------------- |
|
430 | 430 | PatchSet 6 |
|
431 | 431 | Date: * (glob) |
|
432 | 432 | Author: * (glob) |
|
433 | 433 | Branch: HEAD |
|
434 | 434 | Tag: (none) |
|
435 | 435 | Log: |
|
436 | 436 | ci1 |
|
437 | 437 | |
|
438 | 438 | Members: |
|
439 | 439 | b/c:1.2->1.3 |
|
440 | 440 | |
|
441 | 441 | --------------------- |
|
442 | 442 | PatchSet 7 |
|
443 | 443 | Date: * (glob) |
|
444 | 444 | Author: * (glob) |
|
445 | 445 | Branch: branch |
|
446 | 446 | Tag: (none) |
|
447 | 447 | Log: |
|
448 | 448 | ci2 |
|
449 | 449 | |
|
450 | 450 | Members: |
|
451 | 451 | b/c:1.1->1.1.2.1 |
|
452 | 452 | |
|
453 | 453 | --------------------- |
|
454 | 454 | PatchSet 8 |
|
455 | 455 | Date: * (glob) |
|
456 | 456 | Author: * (glob) |
|
457 | 457 | Branch: branch |
|
458 | 458 | Tag: (none) |
|
459 | 459 | Log: |
|
460 | 460 | funny |
|
461 | 461 | ---------------------------- |
|
462 | 462 | log message |
|
463 | 463 | |
|
464 | 464 | Members: |
|
465 | 465 | a:1.2->1.2.2.1 |
|
466 | 466 | |
|
467 | 467 | --------------------- |
|
468 | 468 | PatchSet 9 |
|
469 | 469 | Date: * (glob) |
|
470 | 470 | Author: * (glob) |
|
471 | 471 | Branch: branch |
|
472 | 472 | Tag: (none) |
|
473 | 473 | Log: |
|
474 | 474 | fuzzy |
|
475 | 475 | |
|
476 | 476 | Members: |
|
477 | 477 | a:1.2.2.1->1.2.2.2 |
|
478 | 478 | |
|
479 | 479 | --------------------- |
|
480 | 480 | PatchSet 10 |
|
481 | 481 | Date: * (glob) |
|
482 | 482 | Author: * (glob) |
|
483 | 483 | Branch: branch |
|
484 | 484 | Tag: (none) |
|
485 | 485 | Log: |
|
486 | 486 | fuzzy |
|
487 | 487 | |
|
488 | 488 | Members: |
|
489 | 489 | b/c:1.1.2.1->1.1.2.2 |
|
490 | 490 | |
|
491 | 491 | --------------------- |
|
492 | 492 | PatchSet 11 |
|
493 | 493 | Date: * (glob) |
|
494 | 494 | Author: * (glob) |
|
495 | 495 | Branch: HEAD |
|
496 | 496 | Tag: (none) |
|
497 | 497 | Log: |
|
498 | 498 | ci |
|
499 | 499 | |
|
500 | 500 | Members: |
|
501 | 501 | a:1.2->1.3 |
|
502 | 502 | b/c:1.3->1.4(DEAD) |
|
503 | 503 | |
|
504 | 504 | |
|
505 | 505 | $ cd .. |
|
506 | 506 | |
|
507 | 507 | Test transcoding CVS log messages (issue5597) |
|
508 | 508 | ============================================= |
|
509 | 509 | |
|
510 | 510 | To emulate commit messages in (non-ascii) multiple encodings portably, |
|
511 | 511 | this test scenario writes CVS history file (*,v file) directly via |
|
512 | 512 | python code. |
|
513 | 513 | |
|
514 | 514 | Commit messages of version 1.2 - 1.4 use u3042 in 3 encodings below. |
|
515 | 515 | |
|
516 | 516 | |encoding |byte sequence | decodable as: | |
|
517 | 517 | | | | utf-8 euc-jp cp932 | |
|
518 | 518 | +----------+--------------+--------------------+ |
|
519 | 519 | |utf-8 |\xe3\x81\x82 | o x x | |
|
520 | 520 | |euc-jp |\xa4\xa2 | x o o | |
|
521 | 521 | |cp932 |\x82\xa0 | x x o | |
|
522 | 522 | |
|
523 | 523 | $ mkdir -p cvsrepo/transcoding |
|
524 | 524 | $ python <<EOF |
|
525 | > fp = open('cvsrepo/transcoding/file,v', 'w') | |
|
526 | > fp.write((''' | |
|
525 | > fp = open('cvsrepo/transcoding/file,v', 'wb') | |
|
526 | > fp.write((b''' | |
|
527 | 527 | > head 1.4; |
|
528 | 528 | > access; |
|
529 | 529 | > symbols |
|
530 | 530 | > start:1.1.1.1 INITIAL:1.1.1; |
|
531 | 531 | > locks; strict; |
|
532 | 532 | > comment @# @; |
|
533 | 533 | > |
|
534 | 534 | > |
|
535 | 535 | > 1.4 |
|
536 | 536 | > date 2017.07.10.00.00.04; author nobody; state Exp; |
|
537 | 537 | > branches; |
|
538 | 538 | > next 1.3; |
|
539 | 539 | > commitid 10059635D016A510FFA; |
|
540 | 540 | > |
|
541 | 541 | > 1.3 |
|
542 | 542 | > date 2017.07.10.00.00.03; author nobody; state Exp; |
|
543 | 543 | > branches; |
|
544 | 544 | > next 1.2; |
|
545 | 545 | > commitid 10059635CFF6A4FF34E; |
|
546 | 546 | > |
|
547 | 547 | > 1.2 |
|
548 | 548 | > date 2017.07.10.00.00.02; author nobody; state Exp; |
|
549 | 549 | > branches; |
|
550 | 550 | > next 1.1; |
|
551 | 551 | > commitid 10059635CFD6A4D5095; |
|
552 | 552 | > |
|
553 | 553 | > 1.1 |
|
554 | 554 | > date 2017.07.10.00.00.01; author nobody; state Exp; |
|
555 | 555 | > branches |
|
556 | 556 | > 1.1.1.1; |
|
557 | 557 | > next ; |
|
558 | 558 | > commitid 10059635CFB6A4A3C33; |
|
559 | 559 | > |
|
560 | 560 | > 1.1.1.1 |
|
561 | 561 | > date 2017.07.10.00.00.01; author nobody; state Exp; |
|
562 | 562 | > branches; |
|
563 | 563 | > next ; |
|
564 | 564 | > commitid 10059635CFB6A4A3C33; |
|
565 | 565 | > |
|
566 | 566 | > |
|
567 | 567 | > desc |
|
568 | 568 | > @@ |
|
569 | 569 | > |
|
570 | 570 | > |
|
571 | 571 | > 1.4 |
|
572 | 572 | > log |
|
573 | > @''' + u'\u3042'.encode('cp932') + ''' (cp932) | |
|
573 | > @''' + u'\u3042'.encode('cp932') + b''' (cp932) | |
|
574 | 574 | > @ |
|
575 | 575 | > text |
|
576 | 576 | > @1 |
|
577 | 577 | > 2 |
|
578 | 578 | > 3 |
|
579 | 579 | > 4 |
|
580 | 580 | > @ |
|
581 | 581 | > |
|
582 | 582 | > |
|
583 | 583 | > 1.3 |
|
584 | 584 | > log |
|
585 | > @''' + u'\u3042'.encode('euc-jp') + ''' (euc-jp) | |
|
585 | > @''' + u'\u3042'.encode('euc-jp') + b''' (euc-jp) | |
|
586 | 586 | > @ |
|
587 | 587 | > text |
|
588 | 588 | > @d4 1 |
|
589 | 589 | > @ |
|
590 | 590 | > |
|
591 | 591 | > |
|
592 | 592 | > 1.2 |
|
593 | 593 | > log |
|
594 | > @''' + u'\u3042'.encode('utf-8') + ''' (utf-8) | |
|
594 | > @''' + u'\u3042'.encode('utf-8') + b''' (utf-8) | |
|
595 | 595 | > @ |
|
596 | 596 | > text |
|
597 | 597 | > @d3 1 |
|
598 | 598 | > @ |
|
599 | 599 | > |
|
600 | 600 | > |
|
601 | 601 | > 1.1 |
|
602 | 602 | > log |
|
603 | 603 | > @Initial revision |
|
604 | 604 | > @ |
|
605 | 605 | > text |
|
606 | 606 | > @d2 1 |
|
607 | 607 | > @ |
|
608 | 608 | > |
|
609 | 609 | > |
|
610 | 610 | > 1.1.1.1 |
|
611 | 611 | > log |
|
612 | 612 | > @import |
|
613 | 613 | > @ |
|
614 | 614 | > text |
|
615 | 615 | > @@ |
|
616 | 616 | > ''').lstrip()) |
|
617 | 617 | > EOF |
|
618 | 618 | |
|
619 | 619 | $ cvscall -q checkout transcoding |
|
620 | 620 | U transcoding/file |
|
621 | 621 | |
|
622 | 622 | Test converting in normal case |
|
623 | 623 | ------------------------------ |
|
624 | 624 | |
|
625 | 625 | (filtering by grep in order to check only form of debug messages) |
|
626 | 626 | |
|
627 | 627 | $ hg convert --config convert.cvsps.logencoding=utf-8,euc-jp,cp932 -q --debug transcoding transcoding-hg | grep 'transcoding by' |
|
628 | 628 | transcoding by utf-8: 1.1 of file |
|
629 | 629 | transcoding by utf-8: 1.1.1.1 of file |
|
630 | 630 | transcoding by utf-8: 1.2 of file |
|
631 | 631 | transcoding by euc-jp: 1.3 of file |
|
632 | 632 | transcoding by cp932: 1.4 of file |
|
633 | 633 | $ hg -R transcoding-hg --encoding utf-8 log -T "{rev}: {desc}\n" |
|
634 | 634 | 5: update tags |
|
635 | 635 | 4: import |
|
636 | 636 | 3: \xe3\x81\x82 (cp932) (esc) |
|
637 | 637 | 2: \xe3\x81\x82 (euc-jp) (esc) |
|
638 | 638 | 1: \xe3\x81\x82 (utf-8) (esc) |
|
639 | 639 | 0: Initial revision |
|
640 | 640 | $ rm -rf transcoding-hg |
|
641 | 641 | |
|
642 | 642 | Test converting in error cases |
|
643 | 643 | ------------------------------ |
|
644 | 644 | |
|
645 | 645 | unknown encoding in convert.cvsps.logencoding |
|
646 | 646 | |
|
647 | 647 | $ hg convert --config convert.cvsps.logencoding=foobar -q transcoding transcoding-hg |
|
648 | 648 | abort: unknown encoding: foobar |
|
649 | 649 | (check convert.cvsps.logencoding configuration) |
|
650 | 650 | [255] |
|
651 | 651 | $ rm -rf transcoding-hg |
|
652 | 652 | |
|
653 | 653 | no acceptable encoding in convert.cvsps.logencoding |
|
654 | 654 | |
|
655 | 655 | $ hg convert --config convert.cvsps.logencoding=utf-8,euc-jp -q transcoding transcoding-hg |
|
656 | 656 | abort: no encoding can transcode CVS log message for 1.4 of file |
|
657 | 657 | (check convert.cvsps.logencoding configuration) |
|
658 | 658 | [255] |
|
659 | 659 | $ rm -rf transcoding-hg |
General Comments 0
You need to be logged in to leave comments.
Login now