author | Anton Shestakov <av6@dwimlabs.net> |
Thu, 19 Dec 2019 18:16:18 +0700 | |
changeset 5045 | c9b25b1d6a61 |
parent 4929 | bb2b4f6c99dc |
permissions | -rw-r--r-- |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
1 |
# Code dedicated to debug commands around evolution |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
2 |
# |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
3 |
# Copyright 2017 Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
4 |
# |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
5 |
# This software may be used and distributed according to the terms of the |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
6 |
# GNU General Public License version 2 or any later version. |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
7 |
|
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
8 |
# Status: Ready to Upstream |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
9 |
# |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
10 |
# * We could have the same code in core as `hg debugobsolete --stat`, |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
11 |
# * We probably want a way for the extension to hook in for extra data. |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
12 |
|
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
13 |
from mercurial import ( |
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
14 |
obsolete, |
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
15 |
node, |
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
16 |
) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
17 |
|
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
18 |
from mercurial.i18n import _ |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
19 |
|
4929
bb2b4f6c99dc
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4814
diff
changeset
|
20 |
from . import ( |
bb2b4f6c99dc
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4814
diff
changeset
|
21 |
compat, |
bb2b4f6c99dc
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4814
diff
changeset
|
22 |
exthelper, |
bb2b4f6c99dc
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4814
diff
changeset
|
23 |
) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
24 |
|
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
25 |
eh = exthelper.exthelper() |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
26 |
|
4715
12c8b24757f4
py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents:
2547
diff
changeset
|
27 |
@eh.command(b'debugobsstorestat', [], b'') |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
28 |
def cmddebugobsstorestat(ui, repo): |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
29 |
"""print statistics about obsolescence markers in the repo""" |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
30 |
def _updateclustermap(nodes, mark, clustersmap): |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
31 |
c = (set(nodes), set([mark])) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
32 |
toproceed = set(nodes) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
33 |
while toproceed: |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
34 |
n = toproceed.pop() |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
35 |
other = clustersmap.get(n) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
36 |
if (other is not None |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
37 |
and other is not c): |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
38 |
other[0].update(c[0]) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
39 |
other[1].update(c[1]) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
40 |
for on in c[0]: |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
41 |
if on in toproceed: |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
42 |
continue |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
43 |
clustersmap[on] = other |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
44 |
c = other |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
45 |
clustersmap[n] = c |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
46 |
|
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
47 |
store = repo.obsstore |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
48 |
unfi = repo.unfiltered() |
4929
bb2b4f6c99dc
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4814
diff
changeset
|
49 |
getrev = compat.getgetrev(unfi.changelog) |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
50 |
nbmarkers = len(store._all) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
51 |
ui.write(_(b'markers total: %9i\n') % nbmarkers) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
52 |
sucscount = [0, 0, 0, 0] |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
53 |
known = 0 |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
54 |
parentsdata = 0 |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
55 |
metakeys = {} |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
56 |
# node -> cluster mapping |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
57 |
# a cluster is a (set(nodes), set(markers)) tuple |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
58 |
clustersmap = {} |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
59 |
# same data using parent information |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
60 |
pclustersmap = {} |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
61 |
size_v0 = [] |
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
62 |
size_v1 = [] |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
63 |
for mark in store: |
4929
bb2b4f6c99dc
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4814
diff
changeset
|
64 |
if getrev(mark[0]) is not None: |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
65 |
known += 1 |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
66 |
nbsucs = len(mark[1]) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
67 |
sucscount[min(nbsucs, 3)] += 1 |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
68 |
meta = mark[3] |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
69 |
for key, value in meta: |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
70 |
metakeys.setdefault(key, 0) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
71 |
metakeys[key] += 1 |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
72 |
meta = dict(meta) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
73 |
parents = [meta.get(b'p1'), meta.get(b'p2')] |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
74 |
parents = [node.bin(p) for p in parents if p is not None] |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
75 |
if parents: |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
76 |
parentsdata += 1 |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
77 |
# cluster handling |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
78 |
nodes = set(mark[1]) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
79 |
nodes.add(mark[0]) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
80 |
_updateclustermap(nodes, mark, clustersmap) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
81 |
# same with parent data |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
82 |
nodes.update(parents) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
83 |
_updateclustermap(nodes, mark, pclustersmap) |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
84 |
size_v0.append(len(obsolete._fm0encodeonemarker(mark))) |
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
85 |
size_v1.append(len(obsolete._fm1encodeonemarker(mark))) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
86 |
|
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
87 |
# freezing the result |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
88 |
for c in clustersmap.values(): |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
89 |
fc = (frozenset(c[0]), frozenset(c[1])) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
90 |
for n in fc[0]: |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
91 |
clustersmap[n] = fc |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
92 |
# same with parent data |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
93 |
for c in pclustersmap.values(): |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
94 |
fc = (frozenset(c[0]), frozenset(c[1])) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
95 |
for n in fc[0]: |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
96 |
pclustersmap[n] = fc |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
97 |
numobs = len(unfi.revs(b'obsolete()')) |
2547
3c594000844b
debugobsstorestat: adds static about actually obsolete changeses
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2440
diff
changeset
|
98 |
numtotal = len(unfi) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
99 |
ui.write((b' for known precursors: %9i' % known)) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
100 |
ui.write((b' (%i/%i obsolete changesets)\n' % (numobs, numtotal))) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
101 |
ui.write((b' with parents data: %9i\n' % parentsdata)) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
102 |
# successors data |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
103 |
ui.write((b'markers with no successors: %9i\n' % sucscount[0])) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
104 |
ui.write((b' 1 successors: %9i\n' % sucscount[1])) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
105 |
ui.write((b' 2 successors: %9i\n' % sucscount[2])) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
106 |
ui.write((b' more than 2 successors: %9i\n' % sucscount[3])) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
107 |
# meta data info |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
108 |
ui.write((b' available keys:\n')) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
109 |
for key in sorted(metakeys): |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
110 |
ui.write((b' %15s: %9i\n' % (key, metakeys[key]))) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
111 |
|
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
112 |
size_v0.sort() |
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
113 |
size_v1.sort() |
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
114 |
if size_v0: |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
115 |
ui.write(b'marker size:\n') |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
116 |
# format v1 |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
117 |
ui.write(b' format v1:\n') |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
118 |
ui.write((b' smallest length: %9i\n' % size_v1[0])) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
119 |
ui.write((b' longer length: %9i\n' % size_v1[-1])) |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
120 |
median = size_v1[nbmarkers // 2] |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
121 |
ui.write((b' median length: %9i\n' % median)) |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
122 |
mean = sum(size_v1) // nbmarkers |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
123 |
ui.write((b' mean length: %9i\n' % mean)) |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
124 |
# format v0 |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
125 |
ui.write(b' format v0:\n') |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
126 |
ui.write((b' smallest length: %9i\n' % size_v0[0])) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
127 |
ui.write((b' longer length: %9i\n' % size_v0[-1])) |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
128 |
median = size_v0[nbmarkers // 2] |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
129 |
ui.write((b' median length: %9i\n' % median)) |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
130 |
mean = sum(size_v0) // nbmarkers |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
131 |
ui.write((b' mean length: %9i\n' % mean)) |
2440
0fa7971071b1
debugobsstorestat: add markers size information
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2123
diff
changeset
|
132 |
|
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
133 |
allclusters = list(set(clustersmap.values())) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
134 |
allclusters.sort(key=lambda x: len(x[1])) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
135 |
ui.write((b'disconnected clusters: %9i\n' % len(allclusters))) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
136 |
|
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
137 |
ui.write(b' any known node: %9i\n' |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
138 |
% len([c for c in allclusters |
4929
bb2b4f6c99dc
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4814
diff
changeset
|
139 |
if [n for n in c[0] if getrev(n) is not None]])) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
140 |
if allclusters: |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
141 |
nbcluster = len(allclusters) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
142 |
ui.write((b' smallest length: %9i\n' % len(allclusters[0][1]))) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
143 |
ui.write((b' longer length: %9i\n' |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
144 |
% len(allclusters[-1][1]))) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
145 |
median = len(allclusters[nbcluster // 2][1]) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
146 |
ui.write((b' median length: %9i\n' % median)) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
147 |
mean = sum(len(x[1]) for x in allclusters) // nbcluster |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
148 |
ui.write((b' mean length: %9i\n' % mean)) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
149 |
allpclusters = list(set(pclustersmap.values())) |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
150 |
allpclusters.sort(key=lambda x: len(x[1])) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
151 |
ui.write((b' using parents data: %9i\n' % len(allpclusters))) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
152 |
ui.write(b' any known node: %9i\n' |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
153 |
% len([c for c in allclusters |
4929
bb2b4f6c99dc
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4814
diff
changeset
|
154 |
if [n for n in c[0] if getrev(n) is not None]])) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
155 |
if allpclusters: |
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
156 |
nbcluster = len(allpclusters) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
157 |
ui.write((b' smallest length: %9i\n' |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
158 |
% len(allpclusters[0][1]))) |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
159 |
ui.write((b' longer length: %9i\n' |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
160 |
% len(allpclusters[-1][1]))) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
161 |
median = len(allpclusters[nbcluster // 2][1]) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
162 |
ui.write((b' median length: %9i\n' % median)) |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
163 |
mean = sum(len(x[1]) for x in allpclusters) // nbcluster |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4715
diff
changeset
|
164 |
ui.write((b' mean length: %9i\n' % mean)) |