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