Mercurial > public > mercurial-scm > hg
comparison tests/simplestorerepo.py @ 37441:a3202fa83aff
filelog: declare that filelog implements a storage interface
Now that we have a declared interface, let's declare that filelog
implements it.
Tests have been added that confirm the object conforms to the
interface.
The existing interface checks verify there are no extra public
attributes outside the declared interface. filelog has several
extra attributes. So we added a mechanism to suppress this check.
The goal is to modify the filelog class so we can drop this check.
Differential Revision: https://phab.mercurial-scm.org/D3149
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 05 Apr 2018 15:18:23 -0700 |
parents | 9d4f09bfe3ec |
children | 0596d27457c6 |
comparison
equal
deleted
inserted
replaced
37440:4335a75f0bd0 | 37441:a3202fa83aff |
---|---|
22 nullrev, | 22 nullrev, |
23 ) | 23 ) |
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, |
30 error, | 33 error, |
31 extensions, | 34 extensions, |
32 filelog, | 35 filelog, |
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, |
39 ) | 43 ) |
40 | 44 |
55 | 59 |
56 def validaterev(rev): | 60 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 |
63 Data is stored in the VFS in a directory corresponding to the tracked | 68 Data is stored in the VFS in a directory corresponding to the tracked |
64 path. | 69 path. |