##// END OF EJS Templates
shrink: use progress API
Benoit Boissinot -
r10440:b39b32c3 default
parent child Browse files
Show More
@@ -29,9 +29,10 b' def toposort(ui, rl):'
29 29 children = {}
30 30 root = []
31 31 # build children and roots
32 ui.write('reading %d revs ' % len(rl))
32 ui.status('reading revs\n')
33 33 try:
34 34 for i in rl:
35 ui.progress('reading', i, total=len(rl))
35 36 children[i] = []
36 37 parents = [p for p in rl.parentrevs(i) if p != node.nullrev]
37 38 # in case of duplicate parents
@@ -43,16 +44,13 b' def toposort(ui, rl):'
43 44
44 45 if len(parents) == 0:
45 46 root.append(i)
46
47 if i % 1000 == 0:
48 ui.write('.')
49 47 finally:
50 ui.write('\n')
48 ui.progress('reading', None, total=len(rl))
51 49
52 50 # XXX this is a reimplementation of the 'branchsort' topo sort
53 51 # algorithm in hgext.convert.convcmd... would be nice not to duplicate
54 52 # the algorithm
55 ui.write('sorting ...')
53 ui.status('sorting revs\n')
56 54 visit = root
57 55 ret = []
58 56 while visit:
@@ -69,16 +67,15 b' def toposort(ui, rl):'
69 67 if len(parents_unseen) == 0:
70 68 next.append(c)
71 69 visit = next + visit
72 ui.write('\n')
73 70 return ret
74 71
75 72 def writerevs(ui, r1, r2, order, tr):
76 73
77 ui.write('writing %d revs ' % len(order))
74 ui.status('writing revs\n')
75
78 76 count = [0]
79 77 def progress(*args):
80 if count[0] % 1000 == 0:
81 ui.write('.')
78 ui.progress('writing', count[0], total=len(order))
82 79 count[0] += 1
83 80
84 81 order = [r1.node(r) for r in order]
@@ -92,7 +89,7 b' def writerevs(ui, r1, r2, order, tr):'
92 89 chunkiter = changegroup.chunkiter(group)
93 90 r2.addgroup(chunkiter, unlookup, tr)
94 91 finally:
95 ui.write('\n')
92 ui.progress('writing', None, len(order))
96 93
97 94 def report(ui, olddatafn, newdatafn):
98 95 oldsize = float(os.stat(olddatafn).st_size)
General Comments 0
You need to be logged in to leave comments. Login now