Mercurial > hg > evolve
changeset 2536:0fa7971071b1
debugobsstorestat: add markers size information
We adds some extra information about markers size in all known format.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 19 May 2017 11:16:22 +0200 |
parents | f7d67b6ee44f |
children | 80b5fc054219 |
files | hgext3rd/evolve/debugcmd.py tests/test-evolve.t tests/test-prune.t |
diffstat | 3 files changed, 53 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/debugcmd.py +++ b/hgext3rd/evolve/debugcmd.py @@ -10,7 +10,10 @@ # * We could have the same code in core as `hg debugobsolete --stat`, # * We probably want a way for the extension to hook in for extra data. -from mercurial import node +from mercurial import ( + obsolete, + node, +) from mercurial.i18n import _ @@ -41,7 +44,8 @@ store = repo.obsstore unfi = repo.unfiltered() nm = unfi.changelog.nodemap - ui.write(_('markers total: %9i\n') % len(store._all)) + nbmarkers = len(store._all) + ui.write(_('markers total: %9i\n') % nbmarkers) sucscount = [0, 0, 0, 0] known = 0 parentsdata = 0 @@ -51,6 +55,8 @@ clustersmap = {} # same data using parent information pclustersmap = {} + size_v0 = [] + size_v1 = [] for mark in store: if mark[0] in nm: known += 1 @@ -72,6 +78,8 @@ # same with parent data nodes.update(parents) _updateclustermap(nodes, mark, pclustersmap) + size_v0.append(len(obsolete._fm0encodeonemarker(mark))) + size_v1.append(len(obsolete._fm1encodeonemarker(mark))) # freezing the result for c in clustersmap.values(): @@ -95,6 +103,27 @@ for key in sorted(metakeys): ui.write((' %15s: %9i\n' % (key, metakeys[key]))) + size_v0.sort() + size_v1.sort() + if size_v0: + ui.write('marker size:\n') + # format v1 + ui.write(' format v1:\n') + ui.write((' smallest length: %9i\n' % size_v1[0])) + ui.write((' longer length: %9i\n' % size_v1[-1])) + median = size_v1[nbmarkers // 2] + ui.write((' median length: %9i\n' % median)) + mean = sum(size_v1) // nbmarkers + ui.write((' mean length: %9i\n' % mean)) + # format v0 + ui.write(' format v0:\n') + ui.write((' smallest length: %9i\n' % size_v0[0])) + ui.write((' longer length: %9i\n' % size_v0[-1])) + median = size_v0[nbmarkers // 2] + ui.write((' median length: %9i\n' % median)) + mean = sum(size_v0) // nbmarkers + ui.write((' mean length: %9i\n' % mean)) + allclusters = list(set(clustersmap.values())) allclusters.sort(key=lambda x: len(x[1])) ui.write(('disconnected clusters: %9i\n' % len(allclusters)))
--- a/tests/test-evolve.t +++ b/tests/test-evolve.t @@ -793,6 +793,17 @@ more than 2 successors: 0 available keys: user: 10 + marker size: + format v1: + smallest length: 69 + longer length: 69 + median length: 69 + mean length: 69 + format v0: + smallest length: * (glob) + longer length: * (glob) + median length: * (glob) + mean length: * (glob) disconnected clusters: 1 any known node: 1 smallest length: 10
--- a/tests/test-prune.t +++ b/tests/test-prune.t @@ -352,6 +352,17 @@ more than 2 successors: 0 available keys: user: 7 + marker size: + format v1: + smallest length: 69 + longer length: 69 + median length: 69 + mean length: 69 + format v0: + smallest length: * (glob) + longer length: * (glob) + median length: * (glob) + mean length: * (glob) disconnected clusters: 7 any known node: 7 smallest length: 1