From patchwork Sat Mar 3 15:45:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D2535: py3: use pycompat.bytestr() to convert error messages to bytes From: phabricator X-Patchwork-Id: 28785 Message-Id: <519136ce72193b336e5213fc132c0262@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Sat, 3 Mar 2018 15:45:29 +0000 pulkit updated this revision to Diff 6433. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2535?vs=6320&id=6433 REVISION DETAIL https://phab.mercurial-scm.org/D2535 AFFECTED FILES hgext/gpg.py hgext/journal.py hgext/largefiles/overrides.py CHANGE DETAILS To: pulkit, durin42, #hg-reviewers, yuja Cc: yuja, mercurial-devel diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -598,7 +598,7 @@ try: result = orig(ui, repo, pats, opts, rename) except error.Abort as e: - if str(e) != _('no files to copy'): + if pycompat.bytestr(e) != _('no files to copy'): raise e else: nonormalfiles = True @@ -705,7 +705,7 @@ lfdirstate.add(destlfile) lfdirstate.write() except error.Abort as e: - if str(e) != _('no files to copy'): + if pycompat.bytestr(e) != _('no files to copy'): raise e else: nolfiles = True diff --git a/hgext/journal.py b/hgext/journal.py --- a/hgext/journal.py +++ b/hgext/journal.py @@ -508,7 +508,7 @@ ctx = repo[hash] displayer.show(ctx) except error.RepoLookupError as e: - fm.write('repolookuperror', "%s\n\n", str(e)) + fm.write('repolookuperror', "%s\n\n", pycompat.bytestr(e)) displayer.close() fm.end() diff --git a/hgext/gpg.py b/hgext/gpg.py --- a/hgext/gpg.py +++ b/hgext/gpg.py @@ -318,7 +318,7 @@ repo.commit(message, opts['user'], opts['date'], match=msigs, editor=editor) except ValueError as inst: - raise error.Abort(str(inst)) + raise error.Abort(pycompat.bytestr(inst)) def node2txt(repo, node, ver): """map a manifest into some text"""