# HG changeset patch # User Greg Ward # Date 1241646483 14400 # Node ID 7a0fcdd3828f90b7f1d4ac855f6ed7393d670a3c # Parent 991ca609ccd650686708f959243195f8a856b3fe convert/bzr: handle Bazaar timestamps correctly (issue1652). diff -r 991ca609ccd6 -r 7a0fcdd3828f hgext/convert/bzr.py --- a/hgext/convert/bzr.py Thu May 07 17:56:57 2009 +0200 +++ b/hgext/convert/bzr.py Wed May 06 17:48:03 2009 -0400 @@ -110,8 +110,7 @@ self._parentids[version] = parents return commit(parents=parents, - # bzr uses 1 second timezone precision - date='%d %d' % (rev.timestamp, rev.timezone / 3600), + date='%d %d' % (rev.timestamp, -rev.timezone), author=self.recode(rev.committer), # bzr returns bytestrings or unicode, depending on the content desc=self.recode(rev.message), diff -r 991ca609ccd6 -r 7a0fcdd3828f tests/test-convert-bzr --- a/tests/test-convert-bzr Thu May 07 17:56:57 2009 +0200 +++ b/tests/test-convert-bzr Wed May 06 17:48:03 2009 -0400 @@ -33,6 +33,26 @@ EOF hg convert --filemap filemap source source-filemap-hg hg -R source-filemap-hg manifest -r tip + +# extract timestamps that look just like hg's {date|isodate}: +# yyyy-mm-dd HH:MM zzzz (no seconds!) +echo "% compare timestamps" +cd source +bzr log | \ + awk -F'[ :]' '$1 == "timestamp" { printf "%s %s:%s %s\n", $4, $5, $6, $8 }' \ + > ../bzr-timestamps +cd .. + +hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps +if diff -q bzr-timestamps hg-timestamps ; then + echo "good: hg timestamps match bzr timestamps" +else + echo "fail: bzr timestamps are:" + cat bzr-timestamps + echo "but hg timestamps are:" + cat hg-timestamps +fi + cd .. echo % merge diff -r 991ca609ccd6 -r 7a0fcdd3828f tests/test-convert-bzr.out --- a/tests/test-convert-bzr.out Thu May 07 17:56:57 2009 +0200 +++ b/tests/test-convert-bzr.out Wed May 06 17:48:03 2009 -0400 @@ -35,6 +35,8 @@ b d f +% compare timestamps +good: hg timestamps match bzr timestamps % merge initializing destination source-hg repository scanning source...