Details
Details
- Reviewers
ryanmce - Group Reviewers
hg-reviewers - Commits
- rHG115efdd97088: peer: ensure command names are always ascii bytestrs
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
| ryanmce |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| # peer.py - repository base classes for mercurial | # peer.py - repository base classes for mercurial | ||||
| # | # | ||||
| # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> | # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> | ||||
| # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> | ||||
| # | # | ||||
| # This software may be used and distributed according to the terms of the | # This software may be used and distributed according to the terms of the | ||||
| # GNU General Public License version 2 or any later version. | # GNU General Public License version 2 or any later version. | ||||
| from __future__ import absolute_import | from __future__ import absolute_import | ||||
| from . import ( | from . import ( | ||||
| error, | error, | ||||
| pycompat, | |||||
| util, | util, | ||||
| ) | ) | ||||
| # abstract batching support | # abstract batching support | ||||
| class future(object): | class future(object): | ||||
| '''placeholder for a value to be set later''' | '''placeholder for a value to be set later''' | ||||
| def set(self, value): | def set(self, value): | ||||
| decoding phases. | decoding phases. | ||||
| ''' | ''' | ||||
| def plain(*args, **opts): | def plain(*args, **opts): | ||||
| batchable = f(*args, **opts) | batchable = f(*args, **opts) | ||||
| encargsorres, encresref = next(batchable) | encargsorres, encresref = next(batchable) | ||||
| if not encresref: | if not encresref: | ||||
| return encargsorres # a local result in this case | return encargsorres # a local result in this case | ||||
| self = args[0] | self = args[0] | ||||
| encresref.set(self._submitone(f.__name__, encargsorres)) | cmd = pycompat.bytesurl(f.__name__) # ensure cmd is ascii bytestr | ||||
| encresref.set(self._submitone(cmd, encargsorres)) | |||||
| return next(batchable) | return next(batchable) | ||||
| setattr(plain, 'batchable', f) | setattr(plain, 'batchable', f) | ||||
| return plain | return plain | ||||