Show More
@@ -10,9 +10,13 b' from __future__ import absolute_import' | |||||
10 | import re |
|
10 | import re | |
11 | import struct |
|
11 | import struct | |
12 |
|
12 | |||
|
13 | from .thirdparty.zope import ( | |||
|
14 | interface as zi, | |||
|
15 | ) | |||
13 | from . import ( |
|
16 | from . import ( | |
14 | error, |
|
17 | error, | |
15 | mdiff, |
|
18 | mdiff, | |
|
19 | repository, | |||
16 | revlog, |
|
20 | revlog, | |
17 | ) |
|
21 | ) | |
18 |
|
22 | |||
@@ -39,6 +43,7 b' def _censoredtext(text):' | |||||
39 | m, offs = parsemeta(text) |
|
43 | m, offs = parsemeta(text) | |
40 | return m and "censored" in m |
|
44 | return m and "censored" in m | |
41 |
|
45 | |||
|
46 | @zi.implementer(repository.ifilestorage) | |||
42 | class filelog(revlog.revlog): |
|
47 | class filelog(revlog.revlog): | |
43 | def __init__(self, opener, path): |
|
48 | def __init__(self, opener, path): | |
44 | super(filelog, self).__init__(opener, |
|
49 | super(filelog, self).__init__(opener, |
@@ -24,6 +24,9 b' from mercurial.node import (' | |||||
24 | from mercurial.thirdparty import ( |
|
24 | from mercurial.thirdparty import ( | |
25 | cbor, |
|
25 | cbor, | |
26 | ) |
|
26 | ) | |
|
27 | from mercurial.thirdparty.zope import ( | |||
|
28 | interface as zi, | |||
|
29 | ) | |||
27 | from mercurial import ( |
|
30 | from mercurial import ( | |
28 | ancestor, |
|
31 | ancestor, | |
29 | bundlerepo, |
|
32 | bundlerepo, | |
@@ -33,6 +36,7 b' from mercurial import (' | |||||
33 | localrepo, |
|
36 | localrepo, | |
34 | mdiff, |
|
37 | mdiff, | |
35 | pycompat, |
|
38 | pycompat, | |
|
39 | repository, | |||
36 | revlog, |
|
40 | revlog, | |
37 | store, |
|
41 | store, | |
38 | verify, |
|
42 | verify, | |
@@ -57,6 +61,7 b' def validaterev(rev):' | |||||
57 | if not isinstance(rev, int): |
|
61 | if not isinstance(rev, int): | |
58 | raise ValueError('expected int') |
|
62 | raise ValueError('expected int') | |
59 |
|
63 | |||
|
64 | @zi.implementer(repository.ifilestorage) | |||
60 | class filestorage(object): |
|
65 | class filestorage(object): | |
61 | """Implements storage for a tracked path. |
|
66 | """Implements storage for a tracked path. | |
62 |
|
67 |
@@ -12,6 +12,7 b' from mercurial.thirdparty.zope.interface' | |||||
12 | ) |
|
12 | ) | |
13 | from mercurial import ( |
|
13 | from mercurial import ( | |
14 | bundlerepo, |
|
14 | bundlerepo, | |
|
15 | filelog, | |||
15 | httppeer, |
|
16 | httppeer, | |
16 | localrepo, |
|
17 | localrepo, | |
17 | repository, |
|
18 | repository, | |
@@ -19,13 +20,14 b' from mercurial import (' | |||||
19 | statichttprepo, |
|
20 | statichttprepo, | |
20 | ui as uimod, |
|
21 | ui as uimod, | |
21 | unionrepo, |
|
22 | unionrepo, | |
|
23 | vfs as vfsmod, | |||
22 | wireprotoserver, |
|
24 | wireprotoserver, | |
23 | wireprototypes, |
|
25 | wireprototypes, | |
24 | ) |
|
26 | ) | |
25 |
|
27 | |||
26 | rootdir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) |
|
28 | rootdir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) | |
27 |
|
29 | |||
28 | def checkzobject(o): |
|
30 | def checkzobject(o, allowextra=False): | |
29 | """Verify an object with a zope interface.""" |
|
31 | """Verify an object with a zope interface.""" | |
30 | ifaces = zi.providedBy(o) |
|
32 | ifaces = zi.providedBy(o) | |
31 | if not ifaces: |
|
33 | if not ifaces: | |
@@ -37,6 +39,9 b' def checkzobject(o):' | |||||
37 | for iface in ifaces: |
|
39 | for iface in ifaces: | |
38 | ziverify.verifyObject(iface, o) |
|
40 | ziverify.verifyObject(iface, o) | |
39 |
|
41 | |||
|
42 | if allowextra: | |||
|
43 | return | |||
|
44 | ||||
40 | # Now verify that the object provides no extra public attributes that |
|
45 | # Now verify that the object provides no extra public attributes that | |
41 | # aren't declared as part of interfaces. |
|
46 | # aren't declared as part of interfaces. | |
42 | allowed = set() |
|
47 | allowed = set() | |
@@ -132,4 +137,10 b' def main():' | |||||
132 | httpv2 = wireprotoserver.httpv2protocolhandler(None, None) |
|
137 | httpv2 = wireprotoserver.httpv2protocolhandler(None, None) | |
133 | checkzobject(httpv2) |
|
138 | checkzobject(httpv2) | |
134 |
|
139 | |||
|
140 | ziverify.verifyClass(repository.ifilestorage, filelog.filelog) | |||
|
141 | ||||
|
142 | vfs = vfsmod.vfs('.') | |||
|
143 | fl = filelog.filelog(vfs, 'dummy.i') | |||
|
144 | checkzobject(fl, allowextra=True) | |||
|
145 | ||||
135 | main() |
|
146 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now