Mercurial > public > mercurial-scm > hg
comparison contrib/perf.py @ 42382:f0bcbbb6541c
perf: allow to specify the base of the merge in perfmergecalculate
We can now test the rebase case.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 23 May 2019 13:49:31 +0200 |
parents | e3ee707d42ad |
children | 3a3592b40a95 |
comparison
equal
deleted
inserted
replaced
42381:e3ee707d42ad | 42382:f0bcbbb6541c |
---|---|
965 | 965 |
966 @command(b'perfmergecalculate', | 966 @command(b'perfmergecalculate', |
967 [ | 967 [ |
968 (b'r', b'rev', b'.', b'rev to merge against'), | 968 (b'r', b'rev', b'.', b'rev to merge against'), |
969 (b'', b'from', b'', b'rev to merge from'), | 969 (b'', b'from', b'', b'rev to merge from'), |
970 (b'', b'base', b'', b'the revision to use as base'), | |
970 ] + formatteropts) | 971 ] + formatteropts) |
971 def perfmergecalculate(ui, repo, rev, **opts): | 972 def perfmergecalculate(ui, repo, rev, **opts): |
972 opts = _byteskwargs(opts) | 973 opts = _byteskwargs(opts) |
973 timer, fm = gettimer(ui, opts) | 974 timer, fm = gettimer(ui, opts) |
974 | 975 |
979 wctx = repo[None] | 980 wctx = repo[None] |
980 # we don't want working dir files to be stat'd in the benchmark, so | 981 # we don't want working dir files to be stat'd in the benchmark, so |
981 # prime that cache | 982 # prime that cache |
982 wctx.dirty() | 983 wctx.dirty() |
983 rctx = scmutil.revsingle(repo, rev, rev) | 984 rctx = scmutil.revsingle(repo, rev, rev) |
984 ancestor = wctx.ancestor(rctx) | 985 if opts['base']: |
986 fromrev = scmutil.revsingle(repo, opts['base']) | |
987 ancestor = repo[fromrev] | |
988 else: | |
989 ancestor = wctx.ancestor(rctx) | |
990 def d(): | |
991 # acceptremote is True because we don't want prompts in the middle of | |
992 # our benchmark | |
993 merge.calculateupdates(repo, wctx, rctx, [ancestor], False, False, | |
994 acceptremote=True, followcopies=True) | |
995 timer(d) | |
996 fm.end() | |
985 def d(): | 997 def d(): |
986 # acceptremote is True because we don't want prompts in the middle of | 998 # acceptremote is True because we don't want prompts in the middle of |
987 # our benchmark | 999 # our benchmark |
988 merge.calculateupdates(repo, wctx, rctx, [ancestor], False, False, | 1000 merge.calculateupdates(repo, wctx, rctx, [ancestor], False, False, |
989 acceptremote=True, followcopies=True) | 1001 acceptremote=True, followcopies=True) |