pullbundle: add some information on the cached change
This also adds a way to skip "caching" smaller range in the debugcommand (not in
the extensions itself).
--- a/hgext3rd/pullbundle.py Tue Sep 25 18:41:51 2018 +0200
+++ b/hgext3rd/pullbundle.py Tue Sep 25 19:35:33 2018 +0200
@@ -448,6 +448,7 @@
@command('^debugpullbundlecacheoverlap',
[('', 'count', 100, _('of "client" pulling')),
+ ('', 'min-cache', 1, _('minimum size of cached bundle')),
],
_('hg debugpullbundlecacheoverlap [--client 100] REVSET'))
def debugpullbundlecacheoverlap(ui, repo, *revs, **opts):
@@ -461,6 +462,7 @@
if not revs:
raise error.Abort('No revision selected')
count = opts['count']
+ min_cache = opts['min_cache']
bundlehits = collections.defaultdict(lambda: 0)
pullstats = []
@@ -469,6 +471,8 @@
repo.ui.write("gathering %d sample pulls within %d revisions\n"
% (count, len(actionrevs)))
+ if 1 < min_cache:
+ repo.ui.write(" not caching ranges smaller than %d changesets\n" % min_cache)
for i in xrange(count):
repo.ui.progress('gathering data', i, total=count)
outgoing = takeonesample(repo, actionrevs)
@@ -476,17 +480,21 @@
hitranges = 0
hitchanges = 0
totalchanges = 0
+ largeranges = []
for rangeid, __ in ranges:
length = rlen(rangeid)
totalchanges += length
if bundlehits[rangeid]:
hitranges += 1
hitchanges += rlen(rangeid)
- bundlehits[rangeid] += 1
+ if min_cache <= length:
+ bundlehits[rangeid] += 1
+ largeranges.append(rangeid)
+
stats = (len(outgoing.missing),
totalchanges,
hitchanges,
- len(ranges),
+ len(largeranges),
hitranges,
)
pullstats.append(stats)
@@ -503,7 +511,10 @@
sizes.append(entry[0])
changesmissing.append(entry[1] - entry[2])
changesratio.append(entry[2] / float(entry[1]))
- rangesratio.append(entry[4] / float(entry[3]))
+ if entry[3]:
+ rangesratio.append(entry[4] / float(entry[3]))
+ else:
+ rangesratio.append(1)
bundlecount.append(entry[3])
totalchanges += entry[1]
totalcached += entry[2]
@@ -511,6 +522,8 @@
cachedsizes = []
cachedhits = []
for rangeid, hits in bundlehits.items():
+ if hits <= 0:
+ continue
length = rlen(rangeid)
cachedsizes.append(length)
cachedhits.append(hits)