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