comparison 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
comparison
equal deleted inserted replaced
42031:d31d8c5279c6 42032:63165e4a76da
815 815
816 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None) 816 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
817 localrevs = opts['rev'] 817 localrevs = opts['rev']
818 common, hds = doit(localrevs, remoterevs) 818 common, hds = doit(localrevs, remoterevs)
819 819
820 # compute all statistics
820 common = set(common) 821 common = set(common)
821 rheads = set(hds) 822 rheads = set(hds)
822 lheads = set(repo.heads()) 823 lheads = set(repo.heads())
824
825 data = {}
826 data['nb-common'] = len(common)
827 data['nb-common-local'] = len(common & lheads)
828 data['nb-common-remote'] = len(common & rheads)
829 data['nb-local'] = len(lheads)
830 data['nb-local-missing'] = data['nb-local'] - data['nb-common-local']
831 data['nb-remote'] = len(rheads)
832 data['nb-remote-unknown'] = data['nb-remote'] - data['nb-common-remote']
833 data['nb-revs'] = len(repo.revs('all()'))
834 data['nb-revs-common'] = len(repo.revs('::%ln', common))
835 data['nb-revs-missing'] = data['nb-revs'] - data['nb-revs-common']
836
837 # display discovery summary
838 ui.write(("heads summary:\n"))
839 ui.write((" total common heads: %(nb-common)9d\n") % data)
840 ui.write((" also local heads: %(nb-common-local)9d\n") % data)
841 ui.write((" also remote heads: %(nb-common-remote)9d\n") % data)
842 ui.write((" local heads: %(nb-local)9d\n") % data)
843 ui.write((" common: %(nb-common-local)9d\n") % data)
844 ui.write((" missing: %(nb-local-missing)9d\n") % data)
845 ui.write((" remote heads: %(nb-remote)9d\n") % data)
846 ui.write((" common: %(nb-common-remote)9d\n") % data)
847 ui.write((" unknown: %(nb-remote-unknown)9d\n") % data)
848 ui.write(("local changesets: %(nb-revs)9d\n") % data)
849 ui.write((" common: %(nb-revs-common)9d\n") % data)
850 ui.write((" missing: %(nb-revs-missing)9d\n") % data)
851
823 ui.write(("common heads: %s\n") % 852 ui.write(("common heads: %s\n") %
824 " ".join(sorted(short(n) for n in common))) 853 " ".join(sorted(short(n) for n in common)))
825 if lheads <= common: 854 if lheads <= common:
826 ui.write(("local is subset\n")) 855 ui.write(("local is subset\n"))
827 elif rheads <= common: 856 elif rheads <= common: