D4885: repo: create changectx in a single place in localrepo.__getitem__
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Oct 5 00:03:50 UTC 2018
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4885
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
@@ -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))
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list