##// END OF EJS Templates
convert: set date and time for svn commits...
Nikita Slyusarev -
r46819:3dc886e6 default draft
parent child Browse files
Show More
@@ -1389,6 +1389,7 b' PROPNAME="$4"'
1389 1389 ACTION="$5"
1390 1390
1391 1391 if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
1392 if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:date" ]; then exit 0; fi
1392 1393 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
1393 1394 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
1394 1395
@@ -1636,6 +1637,9 b' class svn_sink(converter_sink, commandli'
1636 1637 fp = os.fdopen(fd, 'wb')
1637 1638 fp.write(util.tonativeeol(commit.desc))
1638 1639 fp.close()
1640 # Subverson always uses UTC to represent date and time
1641 date = dateutil.parsedate(commit.date)
1642 svndate = dateutil.datestr((date[0], 0), b'%Y-%m-%dT%H:%M:%S.000000Z')
1639 1643 try:
1640 1644 output = self.run0(
1641 1645 b'commit',
@@ -1667,6 +1671,14 b' class svn_sink(converter_sink, commandli'
1667 1671 revprop=True,
1668 1672 revision=rev,
1669 1673 )
1674 # The only way to set date and time for svn commit is to use propset after commit is done
1675 self.run(
1676 b'propset',
1677 b'svn:date',
1678 svndate,
1679 revprop=True,
1680 revision=rev,
1681 )
1670 1682 for parent in parents:
1671 1683 self.addchild(parent, rev)
1672 1684 return self.revid(rev)
@@ -15,6 +15,7 b' def parseentry(entry):'
15 15 e['revision'] = entry.getAttribute('revision')
16 16 e['author'] = xmltext(entry.getElementsByTagName('author')[0])
17 17 e['msg'] = xmltext(entry.getElementsByTagName('msg')[0])
18 e['date'] = xmltext(entry.getElementsByTagName('date')[0])
18 19 e['paths'] = []
19 20 paths = entry.getElementsByTagName('paths')
20 21 if paths:
@@ -42,7 +43,7 b' def printentries(entries):'
42 43 except AttributeError:
43 44 fp = sys.stdout
44 45 for e in entries:
45 for k in ('revision', 'author', 'msg'):
46 for k in ('revision', 'author', 'date', 'msg'):
46 47 fp.write(('%s: %s\n' % (k, e[k])).encode('utf-8'))
47 48 for path, action, fpath, frev in sorted(e['paths']):
48 49 frominfo = b''
@@ -24,6 +24,7 b''
24 24 > ACTION="$5"
25 25 >
26 26 > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
27 > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:date" ]; then exit 0; fi
27 28 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
28 29 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
29 30 >
@@ -54,10 +54,12 b' Modify'
54 54 2 2 test a
55 55 revision: 2
56 56 author: test
57 date: 1970-01-01T00:00:01.000000Z
57 58 msg: modify a file
58 59 M /a
59 60 revision: 1
60 61 author: test
62 date: 1970-01-01T00:00:00.000000Z
61 63 msg: add a file
62 64 A /a
63 65 A /d1
@@ -95,6 +97,7 b' Rename'
95 97 3 3 test b
96 98 revision: 3
97 99 author: test
100 date: 1970-01-01T00:00:02.000000Z
98 101 msg: rename a file
99 102 D /a
100 103 A /b (from /a@2)
@@ -131,6 +134,7 b' Copy'
131 134 4 4 test c
132 135 revision: 4
133 136 author: test
137 date: 1970-01-01T00:00:03.000000Z
134 138 msg: copy a file
135 139 A /c (from /b@3)
136 140 $ ls a a-hg-wc
@@ -167,6 +171,7 b' Remove'
167 171 5 5 test .
168 172 revision: 5
169 173 author: test
174 date: 1970-01-01T00:00:04.000000Z
170 175 msg: remove a file
171 176 D /b
172 177 $ ls a a-hg-wc
@@ -209,6 +214,7 b' Executable'
209 214 6 6 test c
210 215 revision: 6
211 216 author: test
217 date: 1970-01-01T00:00:05.000000Z
212 218 msg: make a file executable
213 219 M /c
214 220 #if execbit
@@ -247,6 +253,7 b' Symlinks'
247 253 8 8 test newlink
248 254 revision: 8
249 255 author: test
256 date: 1970-01-01T00:00:00.000000Z
250 257 msg: move symlink
251 258 D /link
252 259 A /newlink (from /link@7)
@@ -278,6 +285,7 b' Convert with --full adds and removes fil'
278 285 7 7 test f
279 286 revision: 7
280 287 author: test
288 date: 1970-01-01T00:00:00.000000Z
281 289 msg: f
282 290 D /c
283 291 A /d
@@ -315,6 +323,7 b' Executable in new directory'
315 323 1 1 test d1/a
316 324 revision: 1
317 325 author: test
326 date: 1970-01-01T00:00:00.000000Z
318 327 msg: add executable file in new directory
319 328 A /d1
320 329 A /d1/a
@@ -343,6 +352,7 b' Copy to new directory'
343 352 2 2 test d2/a
344 353 revision: 2
345 354 author: test
355 date: 1970-01-01T00:00:01.000000Z
346 356 msg: copy file to new directory
347 357 A /d2
348 358 A /d2/a (from /d1/a@1)
@@ -416,21 +426,25 b' Expect 4 changes'
416 426 4 4 test right-2
417 427 revision: 4
418 428 author: test
429 date: 1970-01-01T00:00:05.000000Z
419 430 msg: merge
420 431 A /right-1
421 432 A /right-2
422 433 revision: 3
423 434 author: test
435 date: 1970-01-01T00:00:02.000000Z
424 436 msg: left-2
425 437 M /b
426 438 A /left-2
427 439 revision: 2
428 440 author: test
441 date: 1970-01-01T00:00:01.000000Z
429 442 msg: left-1
430 443 M /b
431 444 A /left-1
432 445 revision: 1
433 446 author: test
447 date: 1970-01-01T00:00:00.000000Z
434 448 msg: base
435 449 A /b
436 450
@@ -459,10 +473,12 b' Tags are not supported, but must not bre'
459 473 2 2 test .hgtags
460 474 revision: 2
461 475 author: test
476 date: 1970-01-01T00:00:01.000000Z
462 477 msg: Tagged as v1.0
463 478 A /.hgtags
464 479 revision: 1
465 480 author: test
481 date: 1970-01-01T00:00:00.000000Z
466 482 msg: Add file a
467 483 A /a
468 484 $ rm -rf a a-hg a-hg-wc
@@ -494,10 +510,12 b' Executable bit removal'
494 510 2 2 test exec
495 511 revision: 2
496 512 author: test
513 date: 1970-01-01T00:00:02.000000Z
497 514 msg: remove executable bit
498 515 M /exec
499 516 revision: 1
500 517 author: test
518 date: 1970-01-01T00:00:01.000000Z
501 519 msg: create executable
502 520 A /exec
503 521 $ test ! -x a-hg-wc/exec
@@ -540,10 +558,12 b' Skipping empty commits'
540 558 2 2 test b
541 559 revision: 2
542 560 author: test
561 date: 1970-01-01T00:00:00.000000Z
543 562 msg: Another change
544 563 A /b
545 564 revision: 1
546 565 author: test
566 date: 1970-01-01T00:00:00.000000Z
547 567 msg: Some change
548 568 A /a
549 569
General Comments 0
You need to be logged in to leave comments. Login now