Show More
@@ -184,6 +184,105 b' def generateellipsesbundle2(' | |||
|
184 | 184 | part.addparam(b'treemanifest', b'1') |
|
185 | 185 | |
|
186 | 186 | |
|
187 | def generate_ellipses_bundle2_for_widening( | |
|
188 | bundler, | |
|
189 | repo, | |
|
190 | oldinclude, | |
|
191 | oldexclude, | |
|
192 | newinclude, | |
|
193 | newexclude, | |
|
194 | version, | |
|
195 | common, | |
|
196 | heads, | |
|
197 | known, | |
|
198 | depth, | |
|
199 | ): | |
|
200 | newmatch = narrowspec.match( | |
|
201 | repo.root, include=newinclude, exclude=newexclude | |
|
202 | ) | |
|
203 | if depth is not None: | |
|
204 | depth = int(depth) | |
|
205 | if depth < 1: | |
|
206 | raise error.Abort(_(b'depth must be positive, got %d') % depth) | |
|
207 | ||
|
208 | heads = set(heads or repo.heads()) | |
|
209 | common = set(common or [nullid]) | |
|
210 | if known and (oldinclude != newinclude or oldexclude != newexclude): | |
|
211 | # Steps: | |
|
212 | # 1. Send kill for "$known & ::common" | |
|
213 | # | |
|
214 | # 2. Send changegroup for ::common | |
|
215 | # | |
|
216 | # 3. Proceed. | |
|
217 | # | |
|
218 | # In the future, we can send kills for only the specific | |
|
219 | # nodes we know should go away or change shape, and then | |
|
220 | # send a data stream that tells the client something like this: | |
|
221 | # | |
|
222 | # a) apply this changegroup | |
|
223 | # b) apply nodes XXX, YYY, ZZZ that you already have | |
|
224 | # c) goto a | |
|
225 | # | |
|
226 | # until they've built up the full new state. | |
|
227 | # Convert to revnums and intersect with "common". The client should | |
|
228 | # have made it a subset of "common" already, but let's be safe. | |
|
229 | known = set(repo.revs(b"%ln & ::%ln", known, common)) | |
|
230 | # TODO: we could send only roots() of this set, and the | |
|
231 | # list of nodes in common, and the client could work out | |
|
232 | # what to strip, instead of us explicitly sending every | |
|
233 | # single node. | |
|
234 | deadrevs = known | |
|
235 | ||
|
236 | def genkills(): | |
|
237 | for r in deadrevs: | |
|
238 | yield _KILLNODESIGNAL | |
|
239 | yield repo.changelog.node(r) | |
|
240 | yield _DONESIGNAL | |
|
241 | ||
|
242 | bundler.newpart(_CHANGESPECPART, data=genkills()) | |
|
243 | newvisit, newfull, newellipsis = exchange._computeellipsis( | |
|
244 | repo, set(), common, known, newmatch | |
|
245 | ) | |
|
246 | if newvisit: | |
|
247 | packer = changegroup.getbundler( | |
|
248 | version, | |
|
249 | repo, | |
|
250 | matcher=newmatch, | |
|
251 | ellipses=True, | |
|
252 | shallow=depth is not None, | |
|
253 | ellipsisroots=newellipsis, | |
|
254 | fullnodes=newfull, | |
|
255 | ) | |
|
256 | cgdata = packer.generate(common, newvisit, False, b'narrow_widen') | |
|
257 | ||
|
258 | part = bundler.newpart(b'changegroup', data=cgdata) | |
|
259 | part.addparam(b'version', version) | |
|
260 | if b'treemanifest' in repo.requirements: | |
|
261 | part.addparam(b'treemanifest', b'1') | |
|
262 | ||
|
263 | visitnodes, relevant_nodes, ellipsisroots = exchange._computeellipsis( | |
|
264 | repo, common, heads, set(), newmatch, depth=depth | |
|
265 | ) | |
|
266 | ||
|
267 | repo.ui.debug(b'Found %d relevant revs\n' % len(relevant_nodes)) | |
|
268 | if visitnodes: | |
|
269 | packer = changegroup.getbundler( | |
|
270 | version, | |
|
271 | repo, | |
|
272 | matcher=newmatch, | |
|
273 | ellipses=True, | |
|
274 | shallow=depth is not None, | |
|
275 | ellipsisroots=ellipsisroots, | |
|
276 | fullnodes=relevant_nodes, | |
|
277 | ) | |
|
278 | cgdata = packer.generate(common, visitnodes, False, b'narrow_widen') | |
|
279 | ||
|
280 | part = bundler.newpart(b'changegroup', data=cgdata) | |
|
281 | part.addparam(b'version', version) | |
|
282 | if b'treemanifest' in repo.requirements: | |
|
283 | part.addparam(b'treemanifest', b'1') | |
|
284 | ||
|
285 | ||
|
187 | 286 | @bundle2.parthandler(_SPECPART, (_SPECPART_INCLUDE, _SPECPART_EXCLUDE)) |
|
188 | 287 | def _handlechangespec_2(op, inpart): |
|
189 | 288 | # XXX: This bundle2 handling is buggy and should be removed after hg5.2 is |
General Comments 0
You need to be logged in to leave comments.
Login now