# HG changeset patch # User Gregory Szorc # Date 2018-08-15 19:45:39 # 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 --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -861,7 +861,21 @@ def perfmanifest(ui, repo, rev, manifest 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 --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t --- a/tests/test-contrib-perf.t +++ b/tests/test-contrib-perf.t @@ -166,6 +166,10 @@ perfstatus $ 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