src/eric7/Documentation/Source/eric7.Plugins.VcsPlugins.vcsMercurial.HgClient.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 10479
856476537696
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Plugins.VcsPlugins.vcsMercurial.HgClient</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.Plugins.VcsPlugins.vcsMercurial.HgClient</h1>
10
11 <p>
12 Module implementing an interface to the Mercurial command server.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>None</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#HgClient">HgClient</a></td>
25 <td>Class implementing the Mercurial command server interface.</td>
26 </tr>
27 </table>
28 <h3>Functions</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <hr />
34 <hr />
35 <a NAME="HgClient" ID="HgClient"></a>
36 <h2>HgClient</h2>
37
38 <p>
39 Class implementing the Mercurial command server interface.
40 </p>
41 <h3>Derived from</h3>
42 QObject
43 <h3>Class Attributes</h3>
44
45 <table>
46 <tr><td>Channels</td></tr><tr><td>InputFormat</td></tr><tr><td>OutputFormat</td></tr><tr><td>OutputFormatSize</td></tr><tr><td>ReturnFormat</td></tr>
47 </table>
48 <h3>Class Methods</h3>
49
50 <table>
51 <tr><td>None</td></tr>
52 </table>
53 <h3>Methods</h3>
54
55 <table>
56
57 <tr>
58 <td><a href="#HgClient.__init__">HgClient</a></td>
59 <td>Constructor</td>
60 </tr>
61 <tr>
62 <td><a href="#HgClient.__prompt">__prompt</a></td>
63 <td>Private method to prompt the user for some input.</td>
64 </tr>
65 <tr>
66 <td><a href="#HgClient.__readChannel">__readChannel</a></td>
67 <td>Private method to read data from the command server.</td>
68 </tr>
69 <tr>
70 <td><a href="#HgClient.__readHello">__readHello</a></td>
71 <td>Private method to read the hello message sent by the command server.</td>
72 </tr>
73 <tr>
74 <td><a href="#HgClient.__runcommand">__runcommand</a></td>
75 <td>Private method to run a command in the server (low level).</td>
76 </tr>
77 <tr>
78 <td><a href="#HgClient.__serverFinished">__serverFinished</a></td>
79 <td>Private slot connected to the finished signal.</td>
80 </tr>
81 <tr>
82 <td><a href="#HgClient.__writeDataBlock">__writeDataBlock</a></td>
83 <td>Private slot to write some data to the command server.</td>
84 </tr>
85 <tr>
86 <td><a href="#HgClient.cancel">cancel</a></td>
87 <td>Public method to cancel the running command.</td>
88 </tr>
89 <tr>
90 <td><a href="#HgClient.func">func</a></td>
91 <td></td>
92 </tr>
93 <tr>
94 <td><a href="#HgClient.getRepository">getRepository</a></td>
95 <td>Public method to get the repository path this client is serving.</td>
96 </tr>
97 <tr>
98 <td><a href="#HgClient.isExecuting">isExecuting</a></td>
99 <td>Public method to check, if the server is executing a command.</td>
100 </tr>
101 <tr>
102 <td><a href="#HgClient.myprompt">myprompt</a></td>
103 <td></td>
104 </tr>
105 <tr>
106 <td><a href="#HgClient.restartServer">restartServer</a></td>
107 <td>Public method to restart the command server.</td>
108 </tr>
109 <tr>
110 <td><a href="#HgClient.runcommand">runcommand</a></td>
111 <td>Public method to execute a command via the command server.</td>
112 </tr>
113 <tr>
114 <td><a href="#HgClient.startServer">startServer</a></td>
115 <td>Public method to start the command server.</td>
116 </tr>
117 <tr>
118 <td><a href="#HgClient.stopServer">stopServer</a></td>
119 <td>Public method to stop the command server.</td>
120 </tr>
121 <tr>
122 <td><a href="#HgClient.wasCanceled">wasCanceled</a></td>
123 <td>Public method to check, if the last command was canceled.</td>
124 </tr>
125 </table>
126 <h3>Static Methods</h3>
127
128 <table>
129 <tr><td>None</td></tr>
130 </table>
131
132 <a NAME="HgClient.__init__" ID="HgClient.__init__"></a>
133 <h4>HgClient (Constructor)</h4>
134 <b>HgClient</b>(<i>repoPath, encoding, vcs, parent=None</i>)
135
136 <p>
137 Constructor
138 </p>
139 <dl>
140
141 <dt><i>repoPath</i> (str)</dt>
142 <dd>
143 root directory of the repository
144 </dd>
145 <dt><i>encoding</i> (str)</dt>
146 <dd>
147 encoding to be used by the command server
148 </dd>
149 <dt><i>vcs</i> (Hg)</dt>
150 <dd>
151 reference to the VCS object
152 </dd>
153 <dt><i>parent</i> (QObject)</dt>
154 <dd>
155 reference to the parent object
156 </dd>
157 </dl>
158 <a NAME="HgClient.__prompt" ID="HgClient.__prompt"></a>
159 <h4>HgClient.__prompt</h4>
160 <b>__prompt</b>(<i>size, message</i>)
161
162 <p>
163 Private method to prompt the user for some input.
164 </p>
165 <dl>
166
167 <dt><i>size</i> (int)</dt>
168 <dd>
169 maximum length of the requested input
170 </dd>
171 <dt><i>message</i> (str)</dt>
172 <dd>
173 message sent by the server
174 </dd>
175 </dl>
176 <dl>
177 <dt>Return:</dt>
178 <dd>
179 tuple containing data entered by the user and
180 a flag indicating a password input
181 </dd>
182 </dl>
183 <dl>
184 <dt>Return Type:</dt>
185 <dd>
186 tuple of (str, bool)
187 </dd>
188 </dl>
189 <a NAME="HgClient.__readChannel" ID="HgClient.__readChannel"></a>
190 <h4>HgClient.__readChannel</h4>
191 <b>__readChannel</b>(<i></i>)
192
193 <p>
194 Private method to read data from the command server.
195 </p>
196 <dl>
197 <dt>Return:</dt>
198 <dd>
199 tuple of channel designator and channel data
200 </dd>
201 </dl>
202 <dl>
203 <dt>Return Type:</dt>
204 <dd>
205 tuple of (str, int or str or bytes)
206 </dd>
207 </dl>
208 <a NAME="HgClient.__readHello" ID="HgClient.__readHello"></a>
209 <h4>HgClient.__readHello</h4>
210 <b>__readHello</b>(<i></i>)
211
212 <p>
213 Private method to read the hello message sent by the command server.
214 </p>
215 <dl>
216 <dt>Return:</dt>
217 <dd>
218 tuple of flag indicating success and an error message in case
219 of failure
220 </dd>
221 </dl>
222 <dl>
223 <dt>Return Type:</dt>
224 <dd>
225 tuple of (bool, str)
226 </dd>
227 </dl>
228 <a NAME="HgClient.__runcommand" ID="HgClient.__runcommand"></a>
229 <h4>HgClient.__runcommand</h4>
230 <b>__runcommand</b>(<i>args, inputChannels, outputChannels</i>)
231
232 <p>
233 Private method to run a command in the server (low level).
234 </p>
235 <dl>
236
237 <dt><i>args</i> (list of str)</dt>
238 <dd>
239 list of arguments for the command
240 </dd>
241 <dt><i>inputChannels</i> (dict)</dt>
242 <dd>
243 dictionary of input channels. The dictionary must
244 have the keys 'I' and 'L' and each entry must be a function
245 receiving the number of bytes to write.
246 </dd>
247 <dt><i>outputChannels</i> (dict)</dt>
248 <dd>
249 dictionary of output channels. The dictionary
250 must have the keys 'o' and 'e' and each entry must be a function
251 receiving the data.
252 </dd>
253 </dl>
254 <dl>
255 <dt>Return:</dt>
256 <dd>
257 result code of the command, -1 if the command server wasn't
258 started or -10, if the command was canceled
259 </dd>
260 </dl>
261 <dl>
262 <dt>Return Type:</dt>
263 <dd>
264 int
265 </dd>
266 </dl>
267 <dl>
268
269 <dt>Raises <b>RuntimeError</b>:</dt>
270 <dd>
271 raised to indicate an unexpected command
272 channel
273 </dd>
274 </dl>
275 <a NAME="HgClient.__serverFinished" ID="HgClient.__serverFinished"></a>
276 <h4>HgClient.__serverFinished</h4>
277 <b>__serverFinished</b>(<i>exitCode, exitStatus</i>)
278
279 <p>
280 Private slot connected to the finished signal.
281 </p>
282 <dl>
283
284 <dt><i>exitCode</i> (int)</dt>
285 <dd>
286 exit code of the process
287 </dd>
288 <dt><i>exitStatus</i> (QProcess.ExitStatus)</dt>
289 <dd>
290 exit status of the process
291 </dd>
292 </dl>
293 <a NAME="HgClient.__writeDataBlock" ID="HgClient.__writeDataBlock"></a>
294 <h4>HgClient.__writeDataBlock</h4>
295 <b>__writeDataBlock</b>(<i>data</i>)
296
297 <p>
298 Private slot to write some data to the command server.
299 </p>
300 <dl>
301
302 <dt><i>data</i> (str)</dt>
303 <dd>
304 data to be sent
305 </dd>
306 </dl>
307 <a NAME="HgClient.cancel" ID="HgClient.cancel"></a>
308 <h4>HgClient.cancel</h4>
309 <b>cancel</b>(<i></i>)
310
311 <p>
312 Public method to cancel the running command.
313 </p>
314 <a NAME="HgClient.func" ID="HgClient.func"></a>
315 <h4>HgClient.func</h4>
316 <b>func</b>(<i></i>)
317
318 <a NAME="HgClient.getRepository" ID="HgClient.getRepository"></a>
319 <h4>HgClient.getRepository</h4>
320 <b>getRepository</b>(<i></i>)
321
322 <p>
323 Public method to get the repository path this client is serving.
324 </p>
325 <dl>
326 <dt>Return:</dt>
327 <dd>
328 repository path
329 </dd>
330 </dl>
331 <dl>
332 <dt>Return Type:</dt>
333 <dd>
334 str
335 </dd>
336 </dl>
337 <a NAME="HgClient.isExecuting" ID="HgClient.isExecuting"></a>
338 <h4>HgClient.isExecuting</h4>
339 <b>isExecuting</b>(<i></i>)
340
341 <p>
342 Public method to check, if the server is executing a command.
343 </p>
344 <dl>
345 <dt>Return:</dt>
346 <dd>
347 flag indicating the execution of a command
348 </dd>
349 </dl>
350 <dl>
351 <dt>Return Type:</dt>
352 <dd>
353 bool
354 </dd>
355 </dl>
356 <a NAME="HgClient.myprompt" ID="HgClient.myprompt"></a>
357 <h4>HgClient.myprompt</h4>
358 <b>myprompt</b>(<i></i>)
359
360 <a NAME="HgClient.restartServer" ID="HgClient.restartServer"></a>
361 <h4>HgClient.restartServer</h4>
362 <b>restartServer</b>(<i></i>)
363
364 <p>
365 Public method to restart the command server.
366 </p>
367 <dl>
368 <dt>Return:</dt>
369 <dd>
370 tuple of flag indicating a successful start and an error
371 message in case of failure
372 </dd>
373 </dl>
374 <dl>
375 <dt>Return Type:</dt>
376 <dd>
377 tuple of (bool, str)
378 </dd>
379 </dl>
380 <a NAME="HgClient.runcommand" ID="HgClient.runcommand"></a>
381 <h4>HgClient.runcommand</h4>
382 <b>runcommand</b>(<i>args, prompt=None, inputData=None, output=None, error=None</i>)
383
384 <p>
385 Public method to execute a command via the command server.
386 </p>
387 <dl>
388
389 <dt><i>args</i> (list of str)</dt>
390 <dd>
391 list of arguments for the command
392 </dd>
393 <dt><i>prompt</i> (func(int, str) -> (str, bool))</dt>
394 <dd>
395 function to reply to prompts by the server. It
396 receives the max number of bytes to return and the contents
397 of the output channel received so far. If an output function is
398 given as well, the prompt data is passed through the output
399 function. The function must return the input data and a flag
400 indicating a password input.
401 </dd>
402 <dt><i>inputData</i> (func(int) -> bytes)</dt>
403 <dd>
404 function to reply to bulk data requests by the
405 server. It receives the max number of bytes to return.
406 </dd>
407 <dt><i>output</i> (func(str))</dt>
408 <dd>
409 function receiving the data from the server. If a
410 prompt function is given, it is assumed, that the prompt output
411 is passed via this function.
412 </dd>
413 <dt><i>error</i> (func(str))</dt>
414 <dd>
415 function receiving error messages from the server
416 </dd>
417 </dl>
418 <dl>
419 <dt>Return:</dt>
420 <dd>
421 tuple of output and errors of the command server. In case
422 output and/or error functions were given, the respective return
423 value will be an empty string.
424 </dd>
425 </dl>
426 <dl>
427 <dt>Return Type:</dt>
428 <dd>
429 tuple of (str, str)
430 </dd>
431 </dl>
432 <a NAME="HgClient.startServer" ID="HgClient.startServer"></a>
433 <h4>HgClient.startServer</h4>
434 <b>startServer</b>(<i></i>)
435
436 <p>
437 Public method to start the command server.
438 </p>
439 <dl>
440 <dt>Return:</dt>
441 <dd>
442 tuple of flag indicating a successful start and an error
443 message in case of failure
444 </dd>
445 </dl>
446 <dl>
447 <dt>Return Type:</dt>
448 <dd>
449 tuple of (bool, str)
450 </dd>
451 </dl>
452 <a NAME="HgClient.stopServer" ID="HgClient.stopServer"></a>
453 <h4>HgClient.stopServer</h4>
454 <b>stopServer</b>(<i></i>)
455
456 <p>
457 Public method to stop the command server.
458 </p>
459 <a NAME="HgClient.wasCanceled" ID="HgClient.wasCanceled"></a>
460 <h4>HgClient.wasCanceled</h4>
461 <b>wasCanceled</b>(<i></i>)
462
463 <p>
464 Public method to check, if the last command was canceled.
465 </p>
466 <dl>
467 <dt>Return:</dt>
468 <dd>
469 flag indicating the cancel state
470 </dd>
471 </dl>
472 <dl>
473 <dt>Return Type:</dt>
474 <dd>
475 bool
476 </dd>
477 </dl>
478 <div align="right"><a href="#top">Up</a></div>
479 <hr />
480 </body></html>

eric ide

mercurial