Skip to content
Snippets Groups Projects
Commit 1ee14abe authored by Greg Ward's avatar Greg Ward
Browse files

shrink-revlog: instrument sort code to record statistics.

Notably, count "suboptimal" nodes (predecessor is not first parent)
and (with -v) report them at the end of the run.
parent bcdf3768
No related branches found
No related tags found
No related merge requests found
......@@ -53,5 +53,9 @@
ui.status(_('sorting revs\n'))
visit = root
ret = []
# suboptimal: nodes whose predecessor is not first parent
suboptimal = 0
while visit:
i = visit.pop(0)
......@@ -56,5 +60,12 @@
while visit:
i = visit.pop(0)
# revlog will compute delta relative to ret[-1], so keep track
# of nodes where this might result in a large delta
parents = rl.parentrevs(i)
if ret:
if ret[-1] != parents[0]:
suboptimal += 1
ret.append(i)
if i not in children:
# This only happens if some node's p1 == p2, which can
......@@ -67,6 +78,7 @@
if len(parents_unseen) == 0:
next.append(c)
visit = next + visit
ui.note(_('%d suboptimal nodes\n') % suboptimal)
return ret
def writerevs(ui, r1, r2, order, tr):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment