# HG changeset patch # User Pierre-Yves David # Date 2019-11-21 16:53:08 # Node ID 6237cb11753e6fd551b3d2cd29a6da516061dc5b # Parent 9c83d28776af6e8ebe29216ba64da4a4006409d6 localrepo: extract handling of some special value in __getitem__ The value "null" will always be present in a repository. So this lookup should always succeed and do not need to be in the general try/catch. Differential Revision: https://phab.mercurial-scm.org/D7474 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1530,14 +1530,14 @@ class localrepository(object): if i not in self.changelog.filteredrevs ] + # dealing with some special values + if changeid == b'null': + return context.changectx(self, nullrev, nullid) # dealing with arbitrary values try: if isinstance(changeid, int): node = self.changelog.node(changeid) rev = changeid - elif changeid == b'null': - node = nullid - rev = nullrev elif changeid == b'tip': node = self.changelog.tip() rev = self.changelog.rev(node)