Show More
@@ -31,8 +31,9 b' from mercurial.utils import (' | |||
|
31 | 31 | stringutil, |
|
32 | 32 | ) |
|
33 | 33 | |
|
34 |
_NARROWACL_SECTION = 'narrow |
|
|
34 | _NARROWACL_SECTION = 'narrowacl' | |
|
35 | 35 | _CHANGESPECPART = 'narrow:changespec' |
|
36 | _RESSPECS = 'narrow:responsespec' | |
|
36 | 37 | _SPECPART = 'narrow:spec' |
|
37 | 38 | _SPECPART_INCLUDE = 'include' |
|
38 | 39 | _SPECPART_EXCLUDE = 'exclude' |
@@ -142,6 +143,10 b' def getbundlechangegrouppart_narrow(bund' | |||
|
142 | 143 | |
|
143 | 144 | @bundle2.parthandler(_SPECPART, (_SPECPART_INCLUDE, _SPECPART_EXCLUDE)) |
|
144 | 145 | def _handlechangespec_2(op, inpart): |
|
146 | # XXX: This bundle2 handling is buggy and should be removed after hg5.2 is | |
|
147 | # released. New servers will send a mandatory bundle2 part named | |
|
148 | # 'Narrowspec' and will send specs as data instead of params. | |
|
149 | # Refer to issue5952 and 6019 | |
|
145 | 150 | includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) |
|
146 | 151 | excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) |
|
147 | 152 | narrowspec.validatepatterns(includepats) |
@@ -153,6 +158,21 b' def _handlechangespec_2(op, inpart):' | |||
|
153 | 158 | op.repo.setnarrowpats(includepats, excludepats) |
|
154 | 159 | narrowspec.copytoworkingcopy(op.repo) |
|
155 | 160 | |
|
161 | @bundle2.parthandler(_RESSPECS) | |
|
162 | def _handlenarrowspecs(op, inpart): | |
|
163 | data = inpart.read() | |
|
164 | inc, exc = data.split('\0') | |
|
165 | includepats = set(inc.splitlines()) | |
|
166 | excludepats = set(exc.splitlines()) | |
|
167 | narrowspec.validatepatterns(includepats) | |
|
168 | narrowspec.validatepatterns(excludepats) | |
|
169 | ||
|
170 | if repository.NARROW_REQUIREMENT not in op.repo.requirements: | |
|
171 | op.repo.requirements.add(repository.NARROW_REQUIREMENT) | |
|
172 | op.repo._writerequirements() | |
|
173 | op.repo.setnarrowpats(includepats, excludepats) | |
|
174 | narrowspec.copytoworkingcopy(op.repo) | |
|
175 | ||
|
156 | 176 | @bundle2.parthandler(_CHANGESPECPART) |
|
157 | 177 | def _handlechangespec(op, inpart): |
|
158 | 178 | repo = op.repo |
@@ -49,7 +49,7 b' from .utils import (' | |||
|
49 | 49 | urlerr = util.urlerr |
|
50 | 50 | urlreq = util.urlreq |
|
51 | 51 | |
|
52 |
_NARROWACL_SECTION = 'narrow |
|
|
52 | _NARROWACL_SECTION = 'narrowacl' | |
|
53 | 53 | |
|
54 | 54 | # Maps bundle version human names to changegroup versions. |
|
55 | 55 | _bundlespeccgversions = {'v1': '01', |
@@ -2213,13 +2213,10 b' def _getbundlechangegrouppart(bundler, r' | |||
|
2213 | 2213 | |
|
2214 | 2214 | if (kwargs.get(r'narrow', False) and kwargs.get(r'narrow_acl', False) |
|
2215 | 2215 | and (include or exclude)): |
|
2216 | narrowspecpart = bundler.newpart('narrow:spec') | |
|
2217 | if include: | |
|
2218 | narrowspecpart.addparam( | |
|
2219 | 'include', '\n'.join(include), mandatory=True) | |
|
2220 | if exclude: | |
|
2221 | narrowspecpart.addparam( | |
|
2222 | 'exclude', '\n'.join(exclude), mandatory=True) | |
|
2216 | # this is mandatory because otherwise ACL clients won't work | |
|
2217 | narrowspecpart = bundler.newpart('Narrow:responsespec') | |
|
2218 | narrowspecpart.data = '%s\0%s' % ('\n'.join(include), | |
|
2219 | '\n'.join(exclude)) | |
|
2223 | 2220 | |
|
2224 | 2221 | @getbundle2partsgenerator('bookmarks') |
|
2225 | 2222 | def _getbundlebookmarkpart(bundler, repo, source, bundlecaps=None, |
General Comments 0
You need to be logged in to leave comments.
Login now