D3081: wireproto: use repo.lookup() for lookup command

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Apr 4 22:53:57 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'm trying to reduce use of repo[<string>] and this seems like an
  obvious place to use repo.lookup().

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/wireproto.py

CHANGE DETAILS

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -1014,8 +1014,8 @@
 def lookup(repo, proto, key):
     try:
         k = encoding.tolocal(key)
-        c = repo[k]
-        r = c.hex()
+        n = repo.lookup(k)
+        r = hex(n)
         success = 1
     except Exception as inst:
         r = stringutil.forcebytestr(inst)



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list