Mercurial > public > mercurial-scm > evolve
diff hgext/evolve.py @ 807:4dd1cda16fd0
evolve: add a debugobsstorestat command
This commands print multiple some data about the content of the obsstore. This
will be usefull to provide some metric and insight for obsolescence marker
exchange.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 20 Feb 2014 13:59:49 -0800 |
parents | 895fadf6ba3e |
children | 81a3d9a24e6b |
line wrap: on
line diff
--- a/hgext/evolve.py Wed Feb 19 17:27:45 2014 -0800 +++ b/hgext/evolve.py Thu Feb 20 13:59:49 2014 -0800 @@ -860,6 +860,41 @@ _('record the specified user in metadata'), _('USER')), ] +@command('debugobsstorestat', [], '') +def cmddebugobsstorestat(ui, repo): + """print statistic about obsolescence markers in the repo""" + store = repo.obsstore + unfi = repo.unfiltered() + nm = unfi.changelog.nodemap + ui.write('markers total: %9i\n' % len(store._all)) + sucscount = [0, 0 , 0, 0] + known = 0 + metatotallenght = 0 + metakeys = {} + for mark in store: + if mark[0] in nm: + known += 1 + nbsucs = len(mark[1]) + sucscount[min(nbsucs, 3)] += 1 + metatotallenght += len(mark[3]) + meta = obsolete.decodemeta(mark[3]) + for key in meta: + metakeys.setdefault(key, 0) + metakeys[key] += 1 + + ui.write(' for known precursors: %9i\n' % known) + # successors data + ui.write('markers with no successors: %9i\n' % sucscount[0]) + ui.write(' 1 successors: %9i\n' % sucscount[1]) + ui.write(' 2 successors: %9i\n' % sucscount[2]) + ui.write(' more than 2 successors: %9i\n' % sucscount[3]) + # meta data info + ui.write('average meta length: %9i\n' + % (metatotallenght/len(store._all))) + ui.write(' available keys:\n') + for key in sorted(metakeys): + ui.write(' %15s: %9i\n' % (key, metakeys[key])) + @command('^evolve|stabilize|solve', [('n', 'dry-run', False, 'do not perform actions, print what to be done'),