changeset 53269:7e31a7edbd81 stable

convert: correctly convert sub-hour timezones from Git source
author Manuel Jacob <me@manueljacob.de>
date Wed, 07 May 2025 20:11:27 +0200
parents f7bd0b4f0598
children be4be016b627
files hgext/convert/git.py tests/test-convert-git.t
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/git.py	Wed May 07 12:01:19 2025 +0200
+++ b/hgext/convert/git.py	Wed May 07 20:11:27 2025 +0200
@@ -414,7 +414,7 @@
                 message += b'\n%s %s\n' % (messagedifferent, committer)
 
         tzs, tzh, tzm = tz[-5:-4] + b"1", tz[-4:-2], tz[-2:]
-        tz = -int(tzs) * (int(tzh) * 3600 + int(tzm))
+        tz = -int(tzs) * (int(tzh) * 3600 + int(tzm) * 60)
         date = tm + b" " + (b"%d" % tz)
         saverev = self.ui.configbool(b'convert', b'git.saverev')
 
--- a/tests/test-convert-git.t	Wed May 07 12:01:19 2025 +0200
+++ b/tests/test-convert-git.t	Wed May 07 20:11:27 2025 +0200
@@ -1168,3 +1168,21 @@
   message with extras
   
   
+
+Test that date and timezone is converted correctly.
+
+  $ git init --quiet git-repo8
+  $ cd git-repo8
+  $ echo a > a
+  $ git add a
+  $ GIT_COMMITTER_DATE='Wed May 07 23:41:27 2025 +0530' git commit --quiet -m a
+  $ cd ..
+  $ hg convert --quiet git-repo8 hg-repo8
+  $ hg -R hg-repo8 log
+  changeset:   0:53e7aea86468
+  bookmark:    master
+  tag:         tip
+  user:        nottest <[email protected]>
+  date:        Wed May 07 23:41:27 2025 +0530
+  summary:     a
+