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