Patchwork D8522: fastexport: adjust output to be more canonical

login
register
mail settings
Submitter phabricator
Date May 12, 2020, 8:30 p.m.
Message ID <differential-rev-PHID-DREV-azsgofnsxt3orduelq3s-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46308/
State Superseded
Headers show

Comments

phabricator - May 12, 2020, 8:30 p.m.
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  For time zones, git doesn't consider +0 and -0 the same timezone, so use
  the former canonically. Add a test case to ensure that non-UTC offsets
  are handled correctly. The real name part of the committer name is
  normally not quoted, so don't enforce that.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D8522

AFFECTED FILES
  hgext/fastexport.py
  tests/test-fastexport.t

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-fastexport.t b/tests/test-fastexport.t
--- a/tests/test-fastexport.t
+++ b/tests/test-fastexport.t
@@ -10,7 +10,7 @@ 
   $ hg up -r 10
   13 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg rm nf10
-  $ hg commit -u debugbuilddag --date 'Thu Jan 01 00:00:12 1970 +0000' -m r12
+  $ hg commit -u debugbuilddag --date 'Thu Jan 01 02:30:12 1970 +0230' -m r12
   created new head
   $ hg up -r 11
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -20,20 +20,20 @@ 
   $ hg commit -m debugbuilddag --date 'Thu Jan 01 00:00:13 1970 +0000'
 
   $ hg log -G
-  @    changeset:   13:e5c379648af4
+  @    changeset:   13:5544befcb7ce
   |\   branch:      both
   | |  tag:         tip
   | |  parent:      11:2cbd52c10e88
-  | |  parent:      12:4f31c9604af6
+  | |  parent:      12:66d0c21243be
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:13 1970 +0000
   | |  summary:     debugbuilddag
   | |
-  | o  changeset:   12:4f31c9604af6
+  | o  changeset:   12:66d0c21243be
   | |  branch:      both
   | |  parent:      10:9220596cb068
   | |  user:        debugbuilddag
-  | |  date:        Thu Jan 01 00:00:12 1970 +0000
+  | |  date:        Thu Jan 01 02:30:12 1970 +0230
   | |  summary:     r12
   | |
   o |  changeset:   11:2cbd52c10e88
@@ -150,7 +150,7 @@ 
   
   commit refs/heads/default
   mark :3
-  committer "debugbuilddag" <debugbuilddag> 0 -0000
+  committer "debugbuilddag" <debugbuilddag> 0 +0000
   data 2
   r0
   M 644 :1 mf
@@ -197,7 +197,7 @@ 
   
   commit refs/heads/default
   mark :7
-  committer "debugbuilddag" <debugbuilddag> 1 -0000
+  committer "debugbuilddag" <debugbuilddag> 1 +0000
   data 2
   r1
   from :3
@@ -245,7 +245,7 @@ 
   
   commit refs/heads/name1
   mark :11
-  committer "debugbuilddag" <debugbuilddag> 2 -0000
+  committer "debugbuilddag" <debugbuilddag> 2 +0000
   data 2
   r2
   from :7
@@ -293,7 +293,7 @@ 
   
   commit refs/heads/name1
   mark :15
-  committer "debugbuilddag" <debugbuilddag> 3 -0000
+  committer "debugbuilddag" <debugbuilddag> 3 +0000
   data 2
   r3
   from :11
@@ -341,7 +341,7 @@ 
   
   commit refs/heads/name1
   mark :19
-  committer "debugbuilddag" <debugbuilddag> 4 -0000
+  committer "debugbuilddag" <debugbuilddag> 4 +0000
   data 2
   r4
   from :15
@@ -389,7 +389,7 @@ 
   
   commit refs/heads/name2
   mark :23
-  committer "debugbuilddag" <debugbuilddag> 5 -0000
+  committer "debugbuilddag" <debugbuilddag> 5 +0000
   data 2
   r5
   from :7
@@ -437,7 +437,7 @@ 
   
   commit refs/heads/name2
   mark :27
