##// END OF EJS Templates
test-batching: stop direct symbol import of mercurial modules...
Yuya Nishihara -
r28800:544908ae default
parent child Browse files
Show More
@@ -6,13 +6,10 b''
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import, print_function
8 from __future__ import absolute_import, print_function
9 from mercurial.peer import (
9
10 localbatch,
10 from mercurial import (
11 batchable,
11 peer,
12 future,
12 wireproto,
13 )
14 from mercurial.wireproto import (
15 remotebatch,
16 )
13 )
17
14
18 # equivalent of repo.repository
15 # equivalent of repo.repository
@@ -32,7 +29,7 b' class localthing(thing):'
32 return "Hello, %s" % name
29 return "Hello, %s" % name
33 def batch(self):
30 def batch(self):
34 '''Support for local batching.'''
31 '''Support for local batching.'''
35 return localbatch(self)
32 return peer.localbatch(self)
36
33
37 # usage of "thing" interface
34 # usage of "thing" interface
38 def use(it):
35 def use(it):
@@ -152,20 +149,20 b' class remotething(thing):'
152 return res.split(';')
149 return res.split(';')
153
150
154 def batch(self):
151 def batch(self):
155 return remotebatch(self)
152 return wireproto.remotebatch(self)
156
153
157 @batchable
154 @peer.batchable
158 def foo(self, one, two=None):
155 def foo(self, one, two=None):
159 if not one:
156 if not one:
160 yield "Nope", None
157 yield "Nope", None
161 encargs = [('one', mangle(one),), ('two', mangle(two),)]
158 encargs = [('one', mangle(one),), ('two', mangle(two),)]
162 encresref = future()
159 encresref = peer.future()
163 yield encargs, encresref
160 yield encargs, encresref
164 yield unmangle(encresref.value)
161 yield unmangle(encresref.value)
165
162
166 @batchable
163 @peer.batchable
167 def bar(self, b, a):
164 def bar(self, b, a):
168 encresref = future()
165 encresref = peer.future()
169 yield [('b', mangle(b),), ('a', mangle(a),)], encresref
166 yield [('b', mangle(b),), ('a', mangle(a),)], encresref
170 yield unmangle(encresref.value)
167 yield unmangle(encresref.value)
171
168
General Comments 0
You need to be logged in to leave comments. Login now