From patchwork Sat Nov 23 04:07:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7475: localrepo: extract handling of some special value in __getitem__ From: phabricator X-Patchwork-Id: 43456 Message-Id: <27a0f5d166be6f6c0f5b4b9a54c7ddc5@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Sat, 23 Nov 2019 04:07:03 +0000 Closed by commit rHG8e2df30694de: 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/D7475?vs=18282&id=18327 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7475/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7475 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 @@ -1533,14 +1533,16 @@ # dealing with some special values if changeid == b'null': return context.changectx(self, nullrev, nullid) + if changeid == b'tip': + node = self.changelog.tip() + rev = self.changelog.rev(node) + return context.changectx(self, rev, node) + # dealing with arbitrary values try: if isinstance(changeid, int): node = self.changelog.node(changeid) rev = changeid - elif changeid == b'tip': - node = self.changelog.tip() - rev = self.changelog.rev(node) elif changeid == b'.': # this is a hack to delay/avoid loading obsmarkers # when we know that '.' won't be hidden