equal
deleted
inserted
replaced
18 from .i18n import _ |
18 from .i18n import _ |
19 from .node import ( |
19 from .node import ( |
20 hex, |
20 hex, |
21 nullid, |
21 nullid, |
22 short, |
22 short, |
23 ) |
|
24 from .thirdparty.zope import ( |
|
25 interface as zi, |
|
26 ) |
23 ) |
27 from . import ( |
24 from . import ( |
28 bookmarks, |
25 bookmarks, |
29 branchmap, |
26 branchmap, |
30 bundle2, |
27 bundle2, |
66 txnutil, |
63 txnutil, |
67 util, |
64 util, |
68 vfs as vfsmod, |
65 vfs as vfsmod, |
69 ) |
66 ) |
70 from .utils import ( |
67 from .utils import ( |
|
68 interfaceutil, |
71 procutil, |
69 procutil, |
72 stringutil, |
70 stringutil, |
73 ) |
71 ) |
74 |
72 |
75 release = lockmod.release |
73 release = lockmod.release |
151 |
149 |
152 moderncaps = {'lookup', 'branchmap', 'pushkey', 'known', 'getbundle', |
150 moderncaps = {'lookup', 'branchmap', 'pushkey', 'known', 'getbundle', |
153 'unbundle'} |
151 'unbundle'} |
154 legacycaps = moderncaps.union({'changegroupsubset'}) |
152 legacycaps = moderncaps.union({'changegroupsubset'}) |
155 |
153 |
156 @zi.implementer(repository.ipeercommandexecutor) |
154 @interfaceutil.implementer(repository.ipeercommandexecutor) |
157 class localcommandexecutor(object): |
155 class localcommandexecutor(object): |
158 def __init__(self, peer): |
156 def __init__(self, peer): |
159 self._peer = peer |
157 self._peer = peer |
160 self._sent = False |
158 self._sent = False |
161 self._closed = False |
159 self._closed = False |
194 self._sent = True |
192 self._sent = True |
195 |
193 |
196 def close(self): |
194 def close(self): |
197 self._closed = True |
195 self._closed = True |
198 |
196 |
199 @zi.implementer(repository.ipeercommands) |
197 @interfaceutil.implementer(repository.ipeercommands) |
200 class localpeer(repository.peer): |
198 class localpeer(repository.peer): |
201 '''peer for a local repo; reflects only the most recent API''' |
199 '''peer for a local repo; reflects only the most recent API''' |
202 |
200 |
203 def __init__(self, repo, caps=None): |
201 def __init__(self, repo, caps=None): |
204 super(localpeer, self).__init__() |
202 super(localpeer, self).__init__() |
322 def commandexecutor(self): |
320 def commandexecutor(self): |
323 return localcommandexecutor(self) |
321 return localcommandexecutor(self) |
324 |
322 |
325 # End of peer interface. |
323 # End of peer interface. |
326 |
324 |
327 @zi.implementer(repository.ipeerlegacycommands) |
325 @interfaceutil.implementer(repository.ipeerlegacycommands) |
328 class locallegacypeer(localpeer): |
326 class locallegacypeer(localpeer): |
329 '''peer extension which implements legacy methods too; used for tests with |
327 '''peer extension which implements legacy methods too; used for tests with |
330 restricted capabilities''' |
328 restricted capabilities''' |
331 |
329 |
332 def __init__(self, repo): |
330 def __init__(self, repo): |
363 # The function receives a set of requirement strings that the repository |
361 # The function receives a set of requirement strings that the repository |
364 # is capable of opening. Functions will typically add elements to the |
362 # is capable of opening. Functions will typically add elements to the |
365 # set to reflect that the extension knows how to handle that requirements. |
363 # set to reflect that the extension knows how to handle that requirements. |
366 featuresetupfuncs = set() |
364 featuresetupfuncs = set() |
367 |
365 |
368 @zi.implementer(repository.completelocalrepository) |
366 @interfaceutil.implementer(repository.completelocalrepository) |
369 class localrepository(object): |
367 class localrepository(object): |
370 |
368 |
371 # obsolete experimental requirements: |
369 # obsolete experimental requirements: |
372 # - manifestv2: An experimental new manifest format that allowed |
370 # - manifestv2: An experimental new manifest format that allowed |
373 # for stem compression of long paths. Experiment ended up not |
371 # for stem compression of long paths. Experiment ended up not |