Show More
@@ -244,14 +244,13 b' 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.count = [0, 0] |
|
|||
248 | def close(self): |
|
247 | def close(self): | |
249 | return closechunk() |
|
248 | return closechunk() | |
250 |
|
249 | |||
251 | def fileheader(self, fname): |
|
250 | def fileheader(self, fname): | |
252 | return chunkheader(len(fname)) + fname |
|
251 | return chunkheader(len(fname)) + fname | |
253 |
|
252 | |||
254 | def group(self, nodelist, revlog, reorder=None): |
|
253 | def group(self, nodelist, revlog, lookup, reorder=None): | |
255 | """Calculate a delta group, yielding a sequence of changegroup chunks |
|
254 | """Calculate a delta group, yielding a sequence of changegroup chunks | |
256 | (strings). |
|
255 | (strings). | |
257 |
|
256 | |||
@@ -284,7 +283,8 b' class bundle10(object):' | |||||
284 | # build deltas |
|
283 | # build deltas | |
285 | for r in xrange(len(revs) - 1): |
|
284 | for r in xrange(len(revs) - 1): | |
286 | prev, curr = revs[r], revs[r + 1] |
|
285 | prev, curr = revs[r], revs[r + 1] | |
287 | for c in self.revchunk(revlog, curr, prev): |
|
286 | linknode = lookup(revlog.node(curr)) | |
|
287 | for c in self.revchunk(revlog, curr, prev, linknode): | |||
288 | yield c |
|
288 | yield c | |
289 |
|
289 | |||
290 | yield self.close() |
|
290 | yield self.close() | |
@@ -296,7 +296,10 b' class bundle10(object):' | |||||
296 | mf = self._manifest |
|
296 | mf = self._manifest | |
297 | reorder = self._reorder |
|
297 | reorder = self._reorder | |
298 | progress = repo.ui.progress |
|
298 | progress = repo.ui.progress | |
299 | count = self.count |
|
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] | |||
300 | _bundling = _('bundling') |
|
303 | _bundling = _('bundling') | |
301 | _changesets = _('changesets') |
|
304 | _changesets = _('changesets') | |
302 | _manifests = _('manifests') |
|
305 | _manifests = _('manifests') | |
@@ -305,7 +308,6 b' class bundle10(object):' | |||||
305 | mfs = {} # needed manifests |
|
308 | mfs = {} # needed manifests | |
306 | fnodes = {} # needed file nodes |
|
309 | fnodes = {} # needed file nodes | |
307 | changedfiles = set() |
|
310 | changedfiles = set() | |
308 | fstate = ['', {}] |
|
|||
309 |
|
311 | |||
310 | # filter any nodes that claim to be part of the known set |
|
312 | # filter any nodes that claim to be part of the known set | |
311 | def prune(revlog, missing): |
|
313 | def prune(revlog, missing): | |
@@ -313,35 +315,38 b' class bundle10(object):' | |||||
313 | return [n for n in missing |
|
315 | return [n for n in missing | |
314 | if rl(rr(n)) not in commonrevs] |
|
316 | if rl(rr(n)) not in commonrevs] | |
315 |
|
317 | |||
316 | def lookup(revlog, x): |
|
318 | # Callback for the changelog, used to collect changed files and manifest | |
317 | if revlog == cl: |
|
319 | # nodes. | |
|
320 | # Returns the linkrev node (identity in the changelog case). | |||
|
321 | def lookupcl(x): | |||
318 |
|
|
322 | c = cl.read(x) | |
319 |
|
|
323 | changedfiles.update(c[3]) | |
|
324 | # record the first changeset introducing this manifest version | |||
320 |
|
|
325 | mfs.setdefault(c[0], x) | |
321 |
|
|
326 | count[0] += 1 | |
322 |
|
|
327 | progress(_bundling, count[0], | |
323 |
|
|
328 | unit=_changesets, total=count[1]) | |
324 |
|
|
329 | return x | |
325 | elif revlog == mf: |
|
330 | ||
|
331 | # Callback for the manifest, used to collect linkrevs for filelog | |||
|
332 | # revisions. | |||
|
333 | # Returns the linkrev node (collected in lookupcl). | |||
|
334 | def lookupmf(x): | |||
326 |
|
|
335 | clnode = mfs[x] | |
327 |
|
|
336 | if not fastpathlinkrev: | |
328 |
|
|
337 | mdata = mf.readfast(x) | |
329 |
|
|
338 | for f, n in mdata.iteritems(): | |
330 |
|
|
339 | if f in changedfiles: | |
|
340 | # record the first changeset introducing this filelog | |||
|
341 | # version | |||
331 |
|
|
342 | fnodes[f].setdefault(n, clnode) | |
332 |
|
|
343 | count[0] += 1 | |
333 |
|
|
344 | progress(_bundling, count[0], | |
334 |
|
|
345 | unit=_manifests, total=count[1]) | |
335 |
|
|
346 | return clnode | |
336 | else: |
|
|||
337 | progress(_bundling, count[0], item=fstate[0], |
|
|||
338 | unit=_files, total=count[1]) |
|
|||
339 | return fstate[1][x] |
|
|||
340 |
|
||||
341 | self._lookup = lookup |
|
|||
342 |
|
347 | |||
343 | count[:] = [0, len(clnodes)] |
|
348 | count[:] = [0, len(clnodes)] | |
344 | for chunk in self.group(clnodes, cl, reorder=reorder): |
|
349 | for chunk in self.group(clnodes, cl, lookupcl, reorder=reorder): | |
345 | yield chunk |
|
350 | yield chunk | |
346 | progress(_bundling, None) |
|
351 | progress(_bundling, None) | |
347 |
|
352 | |||
@@ -349,7 +354,7 b' class bundle10(object):' | |||||
349 | fnodes[f] = {} |
|
354 | fnodes[f] = {} | |
350 | count[:] = [0, len(mfs)] |
|
355 | count[:] = [0, len(mfs)] | |
351 | mfnodes = prune(mf, mfs) |
|
356 | mfnodes = prune(mf, mfs) | |
352 | for chunk in self.group(mfnodes, mf, reorder=reorder): |
|
357 | for chunk in self.group(mfnodes, mf, lookupmf, reorder=reorder): | |
353 | yield chunk |
|
358 | yield chunk | |
354 | progress(_bundling, None) |
|
359 | progress(_bundling, None) | |
355 |
|
360 | |||
@@ -369,13 +374,21 b' class bundle10(object):' | |||||
369 | if linkrev not in commonrevs: |
|
374 | if linkrev not in commonrevs: | |
370 | yield filerevlog.node(r), cl.node(linkrev) |
|
375 | yield filerevlog.node(r), cl.node(linkrev) | |
371 | fnodes[fname] = dict(genfilenodes()) |
|
376 | fnodes[fname] = dict(genfilenodes()) | |
372 | fstate[0] = fname |
|
377 | ||
373 |
|
|
378 | linkrevnodes = fnodes.pop(fname, {}) | |
374 | filenodes = prune(filerevlog, fstate[1]) |
|
379 | # Lookup for filenodes, we collected the linkrev nodes above in the | |
|
380 | # fastpath case and with lookupmf in the slowpath case. | |||
|
381 | def lookupfilelog(x): | |||
|
382 | progress(_bundling, count[0], item=fname, | |||
|
383 | unit=_files, total=count[1]) | |||
|
384 | return linkrevnodes[x] | |||
|
385 | ||||
|
386 | filenodes = prune(filerevlog, linkrevnodes) | |||
375 | if filenodes: |
|
387 | if filenodes: | |
376 | count[0] += 1 |
|
388 | count[0] += 1 | |
377 | yield self.fileheader(fname) |
|
389 | yield self.fileheader(fname) | |
378 |
for chunk in self.group(filenodes, filerevlog, |
|
390 | for chunk in self.group(filenodes, filerevlog, lookupfilelog, | |
|
391 | reorder): | |||
379 | yield chunk |
|
392 | yield chunk | |
380 | yield self.close() |
|
393 | yield self.close() | |
381 | progress(_bundling, None) |
|
394 | progress(_bundling, None) | |
@@ -383,7 +396,7 b' class bundle10(object):' | |||||
383 | if clnodes: |
|
396 | if clnodes: | |
384 | repo.hook('outgoing', node=hex(clnodes[0]), source=source) |
|
397 | repo.hook('outgoing', node=hex(clnodes[0]), source=source) | |
385 |
|
398 | |||
386 | def revchunk(self, revlog, rev, prev): |
|
399 | def revchunk(self, revlog, rev, prev, linknode): | |
387 | node = revlog.node(rev) |
|
400 | node = revlog.node(rev) | |
388 | p1, p2 = revlog.parentrevs(rev) |
|
401 | p1, p2 = revlog.parentrevs(rev) | |
389 | base = prev |
|
402 | base = prev | |
@@ -394,7 +407,6 b' class bundle10(object):' | |||||
394 | prefix = mdiff.trivialdiffheader(len(delta)) |
|
407 | prefix = mdiff.trivialdiffheader(len(delta)) | |
395 | else: |
|
408 | else: | |
396 | delta = revlog.revdiff(base, rev) |
|
409 | delta = revlog.revdiff(base, rev) | |
397 | linknode = self._lookup(revlog, node) |
|
|||
398 | p1n, p2n = revlog.parents(node) |
|
410 | p1n, p2n = revlog.parents(node) | |
399 | basenode = revlog.node(base) |
|
411 | basenode = revlog.node(base) | |
400 | meta = self.builddeltaheader(node, p1n, p2n, basenode, linknode) |
|
412 | meta = self.builddeltaheader(node, p1n, p2n, basenode, linknode) |
General Comments 0
You need to be logged in to leave comments.
Login now