D2261: py3: use pycompat.bytestr to convert str to bytes

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Feb 14 11:25:29 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -809,7 +809,7 @@
                                     'to set your username'))
         if "\n" in user:
             raise error.Abort(_("username %s contains a newline\n")
-                              % repr(user))
+                              % pycompat.bytestr(repr(user)))
         return user
 
     def shortuser(self, user):
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -20,6 +20,7 @@
 from . import (
     encoding,
     error,
+    pycompat,
     revlog,
     util,
 )
@@ -518,7 +519,7 @@
             raise error.RevlogError(_("empty username"))
         if "\n" in user:
             raise error.RevlogError(_("username %s contains a newline")
-                                    % repr(user))
+                                    % pycompat.bytestr(repr(user)))
 
         desc = stripdesc(desc)
 



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list