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