Mercurial > public > mercurial-scm > hg
comparison mercurial/wireproto.py @ 35860:d9e71cce3b2f
wireprotoserver: move abstractserverproto class from wireproto
Let's have the interface live next to things that define it.
Differential Revision: https://phab.mercurial-scm.org/D1969
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 31 Jan 2018 11:28:18 -0800 |
parents | a84dbc87dae9 |
children | ae79cf6f9c82 |
comparison
equal
deleted
inserted
replaced
35859:1bf5263fe5cc | 35860:d9e71cce3b2f |
---|---|
38 | 38 |
39 bundle2requiredmain = _('incompatible Mercurial client; bundle2 required') | 39 bundle2requiredmain = _('incompatible Mercurial client; bundle2 required') |
40 bundle2requiredhint = _('see https://www.mercurial-scm.org/wiki/' | 40 bundle2requiredhint = _('see https://www.mercurial-scm.org/wiki/' |
41 'IncompatibleClient') | 41 'IncompatibleClient') |
42 bundle2required = '%s\n(%s)\n' % (bundle2requiredmain, bundle2requiredhint) | 42 bundle2required = '%s\n(%s)\n' % (bundle2requiredmain, bundle2requiredhint) |
43 | |
44 class abstractserverproto(object): | |
45 """abstract class that summarizes the protocol API | |
46 | |
47 Used as reference and documentation. | |
48 """ | |
49 | |
50 def getargs(self, args): | |
51 """return the value for arguments in <args> | |
52 | |
53 returns a list of values (same order as <args>)""" | |
54 raise NotImplementedError() | |
55 | |
56 def getfile(self, fp): | |
57 """write the whole content of a file into a file like object | |
58 | |
59 The file is in the form:: | |
60 | |
61 (<chunk-size>\n<chunk>)+0\n | |
62 | |
63 chunk size is the ascii version of the int. | |
64 """ | |
65 raise NotImplementedError() | |
66 | |
67 def redirect(self): | |
68 """may setup interception for stdout and stderr | |
69 | |
70 See also the `restore` method.""" | |
71 raise NotImplementedError() | |
72 | |
73 # If the `redirect` function does install interception, the `restore` | |
74 # function MUST be defined. If interception is not used, this function | |
75 # MUST NOT be defined. | |
76 # | |
77 # left commented here on purpose | |
78 # | |
79 #def restore(self): | |
80 # """reinstall previous stdout and stderr and return intercepted stdout | |
81 # """ | |
82 # raise NotImplementedError() | |
83 | 43 |
84 class remoteiterbatcher(peer.iterbatcher): | 44 class remoteiterbatcher(peer.iterbatcher): |
85 def __init__(self, remote): | 45 def __init__(self, remote): |
86 super(remoteiterbatcher, self).__init__() | 46 super(remoteiterbatcher, self).__init__() |
87 self._remote = remote | 47 self._remote = remote |