Show More
@@ -51,6 +51,41 b' def getrepocaps_narrow(orig, repo, **kwa' | |||||
51 | caps[NARROWCAP] = ['v0'] |
|
51 | caps[NARROWCAP] = ['v0'] | |
52 | return caps |
|
52 | return caps | |
53 |
|
53 | |||
|
54 | def widen_bundle(repo, diffmatcher, common, known, cgversion, source, ellipses): | |||
|
55 | """generates changegroup for widening a narrow clone | |||
|
56 | ||||
|
57 | repo is the localrepository instance | |||
|
58 | diffmatcher is a differencemacther of '(newincludes, newexcludes) - | |||
|
59 | (oldincludes, oldexcludes)' | |||
|
60 | common is set of common revs between server and client | |||
|
61 | known is a set of revs known on the client side (used in ellipses) | |||
|
62 | cgversion is the changegroup version to send | |||
|
63 | source is the command which called this codepath | |||
|
64 | ellipses is boolean value telling whether to send ellipses data or not | |||
|
65 | ||||
|
66 | returns changegroup data of the changegroup built or return None if there | |||
|
67 | are no common revs | |||
|
68 | """ | |||
|
69 | # XXX: This patch will start sending bundle2 after couple of patches when | |||
|
70 | # called from the wireprotocol command | |||
|
71 | common = repo.revs("::%ln", common) | |||
|
72 | commonnodes = set() | |||
|
73 | cl = repo.changelog | |||
|
74 | for c in common: | |||
|
75 | commonnodes.add(cl.node(c)) | |||
|
76 | if commonnodes: | |||
|
77 | # XXX: we should only send the filelogs (and treemanifest). user | |||
|
78 | # already has the changelog and manifest | |||
|
79 | packer = changegroup.getbundler(cgversion, repo, | |||
|
80 | filematcher=diffmatcher, | |||
|
81 | fullnodes=commonnodes) | |||
|
82 | cgdata = packer.generate(set([nullid]), list(commonnodes), False, | |||
|
83 | source, changelog=False) | |||
|
84 | ||||
|
85 | return cgdata | |||
|
86 | ||||
|
87 | return None | |||
|
88 | ||||
54 | def getbundlechangegrouppart_widen(bundler, repo, source, bundlecaps=None, |
|
89 | def getbundlechangegrouppart_widen(bundler, repo, source, bundlecaps=None, | |
55 | b2caps=None, heads=None, common=None, |
|
90 | b2caps=None, heads=None, common=None, | |
56 | **kwargs): |
|
91 | **kwargs): | |
@@ -79,20 +114,9 b' def getbundlechangegrouppart_widen(bundl' | |||||
79 | common = set(common or [nullid]) |
|
114 | common = set(common or [nullid]) | |
80 |
|
115 | |||
81 | if (oldinclude != include or oldexclude != exclude): |
|
116 | if (oldinclude != include or oldexclude != exclude): | |
82 | common = repo.revs("::%ln", common) |
|
117 | cgdata = widen_bundle(repo, diffmatch, common, [], version, | |
83 | commonnodes = set() |
|
118 | source, False) | |
84 | cl = repo.changelog |
|
119 | if cgdata is not None: | |
85 | for c in common: |
|
|||
86 | commonnodes.add(cl.node(c)) |
|
|||
87 | if commonnodes: |
|
|||
88 | # XXX: we should only send the filelogs (and treemanifest). user |
|
|||
89 | # already has the changelog and manifest |
|
|||
90 | packer = changegroup.getbundler(version, repo, |
|
|||
91 | filematcher=diffmatch, |
|
|||
92 | fullnodes=commonnodes) |
|
|||
93 | cgdata = packer.generate(set([nullid]), list(commonnodes), False, |
|
|||
94 | source, changelog=False) |
|
|||
95 |
|
||||
96 | part = bundler.newpart('changegroup', data=cgdata) |
|
120 | part = bundler.newpart('changegroup', data=cgdata) | |
97 | part.addparam('version', version) |
|
121 | part.addparam('version', version) | |
98 | if 'treemanifest' in repo.requirements: |
|
122 | if 'treemanifest' in repo.requirements: |
General Comments 0
You need to be logged in to leave comments.
Login now