Mercurial > hg
comparison mercurial/wireproto.py @ 34062:6c6169f71b8d
wireproto: do not abort after successful lookup
As far as I can tell, this interface originally used 'return' here, so the
"fallthrough" to self._abort made sense. When it was switched to 'yield' this
didn't make sense, but doesn't impact most uses because the 'plain' wrapper in
peer.py's 'batchable' decorator only attempts to yield two items (args and
value).
When using iterbatch, however, it attempts to verify that the @batchable
generators only emit 2 results, by expecting a StopIteration when attempting to
access a third.
Differential Revision: https://phab.mercurial-scm.org/D608
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Fri, 01 Sep 2017 14:00:13 -0700 |
parents | dedab036215d |
children | f7d41b85bbf6 |
comparison
equal
deleted
inserted
replaced
34061:11499bad0359 | 34062:6c6169f71b8d |
---|---|
233 yield {'key': encoding.fromlocal(key)}, f | 233 yield {'key': encoding.fromlocal(key)}, f |
234 d = f.value | 234 d = f.value |
235 success, data = d[:-1].split(" ", 1) | 235 success, data = d[:-1].split(" ", 1) |
236 if int(success): | 236 if int(success): |
237 yield bin(data) | 237 yield bin(data) |
238 self._abort(error.RepoError(data)) | 238 else: |
239 self._abort(error.RepoError(data)) | |
239 | 240 |
240 @batchable | 241 @batchable |
241 def heads(self): | 242 def heads(self): |
242 f = future() | 243 f = future() |
243 yield {}, f | 244 yield {}, f |