Mercurial > hg
comparison hgext/remotefilelog/remotefilelogserver.py @ 40509:ed19958dbf5d
remotefilelog: consolidate and rename bundle2 capability
Bonus: we catch a spot where the shallowrepo requirement was being
misused as the bundle2 capability.
Differential Revision: https://phab.mercurial-scm.org/D5127
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 16 Oct 2018 17:30:47 -0400 |
parents | 354acd0dc637 |
children | fc2766860796 |
comparison
equal
deleted
inserted
replaced
40508:354acd0dc637 | 40509:ed19958dbf5d |
---|---|
43 | 43 |
44 # don't send files to shallow clients during pulls | 44 # don't send files to shallow clients during pulls |
45 def generatefiles(orig, self, changedfiles, linknodes, commonrevs, source, | 45 def generatefiles(orig, self, changedfiles, linknodes, commonrevs, source, |
46 *args, **kwargs): | 46 *args, **kwargs): |
47 caps = self._bundlecaps or [] | 47 caps = self._bundlecaps or [] |
48 if shallowrepo.requirement in caps: | 48 if constants.BUNDLE2_CAPABLITY in caps: |
49 # only send files that don't match the specified patterns | 49 # only send files that don't match the specified patterns |
50 includepattern = None | 50 includepattern = None |
51 excludepattern = None | 51 excludepattern = None |
52 for cap in (self._bundlecaps or []): | 52 for cap in (self._bundlecaps or []): |
53 if cap.startswith("includepattern="): | 53 if cap.startswith("includepattern="): |
182 # We no longer use getbundle_shallow commands, but we must still | 182 # We no longer use getbundle_shallow commands, but we must still |
183 # support it for migration purposes | 183 # support it for migration purposes |
184 def getbundleshallow(repo, proto, others): | 184 def getbundleshallow(repo, proto, others): |
185 bundlecaps = others.get('bundlecaps', '') | 185 bundlecaps = others.get('bundlecaps', '') |
186 bundlecaps = set(bundlecaps.split(',')) | 186 bundlecaps = set(bundlecaps.split(',')) |
187 bundlecaps.add('remotefilelog') | 187 bundlecaps.add(constants.BUNDLE2_CAPABLITY) |
188 others['bundlecaps'] = ','.join(bundlecaps) | 188 others['bundlecaps'] = ','.join(bundlecaps) |
189 | 189 |
190 return wireprotov1server.commands["getbundle"][0](repo, proto, others) | 190 return wireprotov1server.commands["getbundle"][0](repo, proto, others) |
191 | 191 |
192 wireprotov1server.commands["getbundle_shallow"] = (getbundleshallow, '*') | 192 wireprotov1server.commands["getbundle_shallow"] = (getbundleshallow, '*') |