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, ) @@ -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) diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -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):