D5107: localrepo: ensure we properly %-format ints vs strings in exception throw

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Sun Oct 14 15:07:57 UTC 2018


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

REVISION SUMMARY
  I'm not thrilled with this, but it'll do.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1282,6 +1282,9 @@
             raise error.FilteredRepoLookupError(_("filtered revision '%s'")
                                                 % pycompat.bytestr(changeid))
         except (IndexError, LookupError):
+            if isinstance(changeid, int):
+                raise error.RepoLookupError(
+                    _("unknown revision '%d'") % changeid)
             raise error.RepoLookupError(_("unknown revision '%s'") % changeid)
         except error.WdirUnsupported:
             return context.workingctx(self)



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


More information about the Mercurial-devel mailing list