Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 46111:d90f439ff19f
debugdiscovery: display the number of roundtrip used
This is a good metric of the complexity of a discovery process.
Differential Revision: https://phab.mercurial-scm.org/D9565
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 11 Dec 2020 12:51:09 +0100 |
parents | 0e5065b6baa0 |
children | 9e24b3d8e896 |
comparison
equal
deleted
inserted
replaced
46110:2f357d053df2 | 46111:d90f439ff19f |
---|---|
976 ui.status(_(b'comparing with %s\n') % util.hidepassword(remoteurl)) | 976 ui.status(_(b'comparing with %s\n') % util.hidepassword(remoteurl)) |
977 | 977 |
978 # make sure tests are repeatable | 978 # make sure tests are repeatable |
979 random.seed(int(opts[b'seed'])) | 979 random.seed(int(opts[b'seed'])) |
980 | 980 |
981 data = {} | |
981 if opts.get(b'old'): | 982 if opts.get(b'old'): |
982 | 983 |
983 def doit(pushedrevs, remoteheads, remote=remote): | 984 def doit(pushedrevs, remoteheads, remote=remote): |
984 if not util.safehasattr(remote, b'branches'): | 985 if not util.safehasattr(remote, b'branches'): |
985 # enable in-client legacy support | 986 # enable in-client legacy support |
986 remote = localrepo.locallegacypeer(remote.local()) | 987 remote = localrepo.locallegacypeer(remote.local()) |
987 common, _in, hds = treediscovery.findcommonincoming( | 988 common, _in, hds = treediscovery.findcommonincoming( |
988 repo, remote, force=True | 989 repo, remote, force=True, audit=data |
989 ) | 990 ) |
990 common = set(common) | 991 common = set(common) |
991 if not opts.get(b'nonheads'): | 992 if not opts.get(b'nonheads'): |
992 ui.writenoi18n( | 993 ui.writenoi18n( |
993 b"unpruned common: %s\n" | 994 b"unpruned common: %s\n" |
1005 nodes = None | 1006 nodes = None |
1006 if pushedrevs: | 1007 if pushedrevs: |
1007 revs = scmutil.revrange(repo, pushedrevs) | 1008 revs = scmutil.revrange(repo, pushedrevs) |
1008 nodes = [repo[r].node() for r in revs] | 1009 nodes = [repo[r].node() for r in revs] |
1009 common, any, hds = setdiscovery.findcommonheads( | 1010 common, any, hds = setdiscovery.findcommonheads( |
1010 ui, repo, remote, ancestorsof=nodes | 1011 ui, repo, remote, ancestorsof=nodes, audit=data |
1011 ) | 1012 ) |
1012 return common, hds | 1013 return common, hds |
1013 | 1014 |
1014 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None) | 1015 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None) |
1015 localrevs = opts[b'rev'] | 1016 localrevs = opts[b'rev'] |
1040 heads_initial_undecided = repo.revs(b'heads(%ld)', initial_undecided) | 1041 heads_initial_undecided = repo.revs(b'heads(%ld)', initial_undecided) |
1041 roots_initial_undecided = repo.revs(b'roots(%ld)', initial_undecided) | 1042 roots_initial_undecided = repo.revs(b'roots(%ld)', initial_undecided) |
1042 common_initial_undecided = initial_undecided & common | 1043 common_initial_undecided = initial_undecided & common |
1043 missing_initial_undecided = initial_undecided & missing | 1044 missing_initial_undecided = initial_undecided & missing |
1044 | 1045 |
1045 data = {} | |
1046 data[b'elapsed'] = t.elapsed | 1046 data[b'elapsed'] = t.elapsed |
1047 data[b'nb-common-heads'] = len(heads_common) | 1047 data[b'nb-common-heads'] = len(heads_common) |
1048 data[b'nb-common-heads-local'] = len(heads_common_local) | 1048 data[b'nb-common-heads-local'] = len(heads_common_local) |
1049 data[b'nb-common-heads-remote'] = len(heads_common_remote) | 1049 data[b'nb-common-heads-remote'] = len(heads_common_remote) |
1050 data[b'nb-common-heads-both'] = len(heads_common_both) | 1050 data[b'nb-common-heads-both'] = len(heads_common_both) |
1066 data[b'nb-ini_und-common'] = len(common_initial_undecided) | 1066 data[b'nb-ini_und-common'] = len(common_initial_undecided) |
1067 data[b'nb-ini_und-missing'] = len(missing_initial_undecided) | 1067 data[b'nb-ini_und-missing'] = len(missing_initial_undecided) |
1068 | 1068 |
1069 # display discovery summary | 1069 # display discovery summary |
1070 ui.writenoi18n(b"elapsed time: %(elapsed)f seconds\n" % data) | 1070 ui.writenoi18n(b"elapsed time: %(elapsed)f seconds\n" % data) |
1071 ui.writenoi18n(b"round-trips: %(total-roundtrips)9d\n" % data) | |
1071 ui.writenoi18n(b"heads summary:\n") | 1072 ui.writenoi18n(b"heads summary:\n") |
1072 ui.writenoi18n(b" total common heads: %(nb-common-heads)9d\n" % data) | 1073 ui.writenoi18n(b" total common heads: %(nb-common-heads)9d\n" % data) |
1073 ui.writenoi18n( | 1074 ui.writenoi18n( |
1074 b" also local heads: %(nb-common-heads-local)9d\n" % data | 1075 b" also local heads: %(nb-common-heads-local)9d\n" % data |
1075 ) | 1076 ) |