Show More
@@ -244,13 +244,14 class bundle10(object): | |||
|
244 | 244 | reorder = util.parsebool(reorder) |
|
245 | 245 | self._repo = repo |
|
246 | 246 | self._reorder = reorder |
|
247 | self._progress = repo.ui.progress | |
|
247 | 248 | def close(self): |
|
248 | 249 | return closechunk() |
|
249 | 250 | |
|
250 | 251 | def fileheader(self, fname): |
|
251 | 252 | return chunkheader(len(fname)) + fname |
|
252 | 253 | |
|
253 | def group(self, nodelist, revlog, lookup, reorder=None): | |
|
254 | def group(self, nodelist, revlog, lookup, units=None, reorder=None): | |
|
254 | 255 | """Calculate a delta group, yielding a sequence of changegroup chunks |
|
255 | 256 | (strings). |
|
256 | 257 | |
@@ -260,8 +261,10 class bundle10(object): | |||
|
260 | 261 | guaranteed to have this parent as it has all history before |
|
261 | 262 | these changesets. In the case firstparent is nullrev the |
|
262 | 263 | changegroup starts with a full revision. |
|
264 | ||
|
265 | If units is not None, progress detail will be generated, units specifies | |
|
266 | the type of revlog that is touched (changelog, manifest, etc.). | |
|
263 | 267 | """ |
|
264 | ||
|
265 | 268 | # if we don't have any revisions touched by these changesets, bail |
|
266 | 269 | if len(nodelist) == 0: |
|
267 | 270 | yield self.close() |
@@ -281,7 +284,11 class bundle10(object): | |||
|
281 | 284 | revs.insert(0, p) |
|
282 | 285 | |
|
283 | 286 | # build deltas |
|
287 | total = len(revs) - 1 | |
|
288 | msgbundling = _('bundling') | |
|
284 | 289 | for r in xrange(len(revs) - 1): |
|
290 | if units is not None: | |
|
291 | self._progress(msgbundling, r + 1, unit=units, total=total) | |
|
285 | 292 | prev, curr = revs[r], revs[r + 1] |
|
286 | 293 | linknode = lookup(revlog.node(curr)) |
|
287 | 294 | for c in self.revchunk(revlog, curr, prev, linknode): |
@@ -295,15 +302,10 class bundle10(object): | |||
|
295 | 302 | cl = self._changelog |
|
296 | 303 | mf = self._manifest |
|
297 | 304 | reorder = self._reorder |
|
298 |
progress = |
|
|
299 | # Keep track of progress, this is a list since it is modified by revlog | |
|
300 | # callbacks. First item is the number of items done, second is the | |
|
301 | # total number to be processed. | |
|
302 | count = [0, 0] | |
|
303 | _bundling = _('bundling') | |
|
304 | _changesets = _('changesets') | |
|
305 | _manifests = _('manifests') | |
|
306 | _files = _('files') | |
|
305 | progress = self._progress | |
|
306 | ||
|
307 | # for progress output | |
|
308 | msgbundling = _('bundling') | |
|
307 | 309 | |
|
308 | 310 | mfs = {} # needed manifests |
|
309 | 311 | fnodes = {} # needed file nodes |
@@ -312,8 +314,7 class bundle10(object): | |||
|
312 | 314 | # filter any nodes that claim to be part of the known set |
|
313 | 315 | def prune(revlog, missing): |
|
314 | 316 | rr, rl = revlog.rev, revlog.linkrev |
|
315 | return [n for n in missing | |
|
316 | if rl(rr(n)) not in commonrevs] | |
|
317 | return [n for n in missing if rl(rr(n)) not in commonrevs] | |
|
317 | 318 | |
|
318 | 319 | # Callback for the changelog, used to collect changed files and manifest |
|
319 | 320 | # nodes. |
@@ -323,9 +324,6 class bundle10(object): | |||
|
323 | 324 | changedfiles.update(c[3]) |
|
324 | 325 | # record the first changeset introducing this manifest version |
|
325 | 326 | mfs.setdefault(c[0], x) |
|
326 | count[0] += 1 | |
|
327 | progress(_bundling, count[0], | |
|
328 | unit=_changesets, total=count[1]) | |
|
329 | 327 | return x |
|
330 | 328 | |
|
331 | 329 | # Callback for the manifest, used to collect linkrevs for filelog |
@@ -340,31 +338,29 class bundle10(object): | |||
|
340 | 338 | # record the first changeset introducing this filelog |
|
341 | 339 | # version |
|
342 | 340 | fnodes[f].setdefault(n, clnode) |
|
343 | count[0] += 1 | |
|
344 | progress(_bundling, count[0], | |
|
345 | unit=_manifests, total=count[1]) | |
|
346 | 341 | return clnode |
|
347 | 342 | |
|
348 | count[:] = [0, len(clnodes)] | |
|
349 | for chunk in self.group(clnodes, cl, lookupcl, reorder=reorder): | |
|
343 | for chunk in self.group(clnodes, cl, lookupcl, units=_('changesets'), | |
|
344 | reorder=reorder): | |
|
350 | 345 | yield chunk |
|
351 |
progress( |
|
|
346 | progress(msgbundling, None) | |
|
352 | 347 | |
|
353 | 348 | for f in changedfiles: |
|
354 | 349 | fnodes[f] = {} |
|
355 | count[:] = [0, len(mfs)] | |
|
356 | 350 | mfnodes = prune(mf, mfs) |
|
357 |
for chunk in self.group(mfnodes, mf, lookupmf, |
|
|
351 | for chunk in self.group(mfnodes, mf, lookupmf, units=_('manifests'), | |
|
352 | reorder=reorder): | |
|
358 | 353 | yield chunk |
|
359 |
progress( |
|
|
354 | progress(msgbundling, None) | |
|
360 | 355 | |
|
361 | 356 | mfs.clear() |
|
362 |
|
|
|
363 | for fname in sorted(changedfiles): | |
|
357 | total = len(changedfiles) | |
|
358 | # for progress output | |
|
359 | msgfiles = _('files') | |
|
360 | for i, fname in enumerate(sorted(changedfiles)): | |
|
364 | 361 | filerevlog = repo.file(fname) |
|
365 | 362 | if not len(filerevlog): |
|
366 | raise util.Abort(_("empty or missing revlog for %s") | |
|
367 | % fname) | |
|
363 | raise util.Abort(_("empty or missing revlog for %s") % fname) | |
|
368 | 364 | |
|
369 | 365 | if fastpathlinkrev: |
|
370 | 366 | ln, llr = filerevlog.node, filerevlog.linkrev |
@@ -379,19 +375,18 class bundle10(object): | |||
|
379 | 375 | # Lookup for filenodes, we collected the linkrev nodes above in the |
|
380 | 376 | # fastpath case and with lookupmf in the slowpath case. |
|
381 | 377 | def lookupfilelog(x): |
|
382 | progress(_bundling, count[0], item=fname, | |
|
383 | unit=_files, total=count[1]) | |
|
384 | 378 | return linkrevnodes[x] |
|
385 | 379 | |
|
386 | 380 | filenodes = prune(filerevlog, linkrevnodes) |
|
387 | 381 | if filenodes: |
|
388 | count[0] += 1 | |
|
382 | progress(msgbundling, i + 1, item=fname, unit=msgfiles, | |
|
383 | total=total) | |
|
389 | 384 | yield self.fileheader(fname) |
|
390 | 385 | for chunk in self.group(filenodes, filerevlog, lookupfilelog, |
|
391 | reorder): | |
|
386 | reorder=reorder): | |
|
392 | 387 | yield chunk |
|
393 | 388 | yield self.close() |
|
394 |
progress( |
|
|
389 | progress(msgbundling, None) | |
|
395 | 390 | |
|
396 | 391 | if clnodes: |
|
397 | 392 | repo.hook('outgoing', node=hex(clnodes[0]), source=source) |
General Comments 0
You need to be logged in to leave comments.
Login now