-  committer "debugbuilddag" <debugbuilddag> 6 -0000
+  committer "debugbuilddag" <debugbuilddag> 6 +0000
   data 2
   r6
   from :23
@@ -485,7 +485,7 @@ 
   
   commit refs/heads/name2
   mark :31
-  committer "debugbuilddag" <debugbuilddag> 7 -0000
+  committer "debugbuilddag" <debugbuilddag> 7 +0000
   data 2
   r7
   from :27
@@ -533,7 +533,7 @@ 
   
   commit refs/heads/name2
   mark :35
-  committer "debugbuilddag" <debugbuilddag> 8 -0000
+  committer "debugbuilddag" <debugbuilddag> 8 +0000
   data 2
   r8
   from :31
@@ -581,7 +581,7 @@ 
   
   commit refs/heads/both
   mark :39
-  committer "debugbuilddag" <debugbuilddag> 9 -0000
+  committer "debugbuilddag" <debugbuilddag> 9 +0000
   data 2
   r9
   from :35
@@ -633,7 +633,7 @@ 
   
   commit refs/heads/both
   mark :43
-  committer "debugbuilddag" <debugbuilddag> 10 -0000
+  committer "debugbuilddag" <debugbuilddag> 10 +0000
   data 3
   r10
   from :39
@@ -681,7 +681,7 @@ 
   
   commit refs/heads/both
   mark :47
-  committer "debugbuilddag" <debugbuilddag> 11 -0000
+  committer "debugbuilddag" <debugbuilddag> 11 +0000
   data 3
   r11
   from :43
@@ -691,7 +691,7 @@ 
   
   commit refs/heads/both
   mark :48
-  committer "debugbuilddag" <debugbuilddag> 12 -0000
+  committer "debugbuilddag" <debugbuilddag> 12 +0230
   data 3
   r12
   from :43
@@ -699,7 +699,7 @@ 
   
   commit refs/heads/both
   mark :49
-  committer "test" <test> 13 -0000
+  committer "test" <test> 13 +0000
   data 13
   debugbuilddag
   from :47
@@ -754,8 +754,8 @@ 
   33fbc651630ffa7ccbebfe4eb91320a873e7291c
   868d828870663d075cdcff502d26cf8445ce068e
   2cbd52c10e88ce604402dc83a869ec4f07765b3d
-  4f31c9604af676986343d775b05695f535e8db5e
-  e5c379648af4c9fa3b5546ab7ee6e61a36082830
+  66d0c21243be072f82ced64aa730ab0367252451
+  5544befcb7ce4a558ed9e19909e16af574a2a3c6
 
   $ hg fastexport --export-marks fastexport.marks2 -r 0
   blob
@@ -793,7 +793,7 @@ 
   
   commit refs/heads/default
   mark :3
-  committer "debugbuilddag" <debugbuilddag> 0 -0000
+  committer "debugbuilddag" <debugbuilddag> 0 +0000
   data 2
   r0
   M 644 :1 mf
@@ -845,7 +845,7 @@ 
   
   commit refs/heads/default
   mark :7
-  committer "debugbuilddag" <debugbuilddag> 1 -0000
+  committer "debugbuilddag" <debugbuilddag> 1 +0000
   data 2
   r1
   from :3
@@ -861,5 +861,5 @@ 
   data 4
   foo
   
-  abort: Unable to parse user into person and email for revision 4f71ca786403919cd16669d94ff7cd1c09437a44
+  abort: Unable to parse user into person and email for revision 65a3f69b9b519de73d755472c1ab05990ab8a7f7
   [255]
diff --git a/hgext/fastexport.py b/hgext/fastexport.py
--- a/hgext/fastexport.py
+++ b/hgext/fastexport.py
@@ -53,7 +53,7 @@ 
 
 def convert_to_git_date(date):
     timestamp, utcoff = date
-    tzsign = b"+" if utcoff < 0 else b"-"
+    tzsign = b"+" if utcoff <= 0 else b"-"
     if utcoff % 60 != 0:
         raise error.Abort(
             _(b"UTC offset in %b is not an integer number of seconds") % (date,)