D3185: context: convert binary changeid to hex also for filtered ones

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Apr 7 06:15:06 UTC 2018


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

REVISION SUMMARY
  Funnily enough, within about a day of writing https://phab.mercurial-scm.org/D3144, I ran into the
  exception in practice. I spent some time trying figure out why I got
  the "unknown revision" message when the node was clearly in the repo,
  and then I finally remembered that I had just fixed that bug.  Anyway,
  even with the fix applied, the message wasn't ideal: now it would
  instead be something like "abort: hidden revision 'K*}s!", because the
  error message didn't go through the conversion to hex that happens at
  the end of the try-block. Let's fix that by converting to hex before
  re-raising.
  
  (I included example output in https://phab.mercurial-scm.org/D3144, which is apparently incorrect. I
  suppose that must have been produced when the patch was later in my
  stack of unsent patches, before I rebased it and sent it. Sorry about
  that.)

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -411,6 +411,7 @@
                     self._rev = repo.changelog.rev(changeid)
                     return
                 except error.FilteredLookupError:
+                    changeid = hex(changeid) # for the error message
                     raise
                 except LookupError:
                     pass



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


More information about the Mercurial-devel mailing list