##// END OF EJS Templates
narrow: add server logic to send cg while widening without ellipsis...
Pulkit Goyal -
r39392:c8e4eae8 default
parent child Browse files
Show More
@@ -50,6 +50,50 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 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 # Serve a changegroup for a client with a narrow clone.
97 # Serve a changegroup for a client with a narrow clone.
54 def getbundlechangegrouppart_narrow(bundler, repo, source,
98 def getbundlechangegrouppart_narrow(bundler, repo, source,
55 bundlecaps=None, b2caps=None, heads=None,
99 bundlecaps=None, b2caps=None, heads=None,
@@ -254,6 +298,7 b' def setup():'
254 getbundleargs = wireprototypes.GETBUNDLE_ARGUMENTS
298 getbundleargs = wireprototypes.GETBUNDLE_ARGUMENTS
255
299
256 getbundleargs['narrow'] = 'boolean'
300 getbundleargs['narrow'] = 'boolean'
301 getbundleargs['widen'] = 'boolean'
257 getbundleargs['depth'] = 'plain'
302 getbundleargs['depth'] = 'plain'
258 getbundleargs['oldincludepats'] = 'csv'
303 getbundleargs['oldincludepats'] = 'csv'
259 getbundleargs['oldexcludepats'] = 'csv'
304 getbundleargs['oldexcludepats'] = 'csv'
@@ -271,6 +316,8 b' def setup():'
271 if (kwargs.get(r'narrow', False) and
316 if (kwargs.get(r'narrow', False) and
272 repo.ui.configbool('experimental', 'narrowservebrokenellipses')):
317 repo.ui.configbool('experimental', 'narrowservebrokenellipses')):
273 getbundlechangegrouppart_narrow(*args, **kwargs)
318 getbundlechangegrouppart_narrow(*args, **kwargs)
319 elif kwargs.get(r'widen', False) and kwargs.get(r'narrow', False):
320 getbundlechangegrouppart_nonellipsis(*args, **kwargs)
274 else:
321 else:
275 origcgfn(*args, **kwargs)
322 origcgfn(*args, **kwargs)
276 exchange.getbundle2partsmapping['changegroup'] = wrappedcgfn
323 exchange.getbundle2partsmapping['changegroup'] = wrappedcgfn
@@ -286,6 +286,7 b' def _widen(ui, repo, remote, commoninc, '
286 # The old{in,ex}cludepats have already been set by orig()
286 # The old{in,ex}cludepats have already been set by orig()
287 kwargs['includepats'] = newincludes
287 kwargs['includepats'] = newincludes
288 kwargs['excludepats'] = newexcludes
288 kwargs['excludepats'] = newexcludes
289 kwargs['widen'] = True
289 wrappedextraprepare = extensions.wrappedfunction(exchange,
290 wrappedextraprepare = extensions.wrappedfunction(exchange,
290 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
291 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
291
292
@@ -89,6 +89,10 b' added upstream revisions.'
89 comparing with ssh://user@dummy/master
89 comparing with ssh://user@dummy/master
90 searching for changes
90 searching for changes
91 no changes found
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 3 local changesets published
96 3 local changesets published
93 $ hg tracked
97 $ hg tracked
94 I path:inside
98 I path:inside
@@ -141,6 +145,10 b' widen the narrow spec to include the wid'
141 comparing with ssh://user@dummy/master
145 comparing with ssh://user@dummy/master
142 searching for changes
146 searching for changes
143 no changes found
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 5 local changesets published
152 5 local changesets published
145 abort: path ends in directory separator: widest/
153 abort: path ends in directory separator: widest/
146 [255]
154 [255]
@@ -247,6 +255,10 b' make narrow clone with every third node.'
247 comparing with ssh://user@dummy/upstream
255 comparing with ssh://user@dummy/upstream
248 searching for changes
256 searching for changes
249 no changes found
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 11 local changesets published
262 11 local changesets published
251 abort: path ends in directory separator: d1/
263 abort: path ends in directory separator: d1/
252 [255]
264 [255]
@@ -274,9 +286,12 b" Verify shouldn't claim the repo is corru"
274 checking changesets
286 checking changesets
275 checking manifests
287 checking manifests
276 checking directory manifests
288 checking directory manifests
289 warning: orphan data file 'meta/d1/00manifest.i'
277 crosschecking files in changesets and manifests
290 crosschecking files in changesets and manifests
278 checking files
291 checking files
292 warning: orphan data file 'data/d1/f.i'
279 4 files, 11 changesets, 4 total revisions
293 4 files, 11 changesets, 4 total revisions
294 2 warnings encountered!
280
295
281 Widening preserves parent of local commit
296 Widening preserves parent of local commit
282
297
@@ -340,6 +355,10 b' Widening that fails can be recovered fro'
340 comparing with ssh://user@dummy/upstream
355 comparing with ssh://user@dummy/upstream
341 searching for changes
356 searching for changes
342 no changes found
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 11 local changesets published
362 11 local changesets published
344 abort: path ends in directory separator: d1/
363 abort: path ends in directory separator: d1/
345 [255]
364 [255]
General Comments 0
You need to be logged in to leave comments. Login now