##// END OF EJS Templates
relink: use progress helper...
Martin von Zweigbergk -
r38423:39871606 default
parent child Browse files
Show More
@@ -94,6 +94,7 b' def collect(src, ui):'
94 # mozilla-central as of 2010-06-10 had a ratio of just over 7:5.
94 # mozilla-central as of 2010-06-10 had a ratio of just over 7:5.
95 total = live * 3 // 2
95 total = live * 3 // 2
96 src = src.store.path
96 src = src.store.path
97 progress = ui.makeprogress(_('collecting'), unit=_('files'), total=total)
97 pos = 0
98 pos = 0
98 ui.status(_("tip has %d files, estimated total number of files: %d\n")
99 ui.status(_("tip has %d files, estimated total number of files: %d\n")
99 % (live, total))
100 % (live, total))
@@ -108,9 +109,9 b' def collect(src, ui):'
108 continue
109 continue
109 pos += 1
110 pos += 1
110 candidates.append((os.path.join(relpath, filename), st))
111 candidates.append((os.path.join(relpath, filename), st))
111 ui.progress(_('collecting'), pos, filename, _('files'), total)
112 progress.update(pos, item=filename)
112
113
113 ui.progress(_('collecting'), None)
114 progress.complete()
114 ui.status(_('collected %d candidate storage files\n') % len(candidates))
115 ui.status(_('collected %d candidate storage files\n') % len(candidates))
115 return candidates
116 return candidates
116
117
@@ -132,7 +133,8 b' def prune(candidates, src, dst, ui):'
132 return st
133 return st
133
134
134 targets = []
135 targets = []
135 total = len(candidates)
136 progress = ui.makeprogress(_('pruning'), unit=_('files'),
137 total=len(candidates))
136 pos = 0
138 pos = 0
137 for fn, st in candidates:
139 for fn, st in candidates:
138 pos += 1
140 pos += 1
@@ -143,9 +145,9 b' def prune(candidates, src, dst, ui):'
143 ui.debug('not linkable: %s\n' % fn)
145 ui.debug('not linkable: %s\n' % fn)
144 continue
146 continue
145 targets.append((fn, ts.st_size))
147 targets.append((fn, ts.st_size))
146 ui.progress(_('pruning'), pos, fn, _('files'), total)
148 progress.update(pos, item=fn)
147
149
148 ui.progress(_('pruning'), None)
150 progress.complete()
149 ui.status(_('pruned down to %d probably relinkable files\n') % len(targets))
151 ui.status(_('pruned down to %d probably relinkable files\n') % len(targets))
150 return targets
152 return targets
151
153
@@ -164,8 +166,9 b' def do_relink(src, dst, files, ui):'
164 relinked = 0
166 relinked = 0
165 savedbytes = 0
167 savedbytes = 0
166
168
169 progress = ui.makeprogress(_('relinking'), unit=_('files'),
170 total=len(files))
167 pos = 0
171 pos = 0
168 total = len(files)
169 for f, sz in files:
172 for f, sz in files:
170 pos += 1
173 pos += 1
171 source = os.path.join(src, f)
174 source = os.path.join(src, f)
@@ -186,13 +189,13 b' def do_relink(src, dst, files, ui):'
186 continue
189 continue
187 try:
190 try:
188 relinkfile(source, tgt)
191 relinkfile(source, tgt)
189 ui.progress(_('relinking'), pos, f, _('files'), total)
192 progress.update(pos, item=f)
190 relinked += 1
193 relinked += 1
191 savedbytes += sz
194 savedbytes += sz
192 except OSError as inst:
195 except OSError as inst:
193 ui.warn('%s: %s\n' % (tgt, stringutil.forcebytestr(inst)))
196 ui.warn('%s: %s\n' % (tgt, stringutil.forcebytestr(inst)))
194
197
195 ui.progress(_('relinking'), None)
198 progress.complete()
196
199
197 ui.status(_('relinked %d files (%s reclaimed)\n') %
200 ui.status(_('relinked %d files (%s reclaimed)\n') %
198 (relinked, util.bytecount(savedbytes)))
201 (relinked, util.bytecount(savedbytes)))
General Comments 0
You need to be logged in to leave comments. Login now