Mercurial > hg-stable
changeset 40065:5c3585a58845
repo: create changectx in a single place in localrepo.__getitem__
Differential Revision: https://phab.mercurial-scm.org/D4885
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 04 Oct 2018 16:27:40 -0700 |
parents | f84d7ed3bb35 |
children | 25533575d04e |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 2 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu Oct 04 16:06:36 2018 -0700 +++ b/mercurial/localrepo.py Thu Oct 04 16:27:40 2018 -0700 @@ -1222,26 +1222,21 @@ if isinstance(changeid, int): node = self.changelog.node(changeid) rev = changeid - return context.changectx(self, rev, node) elif changeid == 'null': node = nullid rev = nullrev - return context.changectx(self, rev, node) elif changeid == 'tip': node = self.changelog.tip() rev = self.changelog.rev(node) - return context.changectx(self, rev, node) elif changeid == '.': # this is a hack to delay/avoid loading obsmarkers # when we know that '.' won't be hidden node = self.dirstate.p1() rev = self.unfiltered().changelog.rev(node) - return context.changectx(self, rev, node) elif len(changeid) == 20: try: node = changeid rev = self.changelog.rev(changeid) - return context.changectx(self, rev, node) except error.FilteredLookupError: changeid = hex(changeid) # for the error message raise @@ -1260,12 +1255,13 @@ elif len(changeid) == 40: node = bin(changeid) rev = self.changelog.rev(node) - return context.changectx(self, rev, node) else: raise error.ProgrammingError( "unsupported changeid '%s' of type %s" % (changeid, type(changeid))) + return context.changectx(self, rev, node) + except (error.FilteredIndexError, error.FilteredLookupError): raise error.FilteredRepoLookupError(_("filtered revision '%s'") % pycompat.bytestr(changeid))