Patchwork D8486: fastexport: adjust output to be more canonical

login
register
mail settings
Submitter phabricator
Date April 27, 2020, 7:56 p.m.
Message ID <differential-rev-PHID-DREV-xaxmewu7oer37fjk2mvz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46247/
State Superseded
Headers show

Comments

phabricator - April 27, 2020, 7:56 p.m.
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The real name part of the committer name is normally not quoted, so
  don't enforce that. Prefer UTC+0 to UTC-0, git doesn't normalize it.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

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
@@ -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 +0000
   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
@@ -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
diff --git a/hgext/fastexport.py b/hgext/fastexport.py
--- a/hgext/fastexport.py
+++ b/hgext/fastexport.py
@@ -46,14 +46,14 @@ 
             % rev
         )
     if user_person:
-        return b'"' + user_person + b'" <' + user_email + b'>'
+        return b'%s <%s>' % (user_person, user_email)
     else:
-        return b"<" + user_email + b">"
+        return b"<%s>" % user_email
 
 
 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,)