##// END OF EJS Templates
changegroup: use progress helper in apply() (API)...
Martin von Zweigbergk -
r38365:83534c4e default
parent child Browse files
Show More
@@ -237,10 +237,8 b' class cg1unpacker(object):'
237 237 pos = next
238 238 yield closechunk()
239 239
240 def _unpackmanifests(self, repo, revmap, trp, prog, numchanges):
241 # We know that we'll never have more manifests than we had
242 # changesets.
243 self.callback = prog(_('manifests'), numchanges)
240 def _unpackmanifests(self, repo, revmap, trp, prog):
241 self.callback = prog.increment
244 242 # no need to check for empty manifest group here:
245 243 # if the result of the merge of 1 and 2 is the same in 3 and 4,
246 244 # no new manifest will be created and the manifest group will
@@ -248,7 +246,7 b' class cg1unpacker(object):'
248 246 self.manifestheader()
249 247 deltas = self.deltaiter()
250 248 repo.manifestlog._revlog.addgroup(deltas, revmap, trp)
251 repo.ui.progress(_('manifests'), None)
249 prog.update(None)
252 250 self.callback = None
253 251
254 252 def apply(self, repo, tr, srctype, url, targetphase=phases.draft,
@@ -293,16 +291,9 b' class cg1unpacker(object):'
293 291 # pull off the changeset group
294 292 repo.ui.status(_("adding changesets\n"))
295 293 clstart = len(cl)
296 class prog(object):
297 def __init__(self, step, total):
298 self._step = step
299 self._total = total
300 self._count = 1
301 def __call__(self):
302 repo.ui.progress(self._step, self._count, unit=_('chunks'),
303 total=self._total)
304 self._count += 1
305 self.callback = prog(_('changesets'), expectedtotal)
294 progress = repo.ui.makeprogress(_('changesets'), unit=_('chunks'),
295 total=expectedtotal)
296 self.callback = progress.increment
306 297
307 298 efiles = set()
308 299 def onchangelog(cl, node):
@@ -318,12 +309,16 b' class cg1unpacker(object):'
318 309 config='warn-empty-changegroup')
319 310 clend = len(cl)
320 311 changesets = clend - clstart
321 repo.ui.progress(_('changesets'), None)
312 progress.update(None)
322 313 self.callback = None
323 314
324 315 # pull off the manifest group
325 316 repo.ui.status(_("adding manifests\n"))
326 self._unpackmanifests(repo, revmap, trp, prog, changesets)
317 # We know that we'll never have more manifests than we had
318 # changesets.
319 progress = repo.ui.makeprogress(_('manifests'), unit=_('chunks'),
320 total=changesets)
321 self._unpackmanifests(repo, revmap, trp, progress)
327 322
328 323 needfiles = {}
329 324 if repo.ui.configbool('server', 'validate'):
@@ -475,9 +470,8 b' class cg3unpacker(cg2unpacker):'
475 470 node, p1, p2, deltabase, cs, flags = headertuple
476 471 return node, p1, p2, deltabase, cs, flags
477 472
478 def _unpackmanifests(self, repo, revmap, trp, prog, numchanges):
479 super(cg3unpacker, self)._unpackmanifests(repo, revmap, trp, prog,
480 numchanges)
473 def _unpackmanifests(self, repo, revmap, trp, prog):
474 super(cg3unpacker, self)._unpackmanifests(repo, revmap, trp, prog)
481 475 for chunkdata in iter(self.filelogheader, {}):
482 476 # If we get here, there are directory manifests in the changegroup
483 477 d = chunkdata["filename"]
General Comments 0
You need to be logged in to leave comments. Login now