131 |
131 |
132 |
132 |
133 def pullnarrowcmd(orig, ui, repo, *args, **opts): |
133 def pullnarrowcmd(orig, ui, repo, *args, **opts): |
134 """Wraps pull command to allow modifying narrow spec.""" |
134 """Wraps pull command to allow modifying narrow spec.""" |
135 wrappedextraprepare = util.nullcontextmanager() |
135 wrappedextraprepare = util.nullcontextmanager() |
136 if repository.NARROW_REQUIREMENT in repo.requirements: |
136 if requirements.NARROW_REQUIREMENT in repo.requirements: |
137 |
137 |
138 def pullbundle2extraprepare_widen(orig, pullop, kwargs): |
138 def pullbundle2extraprepare_widen(orig, pullop, kwargs): |
139 orig(pullop, kwargs) |
139 orig(pullop, kwargs) |
140 if opts.get('depth'): |
140 if opts.get('depth'): |
141 kwargs[b'depth'] = opts['depth'] |
141 kwargs[b'depth'] = opts['depth'] |
148 return orig(ui, repo, *args, **opts) |
148 return orig(ui, repo, *args, **opts) |
149 |
149 |
150 |
150 |
151 def archivenarrowcmd(orig, ui, repo, *args, **opts): |
151 def archivenarrowcmd(orig, ui, repo, *args, **opts): |
152 """Wraps archive command to narrow the default includes.""" |
152 """Wraps archive command to narrow the default includes.""" |
153 if repository.NARROW_REQUIREMENT in repo.requirements: |
153 if requirements.NARROW_REQUIREMENT in repo.requirements: |
154 repo_includes, repo_excludes = repo.narrowpats |
154 repo_includes, repo_excludes = repo.narrowpats |
155 includes = set(opts.get('include', [])) |
155 includes = set(opts.get('include', [])) |
156 excludes = set(opts.get('exclude', [])) |
156 excludes = set(opts.get('exclude', [])) |
157 includes, excludes, unused_invalid = narrowspec.restrictpatterns( |
157 includes, excludes, unused_invalid = narrowspec.restrictpatterns( |
158 includes, excludes, repo_includes, repo_excludes |
158 includes, excludes, repo_includes, repo_excludes |
164 return orig(ui, repo, *args, **opts) |
164 return orig(ui, repo, *args, **opts) |
165 |
165 |
166 |
166 |
167 def pullbundle2extraprepare(orig, pullop, kwargs): |
167 def pullbundle2extraprepare(orig, pullop, kwargs): |
168 repo = pullop.repo |
168 repo = pullop.repo |
169 if repository.NARROW_REQUIREMENT not in repo.requirements: |
169 if requirements.NARROW_REQUIREMENT not in repo.requirements: |
170 return orig(pullop, kwargs) |
170 return orig(pullop, kwargs) |
171 |
171 |
172 if wireprototypes.NARROWCAP not in pullop.remote.capabilities(): |
172 if wireprototypes.NARROWCAP not in pullop.remote.capabilities(): |
173 raise error.Abort(_(b"server does not support narrow clones")) |
173 raise error.Abort(_(b"server does not support narrow clones")) |
174 orig(pullop, kwargs) |
174 orig(pullop, kwargs) |
480 --import-rules accepts a path to a file containing rules, allowing you to |
480 --import-rules accepts a path to a file containing rules, allowing you to |
481 add --addinclude, --addexclude rules in bulk. Like the other include and |
481 add --addinclude, --addexclude rules in bulk. Like the other include and |
482 exclude switches, the changes are applied immediately. |
482 exclude switches, the changes are applied immediately. |
483 """ |
483 """ |
484 opts = pycompat.byteskwargs(opts) |
484 opts = pycompat.byteskwargs(opts) |
485 if repository.NARROW_REQUIREMENT not in repo.requirements: |
485 if requirements.NARROW_REQUIREMENT not in repo.requirements: |
486 raise error.Abort( |
486 raise error.Abort( |
487 _( |
487 _( |
488 b'the tracked command is only supported on ' |
488 b'the tracked command is only supported on ' |
489 b'repositories cloned with --narrow' |
489 b'repositories cloned with --narrow' |
490 ) |
490 ) |