Details
Details
- Reviewers
durin42 martinvonz - Group Reviewers
hg-reviewers - Commits
- rHG2003f0bffcb1: narrow: drop unrequired if conditionals
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
durin42 | |
martinvonz |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/narrow/narrowbundle2.py (6 lines) | |||
M | mercurial/exchange.py (10 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Pulkit Goyal | Apr 16 2019, 12:44 PM |
def _handlechangespec_2(op, inpart): | def _handlechangespec_2(op, inpart): | ||||
includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) | includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) | ||||
excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) | excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) | ||||
data = inpart.read() | data = inpart.read() | ||||
# old servers don't send includes and excludes using bundle2 data, they use | # old servers don't send includes and excludes using bundle2 data, they use | ||||
# bundle2 parameters instead. | # bundle2 parameters instead. | ||||
if data: | if data: | ||||
inc, exc = data.split('\0') | inc, exc = data.split('\0') | ||||
if inc: | |||||
includepats |= set(inc.splitlines()) | includepats |= set(inc.splitlines()) | ||||
if exc: | |||||
excludepats |= set(exc.splitlines()) | excludepats |= set(exc.splitlines()) | ||||
narrowspec.validatepatterns(includepats) | narrowspec.validatepatterns(includepats) | ||||
narrowspec.validatepatterns(excludepats) | narrowspec.validatepatterns(excludepats) | ||||
if not repository.NARROW_REQUIREMENT in op.repo.requirements: | if not repository.NARROW_REQUIREMENT in op.repo.requirements: | ||||
op.repo.requirements.add(repository.NARROW_REQUIREMENT) | op.repo.requirements.add(repository.NARROW_REQUIREMENT) | ||||
op.repo._writerequirements() | op.repo._writerequirements() | ||||
op.repo.setnarrowpats(includepats, excludepats) | op.repo.setnarrowpats(includepats, excludepats) | ||||
narrowspec.copytoworkingcopy(op.repo) | narrowspec.copytoworkingcopy(op.repo) |
mandatory=False) | mandatory=False) | ||||
if 'treemanifest' in repo.requirements: | if 'treemanifest' in repo.requirements: | ||||
part.addparam('treemanifest', '1') | part.addparam('treemanifest', '1') | ||||
if (kwargs.get(r'narrow', False) and kwargs.get(r'narrow_acl', False) | if (kwargs.get(r'narrow', False) and kwargs.get(r'narrow_acl', False) | ||||
and (include or exclude)): | and (include or exclude)): | ||||
narrowspecpart = bundler.newpart('narrow:spec') | narrowspecpart = bundler.newpart('narrow:spec') | ||||
data = '' | narrowspecpart.data = '%s\0%s' % ('\n'.join(include), | ||||
if include: | '\n'.join(exclude)) | ||||
data += '\n'.join(include) | |||||
data += '\0' | |||||
if exclude: | |||||
data += '\n'.join(exclude) | |||||
narrowspecpart.data = data | |||||
@getbundle2partsgenerator('bookmarks') | @getbundle2partsgenerator('bookmarks') | ||||
def _getbundlebookmarkpart(bundler, repo, source, bundlecaps=None, | def _getbundlebookmarkpart(bundler, repo, source, bundlecaps=None, | ||||
b2caps=None, **kwargs): | b2caps=None, **kwargs): | ||||
"""add a bookmark part to the requested bundle""" | """add a bookmark part to the requested bundle""" | ||||
if not kwargs.get(r'bookmarks', False): | if not kwargs.get(r'bookmarks', False): | ||||
return | return | ||||
if 'bookmarks' not in b2caps: | if 'bookmarks' not in b2caps: |