Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG4a7ba3ac9163: narrowcommands: use pycompat.{bytes,str}kwargs
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
commands, | commands, | ||||
discovery, | discovery, | ||||
error, | error, | ||||
exchange, | exchange, | ||||
extensions, | extensions, | ||||
hg, | hg, | ||||
merge, | merge, | ||||
node, | node, | ||||
pycompat, | |||||
registrar, | registrar, | ||||
repair, | repair, | ||||
repoview, | repoview, | ||||
util, | util, | ||||
) | ) | ||||
from . import ( | from . import ( | ||||
narrowbundle2, | narrowbundle2, | ||||
includepats, excludepats = pullop.remote.expandnarrow( | includepats, excludepats = pullop.remote.expandnarrow( | ||||
includepats, excludepats, heads) | includepats, excludepats, heads) | ||||
pullop.repo.ui.debug('Expanded narrowspec to inc=%s, exc=%s\n' % ( | pullop.repo.ui.debug('Expanded narrowspec to inc=%s, exc=%s\n' % ( | ||||
includepats, excludepats)) | includepats, excludepats)) | ||||
return set(includepats), set(excludepats) | return set(includepats), set(excludepats) | ||||
def clonenarrowcmd(orig, ui, repo, *args, **opts): | def clonenarrowcmd(orig, ui, repo, *args, **opts): | ||||
"""Wraps clone command, so 'hg clone' first wraps localrepo.clone().""" | """Wraps clone command, so 'hg clone' first wraps localrepo.clone().""" | ||||
opts = pycompat.byteskwargs(opts) | |||||
wrappedextraprepare = util.nullcontextmanager() | wrappedextraprepare = util.nullcontextmanager() | ||||
opts_narrow = opts['narrow'] | opts_narrow = opts['narrow'] | ||||
if opts_narrow: | if opts_narrow: | ||||
def pullbundle2extraprepare_widen(orig, pullop, kwargs): | def pullbundle2extraprepare_widen(orig, pullop, kwargs): | ||||
# Create narrow spec patterns from clone flags | # Create narrow spec patterns from clone flags | ||||
includepats = narrowspec.parsepatterns(opts['include']) | includepats = narrowspec.parsepatterns(opts['include']) | ||||
excludepats = narrowspec.parsepatterns(opts['exclude']) | excludepats = narrowspec.parsepatterns(opts['exclude']) | ||||
repo.requirements.add(narrowrepo.REQUIREMENT) | repo.requirements.add(narrowrepo.REQUIREMENT) | ||||
repo._writerequirements() | repo._writerequirements() | ||||
return orig(repo, *args, **kwargs) | return orig(repo, *args, **kwargs) | ||||
wrappedpull = extensions.wrappedfunction(exchange, 'pull', pullnarrow) | wrappedpull = extensions.wrappedfunction(exchange, 'pull', pullnarrow) | ||||
with wrappedextraprepare, wrappedpull: | with wrappedextraprepare, wrappedpull: | ||||
return orig(ui, repo, *args, **opts) | return orig(ui, repo, *args, **pycompat.strkwargs(opts)) | ||||
def pullnarrowcmd(orig, ui, repo, *args, **opts): | def pullnarrowcmd(orig, ui, repo, *args, **opts): | ||||
"""Wraps pull command to allow modifying narrow spec.""" | """Wraps pull command to allow modifying narrow spec.""" | ||||
wrappedextraprepare = util.nullcontextmanager() | wrappedextraprepare = util.nullcontextmanager() | ||||
if narrowrepo.REQUIREMENT in repo.requirements: | if narrowrepo.REQUIREMENT in repo.requirements: | ||||
def pullbundle2extraprepare_widen(orig, pullop, kwargs): | def pullbundle2extraprepare_widen(orig, pullop, kwargs): | ||||
orig(pullop, kwargs) | orig(pullop, kwargs) |