Mercurial > hg
annotate tests/test-check-interfaces.py @ 39230:b518d495a560
repository: formalize interfaces for revision deltas and requests
Now that we've sufficiently abstracted how revision deltas are
produced in changegroup code, we can now start the process of
formalizing that as part of the interfaces defined in the
repository module.
This commit essentially converts the revisiondelta and
revisiondeltarequest classes into well-defined interfaces. This
is not strictly necessary. But I want all types formalized by the
storage interface to have interfaces. This makes it much easier
to test for interface conformance and for implementing new
storage backends.
Because the interface is documented, comments and docstrings from
changegroup.py have been dropped.
Differential Revision: https://phab.mercurial-scm.org/D4225
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 09 Aug 2018 15:40:14 -0700 |
parents | c82ea938efbb |
children | b41d023a412a |
rev | line source |
---|---|
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 # Test that certain objects conform to well-defined interfaces. |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 from __future__ import absolute_import, print_function |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
37810
856f381ad74b
interfaceutil: module to stub out zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37635
diff
changeset
|
5 from mercurial import encoding |
856f381ad74b
interfaceutil: module to stub out zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37635
diff
changeset
|
6 encoding.environ[b'HGREALINTERFACES'] = b'1' |
856f381ad74b
interfaceutil: module to stub out zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37635
diff
changeset
|
7 |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
8 import os |
37814
265c122b69aa
tests: mark test-check-interfaces.py as requiring a repo
Martin von Zweigbergk <martinvonz@google.com>
parents:
37810
diff
changeset
|
9 import subprocess |
265c122b69aa
tests: mark test-check-interfaces.py as requiring a repo
Martin von Zweigbergk <martinvonz@google.com>
parents:
37810
diff
changeset
|
10 import sys |
265c122b69aa
tests: mark test-check-interfaces.py as requiring a repo
Martin von Zweigbergk <martinvonz@google.com>
parents:
37810
diff
changeset
|
11 |
265c122b69aa
tests: mark test-check-interfaces.py as requiring a repo
Martin von Zweigbergk <martinvonz@google.com>
parents:
37810
diff
changeset
|
12 # Only run if tests are run in a repo |
265c122b69aa
tests: mark test-check-interfaces.py as requiring a repo
Martin von Zweigbergk <martinvonz@google.com>
parents:
37810
diff
changeset
|
13 if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], |
265c122b69aa
tests: mark test-check-interfaces.py as requiring a repo
Martin von Zweigbergk <martinvonz@google.com>
parents:
37810
diff
changeset
|
14 'test-repo']): |
265c122b69aa
tests: mark test-check-interfaces.py as requiring a repo
Martin von Zweigbergk <martinvonz@google.com>
parents:
37810
diff
changeset
|
15 sys.exit(80) |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
16 |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
17 from mercurial.thirdparty.zope import ( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
18 interface as zi, |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
19 ) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
20 from mercurial.thirdparty.zope.interface import ( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
21 verify as ziverify, |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
22 ) |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 from mercurial import ( |
39230
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
24 changegroup, |
34307
afcbc6f64d27
tests: add interface checks for bundle, statichttp, and union peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33807
diff
changeset
|
25 bundlerepo, |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
26 filelog, |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 httppeer, |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 localrepo, |
38530
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
29 manifest, |
37870
39c17718f311
tests: make test-check-interfaces.py work on Python 3
Augie Fackler <augie@google.com>
parents:
37814
diff
changeset
|
30 pycompat, |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
31 repository, |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 sshpeer, |
34307
afcbc6f64d27
tests: add interface checks for bundle, statichttp, and union peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33807
diff
changeset
|
33 statichttprepo, |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 ui as uimod, |
34307
afcbc6f64d27
tests: add interface checks for bundle, statichttp, and union peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33807
diff
changeset
|
35 unionrepo, |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
36 vfs as vfsmod, |
37296
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
37 wireprotoserver, |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
38 wireprototypes, |
37630
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
39 wireprotov1peer, |
37545
93397c4633f6
wireproto: extract HTTP version 2 code to own module
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37441
diff
changeset
|
40 wireprotov2server, |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 ) |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 |
37870
39c17718f311
tests: make test-check-interfaces.py work on Python 3
Augie Fackler <augie@google.com>
parents:
37814
diff
changeset
|
43 rootdir = pycompat.fsencode( |
39c17718f311
tests: make test-check-interfaces.py work on Python 3
Augie Fackler <augie@google.com>
parents:
37814
diff
changeset
|
44 os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))) |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
45 |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
46 def checkzobject(o, allowextra=False): |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
47 """Verify an object with a zope interface.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
48 ifaces = zi.providedBy(o) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
49 if not ifaces: |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
50 print('%r does not provide any zope interfaces' % o) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
51 return |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
52 |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
53 # Run zope.interface's built-in verification routine. This verifies that |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
54 # everything that is supposed to be present is present. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
55 for iface in ifaces: |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
56 ziverify.verifyObject(iface, o) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
57 |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
58 if allowextra: |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
59 return |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
60 |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
61 # Now verify that the object provides no extra public attributes that |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
62 # aren't declared as part of interfaces. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
63 allowed = set() |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
64 for iface in ifaces: |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
65 allowed |= set(iface.names(all=True)) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
66 |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
67 public = {a for a in dir(o) if not a.startswith('_')} |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
68 |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
69 for attr in sorted(public - allowed): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
70 print('public attribute not declared in interfaces: %s.%s' % ( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
71 o.__class__.__name__, attr)) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
72 |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 # Facilitates testing localpeer. |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 class dummyrepo(object): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
75 def __init__(self): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 self.ui = uimod.ui() |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 def filtered(self, name): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 pass |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 def _restrictcapabilities(self, caps): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 pass |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
81 |
37006
8e89c2bec1f7
httppeer: refactor how httppeer is created (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36370
diff
changeset
|
82 class dummyopener(object): |
8e89c2bec1f7
httppeer: refactor how httppeer is created (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36370
diff
changeset
|
83 handlers = [] |
8e89c2bec1f7
httppeer: refactor how httppeer is created (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36370
diff
changeset
|
84 |
37552
8b8a845c85fc
httppeer: perform capabilities request in makepeer()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37547
diff
changeset
|
85 # Facilitates testing sshpeer without requiring a server. |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 class badpeer(httppeer.httppeer): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
87 def __init__(self): |
37552
8b8a845c85fc
httppeer: perform capabilities request in makepeer()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37547
diff
changeset
|
88 super(badpeer, self).__init__(None, None, None, dummyopener(), None, |
8b8a845c85fc
httppeer: perform capabilities request in makepeer()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37547
diff
changeset
|
89 None) |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
90 self.badattribute = True |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
91 |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 def badmethod(self): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 pass |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
94 |
36370
11ba1a96f946
sshpeer: defer pipe buffering and stderr sidechannel binding
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35978
diff
changeset
|
95 class dummypipe(object): |
11ba1a96f946
sshpeer: defer pipe buffering and stderr sidechannel binding
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35978
diff
changeset
|
96 def close(self): |
11ba1a96f946
sshpeer: defer pipe buffering and stderr sidechannel binding
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35978
diff
changeset
|
97 pass |
11ba1a96f946
sshpeer: defer pipe buffering and stderr sidechannel binding
Gregory Szorc <gregory.szorc@gmail.com>
parents:
35978
diff
changeset
|
98 |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
99 def main(): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
100 ui = uimod.ui() |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
101 # Needed so we can open a local repo with obsstore without a warning. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
102 ui.setconfig('experimental', 'evolution.createmarkers', True) |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
103 |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
104 checkzobject(badpeer()) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
105 |
37635
cc8c06835097
wireproto: convert legacy commands to command executor
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37630
diff
changeset
|
106 ziverify.verifyClass(repository.ipeerbase, httppeer.httppeer) |
37552
8b8a845c85fc
httppeer: perform capabilities request in makepeer()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37547
diff
changeset
|
107 checkzobject(httppeer.httppeer(None, None, None, dummyopener(), None, None)) |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
108 |
37609
01bfe5ad0c53
httppeer: implement ipeerconnection
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37552
diff
changeset
|
109 ziverify.verifyClass(repository.ipeerconnection, |
01bfe5ad0c53
httppeer: implement ipeerconnection
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37552
diff
changeset
|
110 httppeer.httpv2peer) |
37611
ae8730877371
httppeer: basic implementation of capabilities interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37609
diff
changeset
|
111 ziverify.verifyClass(repository.ipeercapabilities, |
ae8730877371
httppeer: basic implementation of capabilities interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37609
diff
changeset
|
112 httppeer.httpv2peer) |
37870
39c17718f311
tests: make test-check-interfaces.py work on Python 3
Augie Fackler <augie@google.com>
parents:
37814
diff
changeset
|
113 checkzobject(httppeer.httpv2peer(None, b'', b'', None, None, None)) |
37609
01bfe5ad0c53
httppeer: implement ipeerconnection
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37552
diff
changeset
|
114 |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
115 ziverify.verifyClass(repository.ipeerbase, |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
116 localrepo.localpeer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
117 checkzobject(localrepo.localpeer(dummyrepo())) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
118 |
37630
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
119 ziverify.verifyClass(repository.ipeercommandexecutor, |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
120 localrepo.localcommandexecutor) |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
121 checkzobject(localrepo.localcommandexecutor(None)) |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
122 |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
123 ziverify.verifyClass(repository.ipeercommandexecutor, |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
124 wireprotov1peer.peerexecutor) |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
125 checkzobject(wireprotov1peer.peerexecutor(None)) |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
126 |
37635
cc8c06835097
wireproto: convert legacy commands to command executor
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37630
diff
changeset
|
127 ziverify.verifyClass(repository.ipeerbase, sshpeer.sshv1peer) |
37870
39c17718f311
tests: make test-check-interfaces.py work on Python 3
Augie Fackler <augie@google.com>
parents:
37814
diff
changeset
|
128 checkzobject(sshpeer.sshv1peer(ui, b'ssh://localhost/foo', b'', dummypipe(), |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
129 dummypipe(), None, None)) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
130 |
37635
cc8c06835097
wireproto: convert legacy commands to command executor
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37630
diff
changeset
|
131 ziverify.verifyClass(repository.ipeerbase, sshpeer.sshv2peer) |
37870
39c17718f311
tests: make test-check-interfaces.py work on Python 3
Augie Fackler <augie@google.com>
parents:
37814
diff
changeset
|
132 checkzobject(sshpeer.sshv2peer(ui, b'ssh://localhost/foo', b'', dummypipe(), |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
133 dummypipe(), None, None)) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
134 |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
135 ziverify.verifyClass(repository.ipeerbase, bundlerepo.bundlepeer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
136 checkzobject(bundlerepo.bundlepeer(dummyrepo())) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
137 |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
138 ziverify.verifyClass(repository.ipeerbase, statichttprepo.statichttppeer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
139 checkzobject(statichttprepo.statichttppeer(dummyrepo())) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
140 |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
141 ziverify.verifyClass(repository.ipeerbase, unionrepo.unionpeer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
142 checkzobject(unionrepo.unionpeer(dummyrepo())) |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
143 |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
144 ziverify.verifyClass(repository.completelocalrepository, |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
145 localrepo.localrepository) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
146 repo = localrepo.localrepository(ui, rootdir) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
147 checkzobject(repo) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37006
diff
changeset
|
148 |
37296
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
149 ziverify.verifyClass(wireprototypes.baseprotocolhandler, |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
150 wireprotoserver.sshv1protocolhandler) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
151 ziverify.verifyClass(wireprototypes.baseprotocolhandler, |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
152 wireprotoserver.sshv2protocolhandler) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
153 ziverify.verifyClass(wireprototypes.baseprotocolhandler, |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
154 wireprotoserver.httpv1protocolhandler) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
155 ziverify.verifyClass(wireprototypes.baseprotocolhandler, |
37545
93397c4633f6
wireproto: extract HTTP version 2 code to own module
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37441
diff
changeset
|
156 wireprotov2server.httpv2protocolhandler) |
37296
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
157 |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
158 sshv1 = wireprotoserver.sshv1protocolhandler(None, None, None) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
159 checkzobject(sshv1) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
160 sshv2 = wireprotoserver.sshv2protocolhandler(None, None, None) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
161 checkzobject(sshv2) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
162 |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
163 httpv1 = wireprotoserver.httpv1protocolhandler(None, None, None) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
164 checkzobject(httpv1) |
37545
93397c4633f6
wireproto: extract HTTP version 2 code to own module
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37441
diff
changeset
|
165 httpv2 = wireprotov2server.httpv2protocolhandler(None, None) |
37296
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
166 checkzobject(httpv2) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37181
diff
changeset
|
167 |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
168 ziverify.verifyClass(repository.ifilestorage, filelog.filelog) |
38530
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
169 ziverify.verifyClass(repository.imanifestdict, manifest.manifestdict) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
170 ziverify.verifyClass(repository.imanifestrevisionstored, |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
171 manifest.manifestctx) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
172 ziverify.verifyClass(repository.imanifestrevisionwritable, |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
173 manifest.memmanifestctx) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
174 ziverify.verifyClass(repository.imanifestrevisionstored, |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
175 manifest.treemanifestctx) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
176 ziverify.verifyClass(repository.imanifestrevisionwritable, |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
177 manifest.memtreemanifestctx) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
178 ziverify.verifyClass(repository.imanifestlog, manifest.manifestlog) |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
179 |
37870
39c17718f311
tests: make test-check-interfaces.py work on Python 3
Augie Fackler <augie@google.com>
parents:
37814
diff
changeset
|
180 vfs = vfsmod.vfs(b'.') |
39c17718f311
tests: make test-check-interfaces.py work on Python 3
Augie Fackler <augie@google.com>
parents:
37814
diff
changeset
|
181 fl = filelog.filelog(vfs, b'dummy.i') |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
182 checkzobject(fl, allowextra=True) |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
183 |
38530
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
184 # Conforms to imanifestlog. |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
185 ml = manifest.manifestlog(vfs, repo) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
186 checkzobject(ml) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
187 checkzobject(repo.manifestlog) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
188 |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
189 # Conforms to imanifestrevision. |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
190 mctx = ml[repo[0].manifestnode()] |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
191 checkzobject(mctx) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
192 |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
193 # Conforms to imanifestrevisionwritable. |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
194 checkzobject(mctx.new()) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
195 checkzobject(mctx.copy()) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
196 |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
197 # Conforms to imanifestdict. |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
198 checkzobject(mctx.read()) |
c82ea938efbb
repository: define manifest interfaces
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37870
diff
changeset
|
199 |
39230
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
200 ziverify.verifyClass(repository.irevisiondelta, |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
201 changegroup.revisiondelta) |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
202 ziverify.verifyClass(repository.irevisiondeltarequest, |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
203 changegroup.revisiondeltarequest) |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
204 |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
205 rd = changegroup.revisiondelta( |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
206 node=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
207 p1node=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
208 p2node=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
209 basenode=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
210 linknode=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
211 flags=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
212 baserevisionsize=None, |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
213 revision=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
214 delta=None) |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
215 checkzobject(rd) |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
216 |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
217 rdr = changegroup.revisiondeltarequest( |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
218 node=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
219 linknode=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
220 p1node=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
221 p2node=b'', |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
222 basenode=b'') |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
223 checkzobject(rdr) |
b518d495a560
repository: formalize interfaces for revision deltas and requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38530
diff
changeset
|
224 |
33807
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
225 main() |