##// END OF EJS Templates
debugdiscovery: move various computation earlier...
marmoute -
r46678:44a52048 default
parent child Browse files
Show More
@@ -1017,27 +1017,35 b' def debugdiscovery(ui, repo, remoteurl=b'
1017 common, hds = doit(localrevs, remoterevs)
1017 common, hds = doit(localrevs, remoterevs)
1018
1018
1019 # compute all statistics
1019 # compute all statistics
1020 common = set(common)
1020 heads_common = set(common)
1021 rheads = set(hds)
1021 heads_remote = set(hds)
1022 lheads = set(repo.heads())
1022 heads_local = set(repo.heads())
1023 # note: they cannot be a local or remote head that is in common and not
1024 # itself a head of common.
1025 heads_common_local = heads_common & heads_local
1026 heads_common_remote = heads_common & heads_remote
1027 heads_common_both = heads_common & heads_remote & heads_local
1028
1029 all = repo.revs(b'all()')
1030 common = repo.revs(b'::%ln', common)
1031 missing = repo.revs(b'not ::%ld', common)
1032 assert len(common) + len(missing) == len(all)
1023
1033
1024 data = {}
1034 data = {}
1025 data[b'elapsed'] = t.elapsed
1035 data[b'elapsed'] = t.elapsed
1026 data[b'nb-common-heads'] = len(common)
1036 data[b'nb-common-heads'] = len(heads_common)
1027 data[b'nb-common-heads-local'] = len(common & lheads)
1037 data[b'nb-common-heads-local'] = len(heads_common_local)
1028 data[b'nb-common-heads-remote'] = len(common & rheads)
1038 data[b'nb-common-heads-remote'] = len(heads_common_remote)
1029 data[b'nb-common-heads-both'] = len(common & rheads & lheads)
1039 data[b'nb-common-heads-both'] = len(heads_common_both)
1030 data[b'nb-head-local'] = len(lheads)
1040 data[b'nb-head-local'] = len(heads_local)
1031 data[b'nb-head-local-missing'] = (
1041 data[b'nb-head-local-missing'] = len(heads_local) - len(heads_common_local)
1032 data[b'nb-head-local'] - data[b'nb-common-heads-local']
1042 data[b'nb-head-remote'] = len(heads_remote)
1043 data[b'nb-head-remote-unknown'] = len(heads_remote) - len(
1044 heads_common_remote
1033 )
1045 )
1034 data[b'nb-head-remote'] = len(rheads)
1046 data[b'nb-revs'] = len(all)
1035 data[b'nb-head-remote-unknown'] = (
1047 data[b'nb-revs-common'] = len(common)
1036 data[b'nb-head-remote'] - data[b'nb-common-heads-remote']
1048 data[b'nb-revs-missing'] = len(missing)
1037 )
1038 data[b'nb-revs'] = len(repo.revs(b'all()'))
1039 data[b'nb-revs-common'] = len(repo.revs(b'::%ln', common))
1040 data[b'nb-revs-missing'] = data[b'nb-revs'] - data[b'nb-revs-common']
1041
1049
1042 # display discovery summary
1050 # display discovery summary
1043 ui.writenoi18n(b"elapsed time: %(elapsed)f seconds\n" % data)
1051 ui.writenoi18n(b"elapsed time: %(elapsed)f seconds\n" % data)
@@ -1070,7 +1078,8 b' def debugdiscovery(ui, repo, remoteurl=b'
1070
1078
1071 if ui.verbose:
1079 if ui.verbose:
1072 ui.writenoi18n(
1080 ui.writenoi18n(
1073 b"common heads: %s\n" % b" ".join(sorted(short(n) for n in common))
1081 b"common heads: %s\n"
1082 % b" ".join(sorted(short(n) for n in heads_common))
1074 )
1083 )
1075
1084
1076
1085
General Comments 0
You need to be logged in to leave comments. Login now