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