1313 ShaFile ,
1414 Tag ,
1515 Tree ,
16- hex_to_sha
16+ hex_to_sha ,
17+ format_timezone ,
1718 )
1819
1920import math
@@ -230,13 +231,16 @@ def export_hg_commit(self, rev):
230231 author = ctx .user ()
231232 if not '>' in author : # TODO : this kills losslessness - die (submodules)?
232233 author = author + ' <none@none>'
233- commit ['author' ] = author + ' ' + str (int (time )) + ' ' + seconds_to_offset ( timezone )
234+ commit ['author' ] = author + ' ' + str (int (time )) + ' ' + format_timezone ( - timezone )
234235 message = ctx .description ()
235236 commit ['message' ] = ctx .description () + "\n "
236237
237238 extra = ctx .extra ()
238239 if 'committer' in extra :
239- commit ['committer' ] = extra ['committer' ]
240+ # fixup timezone
241+ (name_timestamp , timezone ) = extra ['committer' ].rsplit (' ' , 1 )
242+ timezone = format_timezone (- int (timezone ))
243+ commit ['committer' ] = '%s %s' % (name_timestamp , timezone )
240244 if 'encoding' in extra :
241245 commit ['encoding' ] = extra ['encoding' ]
242246
@@ -623,7 +627,7 @@ def getfilectx(repo, memctx, f):
623627
624628 # if committer is different than author, add it to extra
625629 if not commit ._author_raw == commit ._committer_raw :
626- extra ['committer' ] = commit ._committer_raw
630+ extra ['committer' ] = "%s %d %d" % ( commit .committer , commit . commit_time , - commit . commit_timezone )
627631
628632 if commit ._encoding :
629633 extra ['encoding' ] = commit ._encoding
@@ -632,7 +636,7 @@ def getfilectx(repo, memctx, f):
632636 extra ['branch' ] = hg_branch
633637
634638 text = strip_message
635- date = datetime . datetime . fromtimestamp (commit .author_time ). strftime ( "%Y-%m-%d %H:%M:%S" )
639+ date = (commit .author_time , - commit . author_timezone )
636640 ctx = context .memctx (self .repo , (p1 , p2 ), text , files , getfilectx ,
637641 commit .author , date , extra )
638642 a = self .repo .commitctx (ctx )
0 commit comments