D3149: filelog: declare that filelog implements a storage interface
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Sat Apr 7 01:22:47 UTC 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa3202fa83aff: filelog: declare that filelog implements a storage interface (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D3149?vs=7763&id=7847
REVISION DETAIL
https://phab.mercurial-scm.org/D3149
AFFECTED FILES
mercurial/filelog.py
tests/simplestorerepo.py
tests/test-check-interfaces.py
CHANGE DETAILS
diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py
--- a/tests/test-check-interfaces.py
+++ b/tests/test-check-interfaces.py
@@ -12,20 +12,22 @@
)
from mercurial import (
bundlerepo,
+ filelog,
httppeer,
localrepo,
repository,
sshpeer,
statichttprepo,
ui as uimod,
unionrepo,
+ vfs as vfsmod,
wireprotoserver,
wireprototypes,
)
rootdir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
-def checkzobject(o):
+def checkzobject(o, allowextra=False):
"""Verify an object with a zope interface."""
ifaces = zi.providedBy(o)
if not ifaces:
@@ -37,6 +39,9 @@
for iface in ifaces:
ziverify.verifyObject(iface, o)
+ if allowextra:
+ return
+
# Now verify that the object provides no extra public attributes that
# aren't declared as part of interfaces.
allowed = set()
@@ -132,4 +137,10 @@
httpv2 = wireprotoserver.httpv2protocolhandler(None, None)
checkzobject(httpv2)
+ ziverify.verifyClass(repository.ifilestorage, filelog.filelog)
+
+ vfs = vfsmod.vfs('.')
+ fl = filelog.filelog(vfs, 'dummy.i')
+ checkzobject(fl, allowextra=True)
+
main()
diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py
--- a/tests/simplestorerepo.py
+++ b/tests/simplestorerepo.py
@@ -24,6 +24,9 @@
from mercurial.thirdparty import (
cbor,
)
+from mercurial.thirdparty.zope import (
+ interface as zi,
+)
from mercurial import (
ancestor,
bundlerepo,
@@ -33,6 +36,7 @@
localrepo,
mdiff,
pycompat,
+ repository,
revlog,
store,
verify,
@@ -57,6 +61,7 @@
if not isinstance(rev, int):
raise ValueError('expected int')
+ at zi.implementer(repository.ifilestorage)
class filestorage(object):
"""Implements storage for a tracked path.
diff --git a/mercurial/filelog.py b/mercurial/filelog.py
--- a/mercurial/filelog.py
+++ b/mercurial/filelog.py
@@ -10,9 +10,13 @@
import re
import struct
+from .thirdparty.zope import (
+ interface as zi,
+)
from . import (
error,
mdiff,
+ repository,
revlog,
)
@@ -39,6 +43,7 @@
m, offs = parsemeta(text)
return m and "censored" in m
+ at zi.implementer(repository.ifilestorage)
class filelog(revlog.revlog):
def __init__(self, opener, path):
super(filelog, self).__init__(opener,
To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list