changeset 36266:ddeb7653b31c

py3: use pycompat.bytestr to convert str to bytes Differential Revision: https://phab.mercurial-scm.org/D2261
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 14 Feb 2018 16:37:46 +0530
parents 69080ee1fb0e
children 6ea0b78ddcac
files mercurial/changelog.py mercurial/ui.py
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Mon Feb 12 10:41:00 2018 -0500
+++ b/mercurial/changelog.py	Wed Feb 14 16:37:46 2018 +0530
@@ -20,6 +20,7 @@
 from . import (
     encoding,
     error,
+    pycompat,
     revlog,
     util,
 )
@@ -517,8 +518,8 @@
         if not user:
             raise error.RevlogError(_("empty username"))
         if "\n" in user:
-            raise error.RevlogError(_("username %s contains a newline")
-                                    % repr(user))
+            raise error.RevlogError(_("username %r contains a newline")
+                                    % pycompat.bytestr(user))
 
         desc = stripdesc(desc)
 
--- a/mercurial/ui.py	Mon Feb 12 10:41:00 2018 -0500
+++ b/mercurial/ui.py	Wed Feb 14 16:37:46 2018 +0530
@@ -808,8 +808,8 @@
                              hint=_("use 'hg config --edit' "
                                     'to set your username'))
         if "\n" in user:
-            raise error.Abort(_("username %s contains a newline\n")
-                              % repr(user))
+            raise error.Abort(_("username %r contains a newline\n")
+                              % pycompat.bytestr(user))
         return user
 
     def shortuser(self, user):