Mercurial > hg
comparison hgext/narrow/__init__.py @ 38835:a232e6744ba3
narrow: move requirement constant from changegroup to repository
As suggested by Gregory Szorc.
Differential Revision: https://phab.mercurial-scm.org/D4094
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 03 Aug 2018 11:02:34 -0700 |
parents | 1cba497491be |
children | 576eef1ab43d |
comparison
equal
deleted
inserted
replaced
38834:c83ad57627ae | 38835:a232e6744ba3 |
---|---|
13 # be specifying the version(s) of Mercurial they are tested with, or | 13 # be specifying the version(s) of Mercurial they are tested with, or |
14 # leave the attribute unspecified. | 14 # leave the attribute unspecified. |
15 testedwith = 'ships-with-hg-core' | 15 testedwith = 'ships-with-hg-core' |
16 | 16 |
17 from mercurial import ( | 17 from mercurial import ( |
18 changegroup, | |
19 extensions, | 18 extensions, |
20 hg, | 19 hg, |
21 localrepo, | 20 localrepo, |
22 registrar, | 21 registrar, |
22 repository, | |
23 verify as verifymod, | 23 verify as verifymod, |
24 ) | 24 ) |
25 | 25 |
26 from . import ( | 26 from . import ( |
27 narrowbundle2, | 27 narrowbundle2, |
53 | 53 |
54 # Export the commands table for Mercurial to see. | 54 # Export the commands table for Mercurial to see. |
55 cmdtable = narrowcommands.table | 55 cmdtable = narrowcommands.table |
56 | 56 |
57 def featuresetup(ui, features): | 57 def featuresetup(ui, features): |
58 features.add(changegroup.NARROW_REQUIREMENT) | 58 features.add(repository.NARROW_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.""" |
62 localrepo.featuresetupfuncs.add(featuresetup) | 62 localrepo.featuresetupfuncs.add(featuresetup) |
63 narrowrevlog.setup() | 63 narrowrevlog.setup() |
69 def reposetup(ui, repo): | 69 def reposetup(ui, repo): |
70 """Wraps local repositories with narrow repo support.""" | 70 """Wraps local repositories with narrow repo support.""" |
71 if not repo.local(): | 71 if not repo.local(): |
72 return | 72 return |
73 | 73 |
74 if changegroup.NARROW_REQUIREMENT in repo.requirements: | 74 if repository.NARROW_REQUIREMENT in repo.requirements: |
75 narrowrepo.wraprepo(repo) | 75 narrowrepo.wraprepo(repo) |
76 narrowcopies.setup(repo) | 76 narrowcopies.setup(repo) |
77 narrowpatch.setup(repo) | 77 narrowpatch.setup(repo) |
78 narrowwirepeer.reposetup(repo) | 78 narrowwirepeer.reposetup(repo) |
79 | 79 |