|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.Plugins.VcsPlugins.vcsMercurial.HgClient</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.Plugins.VcsPlugins.vcsMercurial.HgClient</h1> |
|
23 <p> |
|
24 Module implementing an interface to the Mercurial command server. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#HgClient">HgClient</a></td> |
|
34 <td>Class implementing the Mercurial command server interface.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Functions</h3> |
|
38 <table> |
|
39 <tr><td>None</td></tr> |
|
40 </table> |
|
41 <hr /><hr /> |
|
42 <a NAME="HgClient" ID="HgClient"></a> |
|
43 <h2>HgClient</h2> |
|
44 <p> |
|
45 Class implementing the Mercurial command server interface. |
|
46 </p> |
|
47 <h3>Derived from</h3> |
|
48 QObject |
|
49 <h3>Class Attributes</h3> |
|
50 <table> |
|
51 <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> |
|
52 </table> |
|
53 <h3>Class Methods</h3> |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 <table> |
|
59 <tr> |
|
60 <td><a href="#HgClient.__init__">HgClient</a></td> |
|
61 <td>Constructor</td> |
|
62 </tr><tr> |
|
63 <td><a href="#HgClient.__prompt">__prompt</a></td> |
|
64 <td>Private method to prompt the user for some input.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#HgClient.__readChannel">__readChannel</a></td> |
|
67 <td>Private method to read data from the command server.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#HgClient.__readHello">__readHello</a></td> |
|
70 <td>Private method to read the hello message sent by the command server.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#HgClient.__runcommand">__runcommand</a></td> |
|
73 <td>Private method to run a command in the server (low level).</td> |
|
74 </tr><tr> |
|
75 <td><a href="#HgClient.__serverFinished">__serverFinished</a></td> |
|
76 <td>Private slot connected to the finished signal.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#HgClient.__writeDataBlock">__writeDataBlock</a></td> |
|
79 <td>Private slot to write some data to the command server.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#HgClient.cancel">cancel</a></td> |
|
82 <td>Public method to cancel the running command.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#HgClient.func">func</a></td> |
|
85 <td></td> |
|
86 </tr><tr> |
|
87 <td><a href="#HgClient.isExecuting">isExecuting</a></td> |
|
88 <td>Public method to check, if the server is executing a command.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#HgClient.myprompt">myprompt</a></td> |
|
91 <td></td> |
|
92 </tr><tr> |
|
93 <td><a href="#HgClient.restartServer">restartServer</a></td> |
|
94 <td>Public method to restart the command server.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#HgClient.runcommand">runcommand</a></td> |
|
97 <td>Public method to execute a command via the command server.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#HgClient.startServer">startServer</a></td> |
|
100 <td>Public method to start the command server.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#HgClient.stopServer">stopServer</a></td> |
|
103 <td>Public method to stop the command server.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#HgClient.wasCanceled">wasCanceled</a></td> |
|
106 <td>Public method to check, if the last command was canceled.</td> |
|
107 </tr> |
|
108 </table> |
|
109 <h3>Static Methods</h3> |
|
110 <table> |
|
111 <tr><td>None</td></tr> |
|
112 </table> |
|
113 <a NAME="HgClient.__init__" ID="HgClient.__init__"></a> |
|
114 <h4>HgClient (Constructor)</h4> |
|
115 <b>HgClient</b>(<i>repoPath, encoding, vcs, parent=None</i>) |
|
116 <p> |
|
117 Constructor |
|
118 </p><dl> |
|
119 <dt><i>repoPath</i></dt> |
|
120 <dd> |
|
121 root directory of the repository (string) |
|
122 </dd><dt><i>encoding</i></dt> |
|
123 <dd> |
|
124 encoding to be used by the command server (string) |
|
125 </dd><dt><i>vcs</i></dt> |
|
126 <dd> |
|
127 reference to the VCS object (Hg) |
|
128 </dd><dt><i>parent</i></dt> |
|
129 <dd> |
|
130 reference to the parent object (QObject) |
|
131 </dd> |
|
132 </dl><a NAME="HgClient.__prompt" ID="HgClient.__prompt"></a> |
|
133 <h4>HgClient.__prompt</h4> |
|
134 <b>__prompt</b>(<i>size, message</i>) |
|
135 <p> |
|
136 Private method to prompt the user for some input. |
|
137 </p><dl> |
|
138 <dt><i>size</i></dt> |
|
139 <dd> |
|
140 maximum length of the requested input (integer) |
|
141 </dd><dt><i>message</i></dt> |
|
142 <dd> |
|
143 message sent by the server (string) |
|
144 </dd> |
|
145 </dl><dl> |
|
146 <dt>Returns:</dt> |
|
147 <dd> |
|
148 data entered by the user (string) |
|
149 </dd> |
|
150 </dl><a NAME="HgClient.__readChannel" ID="HgClient.__readChannel"></a> |
|
151 <h4>HgClient.__readChannel</h4> |
|
152 <b>__readChannel</b>(<i></i>) |
|
153 <p> |
|
154 Private method to read data from the command server. |
|
155 </p><dl> |
|
156 <dt>Returns:</dt> |
|
157 <dd> |
|
158 tuple of channel designator and channel data |
|
159 (string, integer or string or bytes) |
|
160 </dd> |
|
161 </dl><a NAME="HgClient.__readHello" ID="HgClient.__readHello"></a> |
|
162 <h4>HgClient.__readHello</h4> |
|
163 <b>__readHello</b>(<i></i>) |
|
164 <p> |
|
165 Private method to read the hello message sent by the command server. |
|
166 </p><dl> |
|
167 <dt>Returns:</dt> |
|
168 <dd> |
|
169 tuple of flag indicating success (boolean) and an error message |
|
170 in case of failure (string) |
|
171 </dd> |
|
172 </dl><a NAME="HgClient.__runcommand" ID="HgClient.__runcommand"></a> |
|
173 <h4>HgClient.__runcommand</h4> |
|
174 <b>__runcommand</b>(<i>args, inputChannels, outputChannels</i>) |
|
175 <p> |
|
176 Private method to run a command in the server (low level). |
|
177 </p><dl> |
|
178 <dt><i>args</i></dt> |
|
179 <dd> |
|
180 list of arguments for the command (list of string) |
|
181 </dd><dt><i>inputChannels</i></dt> |
|
182 <dd> |
|
183 dictionary of input channels. The dictionary must |
|
184 have the keys 'I' and 'L' and each entry must be a function |
|
185 receiving the number of bytes to write. |
|
186 </dd><dt><i>outputChannels</i></dt> |
|
187 <dd> |
|
188 dictionary of output channels. The dictionary |
|
189 must have the keys 'o' and 'e' and each entry must be a function |
|
190 receiving the data. |
|
191 </dd> |
|
192 </dl><dl> |
|
193 <dt>Returns:</dt> |
|
194 <dd> |
|
195 result code of the command, -1 if the command server wasn't |
|
196 started or -10, if the command was canceled (integer) |
|
197 </dd> |
|
198 </dl><dl> |
|
199 <dt>Raises <b>RuntimeError</b>:</dt> |
|
200 <dd> |
|
201 raised to indicate an unexpected command |
|
202 channel |
|
203 </dd> |
|
204 </dl><a NAME="HgClient.__serverFinished" ID="HgClient.__serverFinished"></a> |
|
205 <h4>HgClient.__serverFinished</h4> |
|
206 <b>__serverFinished</b>(<i>exitCode, exitStatus</i>) |
|
207 <p> |
|
208 Private slot connected to the finished signal. |
|
209 </p><dl> |
|
210 <dt><i>exitCode</i></dt> |
|
211 <dd> |
|
212 exit code of the process (integer) |
|
213 </dd><dt><i>exitStatus</i></dt> |
|
214 <dd> |
|
215 exit status of the process (QProcess.ExitStatus) |
|
216 </dd> |
|
217 </dl><a NAME="HgClient.__writeDataBlock" ID="HgClient.__writeDataBlock"></a> |
|
218 <h4>HgClient.__writeDataBlock</h4> |
|
219 <b>__writeDataBlock</b>(<i>data</i>) |
|
220 <p> |
|
221 Private slot to write some data to the command server. |
|
222 </p><dl> |
|
223 <dt><i>data</i></dt> |
|
224 <dd> |
|
225 data to be sent (string) |
|
226 </dd> |
|
227 </dl><a NAME="HgClient.cancel" ID="HgClient.cancel"></a> |
|
228 <h4>HgClient.cancel</h4> |
|
229 <b>cancel</b>(<i></i>) |
|
230 <p> |
|
231 Public method to cancel the running command. |
|
232 </p><a NAME="HgClient.func" ID="HgClient.func"></a> |
|
233 <h4>HgClient.func</h4> |
|
234 <b>func</b>(<i></i>) |
|
235 <a NAME="HgClient.isExecuting" ID="HgClient.isExecuting"></a> |
|
236 <h4>HgClient.isExecuting</h4> |
|
237 <b>isExecuting</b>(<i></i>) |
|
238 <p> |
|
239 Public method to check, if the server is executing a command. |
|
240 </p><dl> |
|
241 <dt>Returns:</dt> |
|
242 <dd> |
|
243 flag indicating the execution of a command (boolean) |
|
244 </dd> |
|
245 </dl><a NAME="HgClient.myprompt" ID="HgClient.myprompt"></a> |
|
246 <h4>HgClient.myprompt</h4> |
|
247 <b>myprompt</b>(<i></i>) |
|
248 <a NAME="HgClient.restartServer" ID="HgClient.restartServer"></a> |
|
249 <h4>HgClient.restartServer</h4> |
|
250 <b>restartServer</b>(<i></i>) |
|
251 <p> |
|
252 Public method to restart the command server. |
|
253 </p><dl> |
|
254 <dt>Returns:</dt> |
|
255 <dd> |
|
256 tuple of flag indicating a successful start (boolean) and |
|
257 an error message (string) in case of failure |
|
258 </dd> |
|
259 </dl><a NAME="HgClient.runcommand" ID="HgClient.runcommand"></a> |
|
260 <h4>HgClient.runcommand</h4> |
|
261 <b>runcommand</b>(<i>args, prompt=None, input=None, output=None, error=None</i>) |
|
262 <p> |
|
263 Public method to execute a command via the command server. |
|
264 </p><dl> |
|
265 <dt><i>args</i></dt> |
|
266 <dd> |
|
267 list of arguments for the command (list of string) |
|
268 </dd><dt><i>prompt=</i></dt> |
|
269 <dd> |
|
270 function to reply to prompts by the server. It |
|
271 receives the max number of bytes to return and the contents |
|
272 of the output channel received so far. |
|
273 </dd><dt><i>input=</i></dt> |
|
274 <dd> |
|
275 function to reply to bulk data requests by the server. |
|
276 It receives the max number of bytes to return. |
|
277 </dd><dt><i>output=</i></dt> |
|
278 <dd> |
|
279 function receiving the data from the server (string). |
|
280 If a prompt function is given, this parameter will be ignored. |
|
281 </dd><dt><i>error=</i></dt> |
|
282 <dd> |
|
283 function receiving error messages from the server |
|
284 (string) |
|
285 </dd> |
|
286 </dl><dl> |
|
287 <dt>Returns:</dt> |
|
288 <dd> |
|
289 output and errors of the command server (string). In case |
|
290 output and/or error functions were given, the respective return |
|
291 value will be an empty string. |
|
292 </dd> |
|
293 </dl><a NAME="HgClient.startServer" ID="HgClient.startServer"></a> |
|
294 <h4>HgClient.startServer</h4> |
|
295 <b>startServer</b>(<i></i>) |
|
296 <p> |
|
297 Public method to start the command server. |
|
298 </p><dl> |
|
299 <dt>Returns:</dt> |
|
300 <dd> |
|
301 tuple of flag indicating a successful start (boolean) and |
|
302 an error message (string) in case of failure |
|
303 </dd> |
|
304 </dl><a NAME="HgClient.stopServer" ID="HgClient.stopServer"></a> |
|
305 <h4>HgClient.stopServer</h4> |
|
306 <b>stopServer</b>(<i></i>) |
|
307 <p> |
|
308 Public method to stop the command server. |
|
309 </p><a NAME="HgClient.wasCanceled" ID="HgClient.wasCanceled"></a> |
|
310 <h4>HgClient.wasCanceled</h4> |
|
311 <b>wasCanceled</b>(<i></i>) |
|
312 <p> |
|
313 Public method to check, if the last command was canceled. |
|
314 </p><dl> |
|
315 <dt>Returns:</dt> |
|
316 <dd> |
|
317 flag indicating the cancel state (boolean) |
|
318 </dd> |
|
319 </dl> |
|
320 <div align="right"><a href="#top">Up</a></div> |
|
321 <hr /> |
|
322 </body></html> |