Patchwork D7474: localrepo: extract handling of some special value in __getitem__

login
register
mail settings
Submitter phabricator
Date Nov. 23, 2019, 11:53 a.m.
Message ID <80f4a78f404c3f3ca85806eef001e8a8@localhost.localdomain>
Download mbox | patch
Permalink /patch/43469/
State Not Applicable
Headers show

Comments

phabricator - Nov. 23, 2019, 11:53 a.m.
marmoute updated this revision to Diff 18341.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7474?vs=18326&id=18341

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

Patch

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)