Show More
@@ -50,6 +50,50 b' def getrepocaps_narrow(orig, repo, **kwa' | |||
|
50 | 50 | caps[NARROWCAP] = ['v0'] |
|
51 | 51 | return caps |
|
52 | 52 | |
|
53 | def getbundlechangegrouppart_nonellipsis(bundler, repo, source, bundlecaps=None, | |
|
54 | b2caps=None, heads=None, common=None, | |
|
55 | **kwargs): | |
|
56 | """Handling changegroup changegroup generation on the server when user | |
|
57 | is widening their narrowspec""" | |
|
58 | ||
|
59 | cgversions = b2caps.get('changegroup') | |
|
60 | if cgversions: # 3.1 and 3.2 ship with an empty value | |
|
61 | cgversions = [v for v in cgversions | |
|
62 | if v in changegroup.supportedoutgoingversions(repo)] | |
|
63 | if not cgversions: | |
|
64 | raise ValueError(_('no common changegroup version')) | |
|
65 | version = max(cgversions) | |
|
66 | else: | |
|
67 | raise ValueError(_("server does not advertise changegroup version," | |
|
68 | " can't negotiate support for ellipsis nodes")) | |
|
69 | ||
|
70 | include = sorted(filter(bool, kwargs.get(r'includepats', []))) | |
|
71 | exclude = sorted(filter(bool, kwargs.get(r'excludepats', []))) | |
|
72 | newmatch = narrowspec.match(repo.root, include=include, exclude=exclude) | |
|
73 | oldinclude = sorted(filter(bool, kwargs.get(r'oldincludepats', []))) | |
|
74 | oldexclude = sorted(filter(bool, kwargs.get(r'oldexcludepats', []))) | |
|
75 | common = set(common or [nullid]) | |
|
76 | ||
|
77 | if (oldinclude != include or oldexclude != exclude): | |
|
78 | common = repo.revs("::%ln", common) | |
|
79 | commonnodes = set() | |
|
80 | cl = repo.changelog | |
|
81 | for c in common: | |
|
82 | commonnodes.add(cl.node(c)) | |
|
83 | if commonnodes: | |
|
84 | # XXX: we should only send the filelogs (and treemanifest). user | |
|
85 | # already has the changelog and manifest | |
|
86 | packer = changegroup.getbundler(version, repo, | |
|
87 | filematcher=newmatch, | |
|
88 | fullnodes=commonnodes) | |
|
89 | cgdata = packer.generate(set([nullid]), list(commonnodes), False, | |
|
90 | source) | |
|
91 | ||
|
92 | part = bundler.newpart('changegroup', data=cgdata) | |
|
93 | part.addparam('version', version) | |
|
94 | if 'treemanifest' in repo.requirements: | |
|
95 | part.addparam('treemanifest', '1') | |
|
96 | ||
|
53 | 97 | # Serve a changegroup for a client with a narrow clone. |
|
54 | 98 | def getbundlechangegrouppart_narrow(bundler, repo, source, |
|
55 | 99 | bundlecaps=None, b2caps=None, heads=None, |
@@ -254,6 +298,7 b' def setup():' | |||
|
254 | 298 | getbundleargs = wireprototypes.GETBUNDLE_ARGUMENTS |
|
255 | 299 | |
|
256 | 300 | getbundleargs['narrow'] = 'boolean' |
|
301 | getbundleargs['widen'] = 'boolean' | |
|
257 | 302 | getbundleargs['depth'] = 'plain' |
|
258 | 303 | getbundleargs['oldincludepats'] = 'csv' |
|
259 | 304 | getbundleargs['oldexcludepats'] = 'csv' |
@@ -271,6 +316,8 b' def setup():' | |||
|
271 | 316 | if (kwargs.get(r'narrow', False) and |
|
272 | 317 | repo.ui.configbool('experimental', 'narrowservebrokenellipses')): |
|
273 | 318 | getbundlechangegrouppart_narrow(*args, **kwargs) |
|
319 | elif kwargs.get(r'widen', False) and kwargs.get(r'narrow', False): | |
|
320 | getbundlechangegrouppart_nonellipsis(*args, **kwargs) | |
|
274 | 321 | else: |
|
275 | 322 | origcgfn(*args, **kwargs) |
|
276 | 323 | exchange.getbundle2partsmapping['changegroup'] = wrappedcgfn |
@@ -286,6 +286,7 b' def _widen(ui, repo, remote, commoninc, ' | |||
|
286 | 286 | # The old{in,ex}cludepats have already been set by orig() |
|
287 | 287 | kwargs['includepats'] = newincludes |
|
288 | 288 | kwargs['excludepats'] = newexcludes |
|
289 | kwargs['widen'] = True | |
|
289 | 290 | wrappedextraprepare = extensions.wrappedfunction(exchange, |
|
290 | 291 | '_pullbundle2extraprepare', pullbundle2extraprepare_widen) |
|
291 | 292 |
@@ -89,6 +89,10 b' added upstream revisions.' | |||
|
89 | 89 | comparing with ssh://user@dummy/master |
|
90 | 90 | searching for changes |
|
91 | 91 | no changes found |
|
92 | adding changesets | |
|
93 | adding manifests | |
|
94 | adding file changes | |
|
95 | added 0 changesets with 0 changes to 1 files | |
|
92 | 96 | 3 local changesets published |
|
93 | 97 | $ hg tracked |
|
94 | 98 | I path:inside |
@@ -141,6 +145,10 b' widen the narrow spec to include the wid' | |||
|
141 | 145 | comparing with ssh://user@dummy/master |
|
142 | 146 | searching for changes |
|
143 | 147 | no changes found |
|
148 | adding changesets | |
|
149 | adding manifests | |
|
150 | adding file changes | |
|
151 | added 0 changesets with 4 changes to 2 files | |
|
144 | 152 | 5 local changesets published |
|
145 | 153 | abort: path ends in directory separator: widest/ |
|
146 | 154 | [255] |
@@ -247,6 +255,10 b' make narrow clone with every third node.' | |||
|
247 | 255 | comparing with ssh://user@dummy/upstream |
|
248 | 256 | searching for changes |
|
249 | 257 | no changes found |
|
258 | adding changesets | |
|
259 | adding manifests | |
|
260 | adding file changes | |
|
261 | added 0 changesets with 1 changes to 5 files | |
|
250 | 262 | 11 local changesets published |
|
251 | 263 | abort: path ends in directory separator: d1/ |
|
252 | 264 | [255] |
@@ -274,9 +286,12 b" Verify shouldn't claim the repo is corru" | |||
|
274 | 286 | checking changesets |
|
275 | 287 | checking manifests |
|
276 | 288 | checking directory manifests |
|
289 | warning: orphan data file 'meta/d1/00manifest.i' | |
|
277 | 290 | crosschecking files in changesets and manifests |
|
278 | 291 | checking files |
|
292 | warning: orphan data file 'data/d1/f.i' | |
|
279 | 293 | 4 files, 11 changesets, 4 total revisions |
|
294 | 2 warnings encountered! | |
|
280 | 295 | |
|
281 | 296 | Widening preserves parent of local commit |
|
282 | 297 | |
@@ -340,6 +355,10 b' Widening that fails can be recovered fro' | |||
|
340 | 355 | comparing with ssh://user@dummy/upstream |
|
341 | 356 | searching for changes |
|
342 | 357 | no changes found |
|
358 | adding changesets | |
|
359 | adding manifests | |
|
360 | adding file changes | |
|
361 | added 0 changesets with 1 changes to 2 files | |
|
343 | 362 | 11 local changesets published |
|
344 | 363 | abort: path ends in directory separator: d1/ |
|
345 | 364 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now