[Updated] D9524: debugdiscovery: move various computation earlier
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Mon Dec 7 18:20:49 UTC 2020
Closed by commit rHG44a52048c6d6: debugdiscovery: move various computation earlier (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9524?vs=24077&id=24089
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9524/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9524
AFFECTED FILES
mercurial/debugcommands.py
CHANGE DETAILS
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1017,27 +1017,35 @@
common, hds = doit(localrevs, remoterevs)
# compute all statistics
- common = set(common)
- rheads = set(hds)
- lheads = set(repo.heads())
+ heads_common = set(common)
+ heads_remote = set(hds)
+ heads_local = set(repo.heads())
+ # note: they cannot be a local or remote head that is in common and not
+ # itself a head of common.
+ heads_common_local = heads_common & heads_local
+ heads_common_remote = heads_common & heads_remote
+ heads_common_both = heads_common & heads_remote & heads_local
+
+ all = repo.revs(b'all()')
+ common = repo.revs(b'::%ln', common)
+ missing = repo.revs(b'not ::%ld', common)
+ assert len(common) + len(missing) == len(all)
data = {}
data[b'elapsed'] = t.elapsed
- data[b'nb-common-heads'] = len(common)
- data[b'nb-common-heads-local'] = len(common & lheads)
- data[b'nb-common-heads-remote'] = len(common & rheads)
- data[b'nb-common-heads-both'] = len(common & rheads & lheads)
- data[b'nb-head-local'] = len(lheads)
- data[b'nb-head-local-missing'] = (
- data[b'nb-head-local'] - data[b'nb-common-heads-local']
+ data[b'nb-common-heads'] = len(heads_common)
+ data[b'nb-common-heads-local'] = len(heads_common_local)
+ data[b'nb-common-heads-remote'] = len(heads_common_remote)
+ data[b'nb-common-heads-both'] = len(heads_common_both)
+ data[b'nb-head-local'] = len(heads_local)
+ data[b'nb-head-local-missing'] = len(heads_local) - len(heads_common_local)
+ data[b'nb-head-remote'] = len(heads_remote)
+ data[b'nb-head-remote-unknown'] = len(heads_remote) - len(
+ heads_common_remote
)
- data[b'nb-head-remote'] = len(rheads)
- data[b'nb-head-remote-unknown'] = (
- data[b'nb-head-remote'] - data[b'nb-common-heads-remote']
- )
- data[b'nb-revs'] = len(repo.revs(b'all()'))
- data[b'nb-revs-common'] = len(repo.revs(b'::%ln', common))
- data[b'nb-revs-missing'] = data[b'nb-revs'] - data[b'nb-revs-common']
+ data[b'nb-revs'] = len(all)
+ data[b'nb-revs-common'] = len(common)
+ data[b'nb-revs-missing'] = len(missing)
# display discovery summary
ui.writenoi18n(b"elapsed time: %(elapsed)f seconds\n" % data)
@@ -1070,7 +1078,8 @@
if ui.verbose:
ui.writenoi18n(
- b"common heads: %s\n" % b" ".join(sorted(short(n) for n in common))
+ b"common heads: %s\n"
+ % b" ".join(sorted(short(n) for n in heads_common))
)
To: marmoute, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201207/31cbddc0/attachment-0002.html>
More information about the Mercurial-patches
mailing list