Show More
@@ -41,46 +41,6 b" bundle2requiredhint = _('see https://www" | |||
|
41 | 41 | 'IncompatibleClient') |
|
42 | 42 | bundle2required = '%s\n(%s)\n' % (bundle2requiredmain, bundle2requiredhint) |
|
43 | 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 | ||
|
84 | 44 | class remoteiterbatcher(peer.iterbatcher): |
|
85 | 45 | def __init__(self, remote): |
|
86 | 46 | super(remoteiterbatcher, self).__init__() |
@@ -31,6 +31,46 b" HGTYPE = 'application/mercurial-0.1'" | |||
|
31 | 31 | HGTYPE2 = 'application/mercurial-0.2' |
|
32 | 32 | HGERRTYPE = 'application/hg-error' |
|
33 | 33 | |
|
34 | class abstractserverproto(object): | |
|
35 | """abstract class that summarizes the protocol API | |
|
36 | ||
|
37 | Used as reference and documentation. | |
|
38 | """ | |
|
39 | ||
|
40 | def getargs(self, args): | |
|
41 | """return the value for arguments in <args> | |
|
42 | ||
|
43 | returns a list of values (same order as <args>)""" | |
|
44 | raise NotImplementedError() | |
|
45 | ||
|
46 | def getfile(self, fp): | |
|
47 | """write the whole content of a file into a file like object | |
|
48 | ||
|
49 | The file is in the form:: | |
|
50 | ||
|
51 | (<chunk-size>\n<chunk>)+0\n | |
|
52 | ||
|
53 | chunk size is the ascii version of the int. | |
|
54 | """ | |
|
55 | raise NotImplementedError() | |
|
56 | ||
|
57 | def redirect(self): | |
|
58 | """may setup interception for stdout and stderr | |
|
59 | ||
|
60 | See also the `restore` method.""" | |
|
61 | raise NotImplementedError() | |
|
62 | ||
|
63 | # If the `redirect` function does install interception, the `restore` | |
|
64 | # function MUST be defined. If interception is not used, this function | |
|
65 | # MUST NOT be defined. | |
|
66 | # | |
|
67 | # left commented here on purpose | |
|
68 | # | |
|
69 | #def restore(self): | |
|
70 | # """reinstall previous stdout and stderr and return intercepted stdout | |
|
71 | # """ | |
|
72 | # raise NotImplementedError() | |
|
73 | ||
|
34 | 74 | def decodevaluefromheaders(req, headerprefix): |
|
35 | 75 | """Decode a long value from multiple HTTP request headers. |
|
36 | 76 | |
@@ -48,7 +88,7 b' def decodevaluefromheaders(req, headerpr' | |||
|
48 | 88 | |
|
49 | 89 | return ''.join(chunks) |
|
50 | 90 | |
|
51 |
class webproto( |
|
|
91 | class webproto(abstractserverproto): | |
|
52 | 92 | def __init__(self, req, ui): |
|
53 | 93 | self.req = req |
|
54 | 94 | self.response = '' |
@@ -202,7 +242,7 b' def callhttp(repo, req, cmd):' | |||
|
202 | 242 | return [] |
|
203 | 243 | raise error.ProgrammingError('hgweb.protocol internal failure', rsp) |
|
204 | 244 | |
|
205 |
class sshserver( |
|
|
245 | class sshserver(abstractserverproto): | |
|
206 | 246 | def __init__(self, ui, repo): |
|
207 | 247 | self.ui = ui |
|
208 | 248 | self.repo = repo |
General Comments 0
You need to be logged in to leave comments.
Login now