comparison mercurial/debugcommands.py @ 46079:3ca9d26c5984

debugdiscovery: add some data about the shapes of the sets We display the number of heads and roots or the common and missing set. Differential Revision: https://phab.mercurial-scm.org/D9529
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 06 Dec 2020 06:19:15 +0100
parents 44a52048c6d6
children 0e5065b6baa0
comparison
equal deleted inserted replaced
46078:31ecf715efe2 46079:3ca9d26c5984
1026 heads_common_remote = heads_common & heads_remote 1026 heads_common_remote = heads_common & heads_remote
1027 heads_common_both = heads_common & heads_remote & heads_local 1027 heads_common_both = heads_common & heads_remote & heads_local
1028 1028
1029 all = repo.revs(b'all()') 1029 all = repo.revs(b'all()')
1030 common = repo.revs(b'::%ln', common) 1030 common = repo.revs(b'::%ln', common)
1031 roots_common = repo.revs(b'roots(::%ld)', common)
1031 missing = repo.revs(b'not ::%ld', common) 1032 missing = repo.revs(b'not ::%ld', common)
1033 heads_missing = repo.revs(b'heads(%ld)', missing)
1034 roots_missing = repo.revs(b'roots(%ld)', missing)
1032 assert len(common) + len(missing) == len(all) 1035 assert len(common) + len(missing) == len(all)
1033 1036
1034 data = {} 1037 data = {}
1035 data[b'elapsed'] = t.elapsed 1038 data[b'elapsed'] = t.elapsed
1036 data[b'nb-common-heads'] = len(heads_common) 1039 data[b'nb-common-heads'] = len(heads_common)
1037 data[b'nb-common-heads-local'] = len(heads_common_local) 1040 data[b'nb-common-heads-local'] = len(heads_common_local)
1038 data[b'nb-common-heads-remote'] = len(heads_common_remote) 1041 data[b'nb-common-heads-remote'] = len(heads_common_remote)
1039 data[b'nb-common-heads-both'] = len(heads_common_both) 1042 data[b'nb-common-heads-both'] = len(heads_common_both)
1043 data[b'nb-common-roots'] = len(roots_common)
1040 data[b'nb-head-local'] = len(heads_local) 1044 data[b'nb-head-local'] = len(heads_local)
1041 data[b'nb-head-local-missing'] = len(heads_local) - len(heads_common_local) 1045 data[b'nb-head-local-missing'] = len(heads_local) - len(heads_common_local)
1042 data[b'nb-head-remote'] = len(heads_remote) 1046 data[b'nb-head-remote'] = len(heads_remote)
1043 data[b'nb-head-remote-unknown'] = len(heads_remote) - len( 1047 data[b'nb-head-remote-unknown'] = len(heads_remote) - len(
1044 heads_common_remote 1048 heads_common_remote
1045 ) 1049 )
1046 data[b'nb-revs'] = len(all) 1050 data[b'nb-revs'] = len(all)
1047 data[b'nb-revs-common'] = len(common) 1051 data[b'nb-revs-common'] = len(common)
1048 data[b'nb-revs-missing'] = len(missing) 1052 data[b'nb-revs-missing'] = len(missing)
1053 data[b'nb-missing-heads'] = len(roots_missing)
1054 data[b'nb-missing-roots'] = len(heads_missing)
1049 1055
1050 # display discovery summary 1056 # display discovery summary
1051 ui.writenoi18n(b"elapsed time: %(elapsed)f seconds\n" % data) 1057 ui.writenoi18n(b"elapsed time: %(elapsed)f seconds\n" % data)
1052 ui.writenoi18n(b"heads summary:\n") 1058 ui.writenoi18n(b"heads summary:\n")
1053 ui.writenoi18n(b" total common heads: %(nb-common-heads)9d\n" % data) 1059 ui.writenoi18n(b" total common heads: %(nb-common-heads)9d\n" % data)
1072 ui.writenoi18n( 1078 ui.writenoi18n(
1073 b" unknown: %(nb-head-remote-unknown)9d\n" % data 1079 b" unknown: %(nb-head-remote-unknown)9d\n" % data
1074 ) 1080 )
1075 ui.writenoi18n(b"local changesets: %(nb-revs)9d\n" % data) 1081 ui.writenoi18n(b"local changesets: %(nb-revs)9d\n" % data)
1076 ui.writenoi18n(b" common: %(nb-revs-common)9d\n" % data) 1082 ui.writenoi18n(b" common: %(nb-revs-common)9d\n" % data)
1083 ui.writenoi18n(b" heads: %(nb-common-heads)9d\n" % data)
1084 ui.writenoi18n(b" roots: %(nb-common-roots)9d\n" % data)
1077 ui.writenoi18n(b" missing: %(nb-revs-missing)9d\n" % data) 1085 ui.writenoi18n(b" missing: %(nb-revs-missing)9d\n" % data)
1086 ui.writenoi18n(b" heads: %(nb-missing-heads)9d\n" % data)
1087 ui.writenoi18n(b" roots: %(nb-missing-roots)9d\n" % data)
1078 1088
1079 if ui.verbose: 1089 if ui.verbose:
1080 ui.writenoi18n( 1090 ui.writenoi18n(
1081 b"common heads: %s\n" 1091 b"common heads: %s\n"
1082 % b" ".join(sorted(short(n) for n in heads_common)) 1092 % b" ".join(sorted(short(n) for n in heads_common))