mercurial/debugcommands.py
changeset 46061 44a52048c6d6
parent 46060 24751551fe64
child 46075 3ca9d26c5984
equal deleted inserted replaced
46060:24751551fe64 46061:44a52048c6d6
  1015     localrevs = opts[b'rev']
  1015     localrevs = opts[b'rev']
  1016     with util.timedcm('debug-discovery') as t:
  1016     with util.timedcm('debug-discovery') as t:
  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)
  1033     )
  1043     data[b'nb-head-remote-unknown'] = len(heads_remote) - len(
  1034     data[b'nb-head-remote'] = len(rheads)
  1044         heads_common_remote
  1035     data[b'nb-head-remote-unknown'] = (
  1045     )
  1036         data[b'nb-head-remote'] - data[b'nb-common-heads-remote']
  1046     data[b'nb-revs'] = len(all)
  1037     )
  1047     data[b'nb-revs-common'] = len(common)
  1038     data[b'nb-revs'] = len(repo.revs(b'all()'))
  1048     data[b'nb-revs-missing'] = len(missing)
  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)
  1044     ui.writenoi18n(b"heads summary:\n")
  1052     ui.writenoi18n(b"heads summary:\n")
  1045     ui.writenoi18n(b"  total common heads:  %(nb-common-heads)9d\n" % data)
  1053     ui.writenoi18n(b"  total common heads:  %(nb-common-heads)9d\n" % data)
  1068     ui.writenoi18n(b"  common:              %(nb-revs-common)9d\n" % data)
  1076     ui.writenoi18n(b"  common:              %(nb-revs-common)9d\n" % data)
  1069     ui.writenoi18n(b"  missing:             %(nb-revs-missing)9d\n" % data)
  1077     ui.writenoi18n(b"  missing:             %(nb-revs-missing)9d\n" % data)
  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 
  1077 _chunksize = 4 << 10
  1086 _chunksize = 4 << 10
  1078 
  1087