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

2019-11-23 Thread marmoute (Pierre-Yves David)
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

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)



To: marmoute, #hg-reviewers, indygreg
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2019-11-22 Thread marmoute (Pierre-Yves David)
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

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)



To: marmoute, #hg-reviewers, indygreg
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2019-11-22 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7474

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
@@ -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)



To: marmoute, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel