Patchwork D8398: fastexport: fix diagnostics

login
register
mail settings
Submitter phabricator
Date April 10, 2020, 8:33 p.m.
Message ID <differential-rev-PHID-DREV-ob7lyclurgv2bwnf4dmz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46064/
State Superseded
Headers show

Comments

phabricator - April 10, 2020, 8:33 p.m.
joerg.sonnenberger created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-devel
phabricator - April 13, 2020, 3:51 p.m.
pulkit added inline comments.

INLINE COMMENTS

> fastexport.py:36
>  
> -
>  def convert_to_git_user(authormap, user, rev):

Removed this unrequired change to make test-check-format.t happy.

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8398/new/

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

To: joerg.sonnenberger, #hg-reviewers, pulkit
Cc: mercurial-devel
phabricator - April 13, 2020, 5:20 p.m.
martinvonz added a comment.


  What was broken before? The test case still seems to pass for me if I undo the code change.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8398/new/

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

To: joerg.sonnenberger, #hg-reviewers, pulkit
Cc: martinvonz, mercurial-devel
phabricator - April 13, 2020, 5:34 p.m.
joerg.sonnenberger added a comment.


  Think about any attempt to localize the error message.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8398/new/

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

To: joerg.sonnenberger, #hg-reviewers, pulkit
Cc: martinvonz, mercurial-devel
phabricator - April 13, 2020, 5:38 p.m.
martinvonz added a comment.


  In D8398#125450 <https://phab.mercurial-scm.org/D8398#125450>, @joerg.sonnenberger wrote:
  
  > Think about any attempt to localize the error message.
  
  Would have helped to put that in the commit message. So the `pycompat.bytestr()` call is unrelated and not needed, right?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8398/new/

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

To: joerg.sonnenberger, #hg-reviewers, pulkit
Cc: martinvonz, mercurial-devel
phabricator - April 13, 2020, 5:43 p.m.
martinvonz added a comment.


  In D8398#125451 <https://phab.mercurial-scm.org/D8398#125451>, @martinvonz wrote:
  
  > In D8398#125450 <https://phab.mercurial-scm.org/D8398#125450>, @joerg.sonnenberger wrote:
  >
  >> Think about any attempt to localize the error message.
  >
  > Would have helped to put that in the commit message. So the `pycompat.bytestr()` call is unrelated and not needed, right?
  
  I'll update it in flight with a new commit message and without the `pycompat.bytestr()`.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8398/new/

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

To: joerg.sonnenberger, #hg-reviewers, pulkit
Cc: martinvonz, 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
@@ -853,3 +853,13 @@ 
   M 644 :5 nf1
   M 644 :6 of
   
+  $ echo foo > of
+  $ hg commit --user '<badname> <bad email>' --date 'Fri Jan 02 00:00:00 1970 +0000' -m 'Testcommit'
+  $ hg fastexport --import-marks fastexport.marks -r tip
+  blob
+  mark :50
+  data 4
+  foo
+  
+  abort: Unable to parse user into person and email for revision 4f71ca786403919cd16669d94ff7cd1c09437a44
+  [255]
diff --git a/hgext/fastexport.py b/hgext/fastexport.py
--- a/hgext/fastexport.py
+++ b/hgext/fastexport.py
@@ -33,7 +33,6 @@ 
 GIT_PERSON_PROHIBITED = re.compile(b'[<>\n"]')
 GIT_EMAIL_PROHIBITED = re.compile(b"[<> \n]")
 
-
 def convert_to_git_user(authormap, user, rev):
     mapped_user = authormap.get(user, user)
     user_person = stringutil.person(mapped_user)
@@ -42,7 +41,8 @@ 
         user_person
     ):
         raise error.Abort(
-            _(b"Unable to parse user into person and email for revision " + rev)
+            _(b"Unable to parse user into person and email for revision %s")
+            % pycompat.bytestr(rev)
         )
     if user_person:
         return b'"' + user_person + b'" <' + user_email + b'>'