Show More
@@ -55,7 +55,7 b" configitem('experimental', 'narrowserveb" | |||||
55 | # Export the commands table for Mercurial to see. |
|
55 | # Export the commands table for Mercurial to see. | |
56 | cmdtable = narrowcommands.table |
|
56 | cmdtable = narrowcommands.table | |
57 |
|
57 | |||
58 |
localrepo.localrepository._basesupported.add(narrowrepo. |
|
58 | localrepo.localrepository._basesupported.add(narrowrepo.REQUIREMENT) | |
59 |
|
59 | |||
60 | def uisetup(ui): |
|
60 | def uisetup(ui): | |
61 | """Wraps user-facing mercurial commands with narrow-aware versions.""" |
|
61 | """Wraps user-facing mercurial commands with narrow-aware versions.""" | |
@@ -72,7 +72,7 b' def reposetup(ui, repo):' | |||||
72 | if not isinstance(repo, localrepo.localrepository): |
|
72 | if not isinstance(repo, localrepo.localrepository): | |
73 | return |
|
73 | return | |
74 |
|
74 | |||
75 |
if narrowrepo. |
|
75 | if narrowrepo.REQUIREMENT in repo.requirements: | |
76 | narrowrepo.wraprepo(repo, True) |
|
76 | narrowrepo.wraprepo(repo, True) | |
77 | narrowcopies.setup(repo) |
|
77 | narrowcopies.setup(repo) | |
78 | narrowdirstate.setup(repo) |
|
78 | narrowdirstate.setup(repo) |
@@ -368,8 +368,8 b' def _handlechangespec_2(op, inpart):' | |||||
368 | includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) |
|
368 | includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) | |
369 | excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) |
|
369 | excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) | |
370 | narrowspec.save(op.repo, includepats, excludepats) |
|
370 | narrowspec.save(op.repo, includepats, excludepats) | |
371 |
if not narrowrepo. |
|
371 | if not narrowrepo.REQUIREMENT in op.repo.requirements: | |
372 |
op.repo.requirements.add(narrowrepo. |
|
372 | op.repo.requirements.add(narrowrepo.REQUIREMENT) | |
373 | op.repo._writerequirements() |
|
373 | op.repo._writerequirements() | |
374 | op.repo.invalidate(clearfilecache=True) |
|
374 | op.repo.invalidate(clearfilecache=True) | |
375 |
|
375 |
@@ -27,7 +27,7 b' def setup():' | |||||
27 |
|
27 | |||
28 | def supportedoutgoingversions(orig, repo): |
|
28 | def supportedoutgoingversions(orig, repo): | |
29 | versions = orig(repo) |
|
29 | versions = orig(repo) | |
30 |
if narrowrepo. |
|
30 | if narrowrepo.REQUIREMENT in repo.requirements: | |
31 | versions.discard('01') |
|
31 | versions.discard('01') | |
32 | versions.discard('02') |
|
32 | versions.discard('02') | |
33 | return versions |
|
33 | return versions |
@@ -103,7 +103,7 b' def clonenarrowcmd(orig, ui, repo, *args' | |||||
103 | repo.__class__.__bases__ = (repo.__class__.__bases__[0], |
|
103 | repo.__class__.__bases__ = (repo.__class__.__bases__[0], | |
104 | repo.unfiltered().__class__) |
|
104 | repo.unfiltered().__class__) | |
105 | if opts_narrow: |
|
105 | if opts_narrow: | |
106 |
repo.requirements.add(narrowrepo. |
|
106 | repo.requirements.add(narrowrepo.REQUIREMENT) | |
107 | repo._writerequirements() |
|
107 | repo._writerequirements() | |
108 |
|
108 | |||
109 | return orig(repo, *args, **kwargs) |
|
109 | return orig(repo, *args, **kwargs) | |
@@ -116,7 +116,7 b' def clonenarrowcmd(orig, ui, repo, *args' | |||||
116 | def pullnarrowcmd(orig, ui, repo, *args, **opts): |
|
116 | def pullnarrowcmd(orig, ui, repo, *args, **opts): | |
117 | """Wraps pull command to allow modifying narrow spec.""" |
|
117 | """Wraps pull command to allow modifying narrow spec.""" | |
118 | wrappedextraprepare = util.nullcontextmanager() |
|
118 | wrappedextraprepare = util.nullcontextmanager() | |
119 |
if narrowrepo. |
|
119 | if narrowrepo.REQUIREMENT in repo.requirements: | |
120 |
|
120 | |||
121 | def pullbundle2extraprepare_widen(orig, pullop, kwargs): |
|
121 | def pullbundle2extraprepare_widen(orig, pullop, kwargs): | |
122 | orig(pullop, kwargs) |
|
122 | orig(pullop, kwargs) | |
@@ -130,7 +130,7 b' def pullnarrowcmd(orig, ui, repo, *args,' | |||||
130 |
|
130 | |||
131 | def archivenarrowcmd(orig, ui, repo, *args, **opts): |
|
131 | def archivenarrowcmd(orig, ui, repo, *args, **opts): | |
132 | """Wraps archive command to narrow the default includes.""" |
|
132 | """Wraps archive command to narrow the default includes.""" | |
133 |
if narrowrepo. |
|
133 | if narrowrepo.REQUIREMENT in repo.requirements: | |
134 | repo_includes, repo_excludes = repo.narrowpats |
|
134 | repo_includes, repo_excludes = repo.narrowpats | |
135 | includes = set(opts.get('include', [])) |
|
135 | includes = set(opts.get('include', [])) | |
136 | excludes = set(opts.get('exclude', [])) |
|
136 | excludes = set(opts.get('exclude', [])) | |
@@ -144,7 +144,7 b' def archivenarrowcmd(orig, ui, repo, *ar' | |||||
144 |
|
144 | |||
145 | def pullbundle2extraprepare(orig, pullop, kwargs): |
|
145 | def pullbundle2extraprepare(orig, pullop, kwargs): | |
146 | repo = pullop.repo |
|
146 | repo = pullop.repo | |
147 |
if narrowrepo. |
|
147 | if narrowrepo.REQUIREMENT not in repo.requirements: | |
148 | return orig(pullop, kwargs) |
|
148 | return orig(pullop, kwargs) | |
149 |
|
149 | |||
150 | if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps: |
|
150 | if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps: | |
@@ -330,7 +330,7 b' def trackedcmd(ui, repo, remotepath=None' | |||||
330 | If --clear is specified without any further options, the narrowspec will be |
|
330 | If --clear is specified without any further options, the narrowspec will be | |
331 | empty and will not match any files. |
|
331 | empty and will not match any files. | |
332 | """ |
|
332 | """ | |
333 |
if narrowrepo. |
|
333 | if narrowrepo.REQUIREMENT not in repo.requirements: | |
334 | ui.warn(_('The narrow command is only supported on respositories cloned' |
|
334 | ui.warn(_('The narrow command is only supported on respositories cloned' | |
335 | ' with --narrow.\n')) |
|
335 | ' with --narrow.\n')) | |
336 | return 1 |
|
336 | return 1 |
@@ -23,17 +23,17 b' from . import (' | |||||
23 | narrowspec, |
|
23 | narrowspec, | |
24 | ) |
|
24 | ) | |
25 |
|
25 | |||
26 | requirement = 'narrowhg' |
|
26 | REQUIREMENT = 'narrowhg' | |
27 |
|
27 | |||
28 | def wrappostshare(orig, sourcerepo, destrepo, **kwargs): |
|
28 | def wrappostshare(orig, sourcerepo, destrepo, **kwargs): | |
29 | orig(sourcerepo, destrepo, **kwargs) |
|
29 | orig(sourcerepo, destrepo, **kwargs) | |
30 |
if |
|
30 | if REQUIREMENT in sourcerepo.requirements: | |
31 | with destrepo.wlock(): |
|
31 | with destrepo.wlock(): | |
32 | with destrepo.vfs('shared', 'a') as fp: |
|
32 | with destrepo.vfs('shared', 'a') as fp: | |
33 | fp.write(narrowspec.FILENAME + '\n') |
|
33 | fp.write(narrowspec.FILENAME + '\n') | |
34 |
|
34 | |||
35 | def unsharenarrowspec(orig, ui, repo, repopath): |
|
35 | def unsharenarrowspec(orig, ui, repo, repopath): | |
36 |
if ( |
|
36 | if (REQUIREMENT in repo.requirements | |
37 | and repo.path == repopath and repo.shared()): |
|
37 | and repo.path == repopath and repo.shared()): | |
38 | srcrepo = share._getsrcrepo(repo) |
|
38 | srcrepo = share._getsrcrepo(repo) | |
39 | with srcrepo.vfs(narrowspec.FILENAME) as f: |
|
39 | with srcrepo.vfs(narrowspec.FILENAME) as f: |
General Comments 0
You need to be logged in to leave comments.
Login now