Show More
@@ -161,31 +161,42 b' class wirerepository(repo.repository):' | |||||
161 | def _submitone(self, op, args): |
|
161 | def _submitone(self, op, args): | |
162 | return self._call(op, **args) |
|
162 | return self._call(op, **args) | |
163 |
|
163 | |||
|
164 | @batchable | |||
164 | def lookup(self, key): |
|
165 | def lookup(self, key): | |
165 | self.requirecap('lookup', _('look up remote revision')) |
|
166 | self.requirecap('lookup', _('look up remote revision')) | |
166 | d = self._call("lookup", key=encoding.fromlocal(key)) |
|
167 | f = future() | |
|
168 | yield todict(key=encoding.fromlocal(key)), f | |||
|
169 | d = f.value | |||
167 | success, data = d[:-1].split(" ", 1) |
|
170 | success, data = d[:-1].split(" ", 1) | |
168 | if int(success): |
|
171 | if int(success): | |
169 |
|
|
172 | yield bin(data) | |
170 | self._abort(error.RepoError(data)) |
|
173 | self._abort(error.RepoError(data)) | |
171 |
|
174 | |||
|
175 | @batchable | |||
172 | def heads(self): |
|
176 | def heads(self): | |
173 | d = self._call("heads") |
|
177 | f = future() | |
|
178 | yield {}, f | |||
|
179 | d = f.value | |||
174 | try: |
|
180 | try: | |
175 |
|
|
181 | yield decodelist(d[:-1]) | |
176 | except ValueError: |
|
182 | except ValueError: | |
177 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
183 | self._abort(error.ResponseError(_("unexpected response:"), d)) | |
178 |
|
184 | |||
|
185 | @batchable | |||
179 | def known(self, nodes): |
|
186 | def known(self, nodes): | |
180 | n = encodelist(nodes) |
|
187 | f = future() | |
181 | d = self._call("known", nodes=n) |
|
188 | yield todict(nodes=encodelist(nodes)), f | |
|
189 | d = f.value | |||
182 | try: |
|
190 | try: | |
183 |
|
|
191 | yield [bool(int(f)) for f in d] | |
184 | except ValueError: |
|
192 | except ValueError: | |
185 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
193 | self._abort(error.ResponseError(_("unexpected response:"), d)) | |
186 |
|
194 | |||
|
195 | @batchable | |||
187 | def branchmap(self): |
|
196 | def branchmap(self): | |
188 | d = self._call("branchmap") |
|
197 | f = future() | |
|
198 | yield {}, f | |||
|
199 | d = f.value | |||
189 | try: |
|
200 | try: | |
190 | branchmap = {} |
|
201 | branchmap = {} | |
191 | for branchpart in d.splitlines(): |
|
202 | for branchpart in d.splitlines(): | |
@@ -193,7 +204,7 b' class wirerepository(repo.repository):' | |||||
193 | branchname = encoding.tolocal(urllib.unquote(branchname)) |
|
204 | branchname = encoding.tolocal(urllib.unquote(branchname)) | |
194 | branchheads = decodelist(branchheads) |
|
205 | branchheads = decodelist(branchheads) | |
195 | branchmap[branchname] = branchheads |
|
206 | branchmap[branchname] = branchheads | |
196 |
|
|
207 | yield branchmap | |
197 | except TypeError: |
|
208 | except TypeError: | |
198 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
209 | self._abort(error.ResponseError(_("unexpected response:"), d)) | |
199 |
|
210 | |||
@@ -218,30 +229,35 b' class wirerepository(repo.repository):' | |||||
218 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
229 | self._abort(error.ResponseError(_("unexpected response:"), d)) | |
219 | return r |
|
230 | return r | |
220 |
|
231 | |||
|
232 | @batchable | |||
221 | def pushkey(self, namespace, key, old, new): |
|
233 | def pushkey(self, namespace, key, old, new): | |
222 | if not self.capable('pushkey'): |
|
234 | if not self.capable('pushkey'): | |
223 |
|
|
235 | yield False, None | |
224 | d = self._call("pushkey", |
|
236 | f = future() | |
225 |
|
|
237 | yield todict(namespace=encoding.fromlocal(namespace), | |
226 |
|
|
238 | key=encoding.fromlocal(key), | |
227 |
|
|
239 | old=encoding.fromlocal(old), | |
228 |
|
|
240 | new=encoding.fromlocal(new)), f | |
|
241 | d = f.value | |||
229 | try: |
|
242 | try: | |
230 | d = bool(int(d)) |
|
243 | d = bool(int(d)) | |
231 | except ValueError: |
|
244 | except ValueError: | |
232 | raise error.ResponseError( |
|
245 | raise error.ResponseError( | |
233 | _('push failed (unexpected response):'), d) |
|
246 | _('push failed (unexpected response):'), d) | |
234 |
|
|
247 | yield d | |
235 |
|
248 | |||
|
249 | @batchable | |||
236 | def listkeys(self, namespace): |
|
250 | def listkeys(self, namespace): | |
237 | if not self.capable('pushkey'): |
|
251 | if not self.capable('pushkey'): | |
238 |
|
|
252 | yield {}, None | |
239 | d = self._call("listkeys", namespace=encoding.fromlocal(namespace)) |
|
253 | f = future() | |
|
254 | yield todict(namespace=encoding.fromlocal(namespace)), f | |||
|
255 | d = f.value | |||
240 | r = {} |
|
256 | r = {} | |
241 | for l in d.splitlines(): |
|
257 | for l in d.splitlines(): | |
242 | k, v = l.split('\t') |
|
258 | k, v = l.split('\t') | |
243 | r[encoding.tolocal(k)] = encoding.tolocal(v) |
|
259 | r[encoding.tolocal(k)] = encoding.tolocal(v) | |
244 |
|
|
260 | yield r | |
245 |
|
261 | |||
246 | def stream_out(self): |
|
262 | def stream_out(self): | |
247 | return self._callstream('stream_out') |
|
263 | return self._callstream('stream_out') |
General Comments 0
You need to be logged in to leave comments.
Login now