Show More
@@ -291,7 +291,7 b' class bundle10(object):' | |||||
291 |
|
291 | |||
292 | yield self.close() |
|
292 | yield self.close() | |
293 |
|
293 | |||
294 | def generate(self, clnodes, getmfnodes, getfiles, getfilenodes, source): |
|
294 | def generate(self, commonrevs, clnodes, fastpathlinkrev, source): | |
295 | '''yield a sequence of changegroup chunks (strings)''' |
|
295 | '''yield a sequence of changegroup chunks (strings)''' | |
296 | repo = self._repo |
|
296 | repo = self._repo | |
297 | cl = self._changelog |
|
297 | cl = self._changelog | |
@@ -300,6 +300,69 b' class bundle10(object):' | |||||
300 | progress = repo.ui.progress |
|
300 | progress = repo.ui.progress | |
301 | count = self.count |
|
301 | count = self.count | |
302 | _bundling = _('bundling') |
|
302 | _bundling = _('bundling') | |
|
303 | _changesets = _('changesets') | |||
|
304 | _manifests = _('manifests') | |||
|
305 | _files = _('files') | |||
|
306 | ||||
|
307 | mfs = {} # needed manifests | |||
|
308 | fnodes = {} # needed file nodes | |||
|
309 | changedfiles = set() | |||
|
310 | fstate = ['', {}] | |||
|
311 | ||||
|
312 | # filter any nodes that claim to be part of the known set | |||
|
313 | def prune(revlog, missing): | |||
|
314 | rr, rl = revlog.rev, revlog.linkrev | |||
|
315 | return [n for n in missing | |||
|
316 | if rl(rr(n)) not in commonrevs] | |||
|
317 | ||||
|
318 | def lookup(revlog, x): | |||
|
319 | if revlog == cl: | |||
|
320 | c = cl.read(x) | |||
|
321 | changedfiles.update(c[3]) | |||
|
322 | mfs.setdefault(c[0], x) | |||
|
323 | count[0] += 1 | |||
|
324 | progress(_bundling, count[0], | |||
|
325 | unit=_changesets, total=count[1]) | |||
|
326 | return x | |||
|
327 | elif revlog == mf: | |||
|
328 | clnode = mfs[x] | |||
|
329 | if not fastpathlinkrev: | |||
|
330 | mdata = mf.readfast(x) | |||
|
331 | for f, n in mdata.iteritems(): | |||
|
332 | if f in changedfiles: | |||
|
333 | fnodes[f].setdefault(n, clnode) | |||
|
334 | count[0] += 1 | |||
|
335 | progress(_bundling, count[0], | |||
|
336 | unit=_manifests, total=count[1]) | |||
|
337 | return clnode | |||
|
338 | else: | |||
|
339 | progress(_bundling, count[0], item=fstate[0], | |||
|
340 | unit=_files, total=count[1]) | |||
|
341 | return fstate[1][x] | |||
|
342 | ||||
|
343 | self.start(lookup) | |||
|
344 | ||||
|
345 | def getmfnodes(): | |||
|
346 | for f in changedfiles: | |||
|
347 | fnodes[f] = {} | |||
|
348 | count[:] = [0, len(mfs)] | |||
|
349 | return prune(mf, mfs) | |||
|
350 | def getfiles(): | |||
|
351 | mfs.clear() | |||
|
352 | return changedfiles | |||
|
353 | def getfilenodes(fname, filerevlog): | |||
|
354 | if fastpathlinkrev: | |||
|
355 | ln, llr = filerevlog.node, filerevlog.linkrev | |||
|
356 | def genfilenodes(): | |||
|
357 | for r in filerevlog: | |||
|
358 | linkrev = llr(r) | |||
|
359 | if linkrev not in commonrevs: | |||
|
360 | yield filerevlog.node(r), cl.node(linkrev) | |||
|
361 | fnodes[fname] = dict(genfilenodes()) | |||
|
362 | fstate[0] = fname | |||
|
363 | fstate[1] = fnodes.pop(fname, {}) | |||
|
364 | return prune(filerevlog, fstate[1]) | |||
|
365 | ||||
303 |
|
366 | |||
304 | count[:] = [0, len(clnodes)] |
|
367 | count[:] = [0, len(clnodes)] | |
305 | for chunk in self.group(clnodes, cl, reorder=reorder): |
|
368 | for chunk in self.group(clnodes, cl, reorder=reorder): |
@@ -2035,13 +2035,6 b' class localrepository(object):' | |||||
2035 | commonrevs = outgoing.common |
|
2035 | commonrevs = outgoing.common | |
2036 | csets = outgoing.missing |
|
2036 | csets = outgoing.missing | |
2037 | heads = outgoing.missingheads |
|
2037 | heads = outgoing.missingheads | |
2038 | cl = bundler._changelog |
|
|||
2039 | mf = bundler._manifest |
|
|||
2040 | mfs = {} # needed manifests |
|
|||
2041 | fnodes = {} # needed file nodes |
|
|||
2042 | changedfiles = set() |
|
|||
2043 | fstate = ['', {}] |
|
|||
2044 |
|
||||
2045 | # We go through the fast path if we get told to, or if all (unfiltered |
|
2038 | # We go through the fast path if we get told to, or if all (unfiltered | |
2046 | # heads have been requested (since we then know there all linkrevs will |
|
2039 | # heads have been requested (since we then know there all linkrevs will | |
2047 | # be pulled by the client). |
|
2040 | # be pulled by the client). | |
@@ -2051,70 +2044,7 b' class localrepository(object):' | |||||
2051 |
|
2044 | |||
2052 | self.hook('preoutgoing', throw=True, source=source) |
|
2045 | self.hook('preoutgoing', throw=True, source=source) | |
2053 | self.changegroupinfo(csets, source) |
|
2046 | self.changegroupinfo(csets, source) | |
2054 |
|
2047 | gengroup = bundler.generate(commonrevs, csets, fastpathlinkrev, source) | ||
2055 | # filter any nodes that claim to be part of the known set |
|
|||
2056 | def prune(revlog, missing): |
|
|||
2057 | rr, rl = revlog.rev, revlog.linkrev |
|
|||
2058 | return [n for n in missing |
|
|||
2059 | if rl(rr(n)) not in commonrevs] |
|
|||
2060 |
|
||||
2061 | progress = self.ui.progress |
|
|||
2062 | _bundling = _('bundling') |
|
|||
2063 | _changesets = _('changesets') |
|
|||
2064 | _manifests = _('manifests') |
|
|||
2065 | _files = _('files') |
|
|||
2066 |
|
||||
2067 | def lookup(revlog, x): |
|
|||
2068 | count = bundler.count |
|
|||
2069 | if revlog == cl: |
|
|||
2070 | c = cl.read(x) |
|
|||
2071 | changedfiles.update(c[3]) |
|
|||
2072 | mfs.setdefault(c[0], x) |
|
|||
2073 | count[0] += 1 |
|
|||
2074 | progress(_bundling, count[0], |
|
|||
2075 | unit=_changesets, total=count[1]) |
|
|||
2076 | return x |
|
|||
2077 | elif revlog == mf: |
|
|||
2078 | clnode = mfs[x] |
|
|||
2079 | if not fastpathlinkrev: |
|
|||
2080 | mdata = mf.readfast(x) |
|
|||
2081 | for f, n in mdata.iteritems(): |
|
|||
2082 | if f in changedfiles: |
|
|||
2083 | fnodes[f].setdefault(n, clnode) |
|
|||
2084 | count[0] += 1 |
|
|||
2085 | progress(_bundling, count[0], |
|
|||
2086 | unit=_manifests, total=count[1]) |
|
|||
2087 | return clnode |
|
|||
2088 | else: |
|
|||
2089 | progress(_bundling, count[0], item=fstate[0], |
|
|||
2090 | unit=_files, total=count[1]) |
|
|||
2091 | return fstate[1][x] |
|
|||
2092 |
|
||||
2093 | bundler.start(lookup) |
|
|||
2094 |
|
||||
2095 | def getmfnodes(): |
|
|||
2096 | for f in changedfiles: |
|
|||
2097 | fnodes[f] = {} |
|
|||
2098 | bundler.count[:] = [0, len(mfs)] |
|
|||
2099 | return prune(mf, mfs) |
|
|||
2100 | def getfiles(): |
|
|||
2101 | mfs.clear() |
|
|||
2102 | return changedfiles |
|
|||
2103 | def getfilenodes(fname, filerevlog): |
|
|||
2104 | if fastpathlinkrev: |
|
|||
2105 | ln, llr = filerevlog.node, filerevlog.linkrev |
|
|||
2106 | def genfilenodes(): |
|
|||
2107 | for r in filerevlog: |
|
|||
2108 | linkrev = llr(r) |
|
|||
2109 | if linkrev not in commonrevs: |
|
|||
2110 | yield filerevlog.node(r), cl.node(linkrev) |
|
|||
2111 | fnodes[fname] = dict(genfilenodes()) |
|
|||
2112 | fstate[0] = fname |
|
|||
2113 | fstate[1] = fnodes.pop(fname, {}) |
|
|||
2114 | return prune(filerevlog, fstate[1]) |
|
|||
2115 |
|
||||
2116 | gengroup = bundler.generate(csets, getmfnodes, getfiles, getfilenodes, |
|
|||
2117 | source) |
|
|||
2118 | return changegroup.unbundle10(util.chunkbuffer(gengroup), 'UN') |
|
2048 | return changegroup.unbundle10(util.chunkbuffer(gengroup), 'UN') | |
2119 |
|
2049 | |||
2120 | def changegroup(self, basenodes, source): |
|
2050 | def changegroup(self, basenodes, source): |
General Comments 0
You need to be logged in to leave comments.
Login now