# HG changeset patch # User Gregory Szorc # Date 1535385505 25200 # Node ID 862d23bc574981fd82333b71090743bff5a069d9 # Parent c03c5f528e9b542965dec35e3006da7c2ad91dae perf: add function for obtaining manifest revision This will use the modern API if available or fall back to the legacy direct revlog access case. Without this, the perf command won't work on all code bases. Differential Revision: https://phab.mercurial-scm.org/D4391 diff -r c03c5f528e9b -r 862d23bc5749 contrib/perf.py --- a/contrib/perf.py Wed Aug 15 19:45:39 2018 +0000 +++ b/contrib/perf.py Mon Aug 27 08:58:25 2018 -0700 @@ -1127,6 +1127,16 @@ with ready: ready.wait() +def _manifestrevision(repo, mnode): + ml = repo.manifestlog + + if util.safehasattr(ml, 'getstorage'): + store = ml.getstorage(b'') + else: + store = ml._revlog + + return store.revision(mnode) + @command('perfbdiff', revlogopts + formatteropts + [ ('', 'count', 1, 'number of revisions to test (when using --startrev)'), ('', 'alldata', False, 'test bdiffs for all associated revisions'), @@ -1172,9 +1182,9 @@ if opts['alldata']: # Load revisions associated with changeset. ctx = repo[rev] - mtext = repo.manifestlog._revlog.revision(ctx.manifestnode()) + mtext = _manifestrevision(repo, ctx.manifestnode()) for pctx in ctx.parents(): - pman = repo.manifestlog._revlog.revision(pctx.manifestnode()) + pman = _manifestrevision(repo, pctx.manifestnode()) textpairs.append((pman, mtext)) # Load filelog revisions by iterating manifest delta. @@ -1264,9 +1274,9 @@ if opts['alldata']: # Load revisions associated with changeset. ctx = repo[rev] - mtext = repo.manifestlog._revlog.revision(ctx.manifestnode()) + mtext = _manifestrevision(repo, ctx.manifestnode()) for pctx in ctx.parents(): - pman = repo.manifestlog._revlog.revision(pctx.manifestnode()) + pman = _manifestrevision(repo, pctx.manifestnode()) textpairs.append((pman, mtext)) # Load filelog revisions by iterating manifest delta.