# HG changeset patch # User Gregory Szorc # Date 1534362339 0 # Node ID c03c5f528e9b542965dec35e3006da7c2ad91dae # Parent eb9b8679c852345740a55f7ca4fc23a95f956bd6 perf: use storage API for resolving manifest node lookup() isn't part of the storage API. And this code shouldn't be accessing manifestlog._revlog directly for the modern code base. So let's port it to the modern API. Note that the previous code was busted for cases where we needed to call lookup() because lookup() isn't exposed by manifestrevlog any more. This change is strictly BC breaking because we no longer support resolving partial nodes. But it is a perf* command and I don't think we should flag the change as such. Differential Revision: https://phab.mercurial-scm.org/D4390 diff -r eb9b8679c852 -r c03c5f528e9b contrib/perf.py --- a/contrib/perf.py Mon Aug 27 08:52:33 2018 -0700 +++ b/contrib/perf.py Wed Aug 15 19:45:39 2018 +0000 @@ -861,7 +861,21 @@ ctx = scmutil.revsingle(repo, rev, rev) t = ctx.manifestnode() else: - t = repo.manifestlog._revlog.lookup(rev) + from mercurial.node import bin + + if len(rev) == 40: + t = bin(rev) + else: + try: + rev = int(rev) + + if util.safehasattr(repo.manifestlog, 'getstorage'): + t = repo.manifestlog.getstorage(b'').node(rev) + else: + t = repo.manifestlog._revlog.lookup(rev) + except ValueError: + raise error.Abort('manifest revision must be integer or full ' + 'node') def d(): repo.manifestlog.clearcaches(clear_persisted_data=clear_disk) repo.manifestlog[t].read() diff -r eb9b8679c852 -r c03c5f528e9b tests/test-contrib-perf.t --- a/tests/test-contrib-perf.t Mon Aug 27 08:52:33 2018 -0700 +++ b/tests/test-contrib-perf.t Wed Aug 15 19:45:39 2018 +0000 @@ -166,6 +166,10 @@ $ hg perflookup 2 $ hg perflrucache $ hg perfmanifest 2 + $ hg perfmanifest -m 44fe2c8352bb3a478ffd7d8350bbc721920134d1 + $ hg perfmanifest -m 44fe2c8352bb + abort: manifest revision must be integer or full node + [255] $ hg perfmergecalculate -r 3 $ hg perfmoonwalk $ hg perfnodelookup 2