Mercurial > hg
diff mercurial/debugcommands.py @ 42032:63165e4a76da
debugdiscovery: display more statistic about the common set
We display a lot more information now. Especially, we display the overlap
between the common heads and the local/remote heads. There are various
optimization geared toward heads, as a result, the less common the heads the
more complex the discovery. Having this information easily accessible help when
working on discovery.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 26 Mar 2019 17:25:22 +0100 |
parents | d31d8c5279c6 |
children | c3a16c282dd8 |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Tue Mar 26 14:04:33 2019 +0100 +++ b/mercurial/debugcommands.py Tue Mar 26 17:25:22 2019 +0100 @@ -817,9 +817,38 @@ localrevs = opts['rev'] common, hds = doit(localrevs, remoterevs) + # compute all statistics common = set(common) rheads = set(hds) lheads = set(repo.heads()) + + data = {} + data['nb-common'] = len(common) + data['nb-common-local'] = len(common & lheads) + data['nb-common-remote'] = len(common & rheads) + data['nb-local'] = len(lheads) + data['nb-local-missing'] = data['nb-local'] - data['nb-common-local'] + data['nb-remote'] = len(rheads) + data['nb-remote-unknown'] = data['nb-remote'] - data['nb-common-remote'] + data['nb-revs'] = len(repo.revs('all()')) + data['nb-revs-common'] = len(repo.revs('::%ln', common)) + data['nb-revs-missing'] = data['nb-revs'] - data['nb-revs-common'] + + # display discovery summary + ui.write(("heads summary:\n")) + ui.write((" total common heads: %(nb-common)9d\n") % data) + ui.write((" also local heads: %(nb-common-local)9d\n") % data) + ui.write((" also remote heads: %(nb-common-remote)9d\n") % data) + ui.write((" local heads: %(nb-local)9d\n") % data) + ui.write((" common: %(nb-common-local)9d\n") % data) + ui.write((" missing: %(nb-local-missing)9d\n") % data) + ui.write((" remote heads: %(nb-remote)9d\n") % data) + ui.write((" common: %(nb-common-remote)9d\n") % data) + ui.write((" unknown: %(nb-remote-unknown)9d\n") % data) + ui.write(("local changesets: %(nb-revs)9d\n") % data) + ui.write((" common: %(nb-revs-common)9d\n") % data) + ui.write((" missing: %(nb-revs-missing)9d\n") % data) + ui.write(("common heads: %s\n") % " ".join(sorted(short(n) for n in common))) if lheads <= common: