From patchwork Sat Nov 23 04:06:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7474: localrepo: extract handling of some special value in __getitem__ From: phabricator X-Patchwork-Id: 43455 Message-Id: <609b874b9000d697b297707461388501@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Sat, 23 Nov 2019 04:06:57 +0000 Closed by commit rHGb7d0aa525435: localrepo: extract handling of some special value in __getitem__ (authored by marmoute). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7474?vs=18281&id=18326 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7474/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7474 AFFECTED FILES mercurial/localrepo.py CHANGE DETAILS To: marmoute, #hg-reviewers, indygreg Cc: mercurial-devel diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1530,14 +1530,14 @@ 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)