Show More
@@ -50,40 +50,6 b' def getrepocaps_narrow(orig, repo, **kwa' | |||||
50 | caps[NARROWCAP] = ['v0'] |
|
50 | caps[NARROWCAP] = ['v0'] | |
51 | return caps |
|
51 | return caps | |
52 |
|
52 | |||
53 | def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): |
|
|||
54 | """generates bundle2 for widening a narrow clone |
|
|||
55 |
|
||||
56 | repo is the localrepository instance |
|
|||
57 | diffmatcher is a differencemacther of '(newincludes, newexcludes) - |
|
|||
58 | (oldincludes, oldexcludes)' |
|
|||
59 | common is set of common heads between server and client |
|
|||
60 | known is a set of revs known on the client side (used in ellipses) |
|
|||
61 | cgversion is the changegroup version to send |
|
|||
62 | ellipses is boolean value telling whether to send ellipses data or not |
|
|||
63 |
|
||||
64 | returns bundle2 of the data required for extending |
|
|||
65 | """ |
|
|||
66 | bundler = bundle2.bundle20(repo.ui) |
|
|||
67 | commonnodes = set() |
|
|||
68 | cl = repo.changelog |
|
|||
69 | for r in repo.revs("::%ln", common): |
|
|||
70 | commonnodes.add(cl.node(r)) |
|
|||
71 | if commonnodes: |
|
|||
72 | # XXX: we should only send the filelogs (and treemanifest). user |
|
|||
73 | # already has the changelog and manifest |
|
|||
74 | packer = changegroup.getbundler(cgversion, repo, |
|
|||
75 | filematcher=diffmatcher, |
|
|||
76 | fullnodes=commonnodes) |
|
|||
77 | cgdata = packer.generate(set([nullid]), list(commonnodes), False, |
|
|||
78 | 'narrow_widen', changelog=False) |
|
|||
79 |
|
||||
80 | part = bundler.newpart('changegroup', data=cgdata) |
|
|||
81 | part.addparam('version', cgversion) |
|
|||
82 | if 'treemanifest' in repo.requirements: |
|
|||
83 | part.addparam('treemanifest', '1') |
|
|||
84 |
|
||||
85 | return bundler |
|
|||
86 |
|
||||
87 | # Serve a changegroup for a client with a narrow clone. |
|
53 | # Serve a changegroup for a client with a narrow clone. | |
88 | def getbundlechangegrouppart_narrow(bundler, repo, source, |
|
54 | def getbundlechangegrouppart_narrow(bundler, repo, source, | |
89 | bundlecaps=None, b2caps=None, heads=None, |
|
55 | bundlecaps=None, b2caps=None, heads=None, |
@@ -21,8 +21,6 b' from mercurial import (' | |||||
21 | wireprotov1server, |
|
21 | wireprotov1server, | |
22 | ) |
|
22 | ) | |
23 |
|
23 | |||
24 | from . import narrowbundle2 |
|
|||
25 |
|
||||
26 | def uisetup(): |
|
24 | def uisetup(): | |
27 | extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) |
|
25 | extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) | |
28 | wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden |
|
26 | wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden | |
@@ -95,7 +93,7 b' def narrow_widen(repo, proto, oldinclude' | |||||
95 | exclude=oldexcludes) |
|
93 | exclude=oldexcludes) | |
96 | diffmatch = matchmod.differencematcher(newmatch, oldmatch) |
|
94 | diffmatch = matchmod.differencematcher(newmatch, oldmatch) | |
97 |
|
95 | |||
98 |
bundler = |
|
96 | bundler = bundle2.widen_bundle(repo, diffmatch, common, known, | |
99 | cgversion, ellipses) |
|
97 | cgversion, ellipses) | |
100 | except error.Abort as exc: |
|
98 | except error.Abort as exc: | |
101 | bundler = bundle2.bundle20(repo.ui) |
|
99 | bundler = bundle2.bundle20(repo.ui) |
@@ -2266,3 +2266,37 b' def handlestreamv2bundle(op, part):' | |||||
2266 | repo.ui.debug('applying stream bundle\n') |
|
2266 | repo.ui.debug('applying stream bundle\n') | |
2267 | streamclone.applybundlev2(repo, part, filecount, bytecount, |
|
2267 | streamclone.applybundlev2(repo, part, filecount, bytecount, | |
2268 | requirements) |
|
2268 | requirements) | |
|
2269 | ||||
|
2270 | def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): | |||
|
2271 | """generates bundle2 for widening a narrow clone | |||
|
2272 | ||||
|
2273 | repo is the localrepository instance | |||
|
2274 | diffmatcher is a differencemacther of '(newincludes, newexcludes) - | |||
|
2275 | (oldincludes, oldexcludes)' | |||
|
2276 | common is set of common heads between server and client | |||
|
2277 | known is a set of revs known on the client side (used in ellipses) | |||
|
2278 | cgversion is the changegroup version to send | |||
|
2279 | ellipses is boolean value telling whether to send ellipses data or not | |||
|
2280 | ||||
|
2281 | returns bundle2 of the data required for extending | |||
|
2282 | """ | |||
|
2283 | bundler = bundle20(repo.ui) | |||
|
2284 | commonnodes = set() | |||
|
2285 | cl = repo.changelog | |||
|
2286 | for r in repo.revs("::%ln", common): | |||
|
2287 | commonnodes.add(cl.node(r)) | |||
|
2288 | if commonnodes: | |||
|
2289 | # XXX: we should only send the filelogs (and treemanifest). user | |||
|
2290 | # already has the changelog and manifest | |||
|
2291 | packer = changegroup.getbundler(cgversion, repo, | |||
|
2292 | filematcher=diffmatcher, | |||
|
2293 | fullnodes=commonnodes) | |||
|
2294 | cgdata = packer.generate(set([nodemod.nullid]), list(commonnodes), | |||
|
2295 | False, 'narrow_widen', changelog=False) | |||
|
2296 | ||||
|
2297 | part = bundler.newpart('changegroup', data=cgdata) | |||
|
2298 | part.addparam('version', cgversion) | |||
|
2299 | if 'treemanifest' in repo.requirements: | |||
|
2300 | part.addparam('treemanifest', '1') | |||
|
2301 | ||||
|
2302 | return bundler |
General Comments 0
You need to be logged in to leave comments.
Login now