|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Plugins.VcsPlugins.vcsGit.GitDiffGenerator</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> |
|
22 <a NAME="top" ID="top"></a> |
|
23 <h1>eric7.Plugins.VcsPlugins.vcsGit.GitDiffGenerator</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing a class to generate the output of the git diff command |
|
27 process. |
|
28 </p> |
|
29 <h3>Global Attributes</h3> |
|
30 |
|
31 <table> |
|
32 <tr><td>None</td></tr> |
|
33 </table> |
|
34 <h3>Classes</h3> |
|
35 |
|
36 <table> |
|
37 |
|
38 <tr> |
|
39 <td><a href="#GitDiffGenerator">GitDiffGenerator</a></td> |
|
40 <td>Class implementing the generation of output of the git diff command.</td> |
|
41 </tr> |
|
42 </table> |
|
43 <h3>Functions</h3> |
|
44 |
|
45 <table> |
|
46 <tr><td>None</td></tr> |
|
47 </table> |
|
48 <hr /> |
|
49 <hr /> |
|
50 <a NAME="GitDiffGenerator" ID="GitDiffGenerator"></a> |
|
51 <h2>GitDiffGenerator</h2> |
|
52 |
|
53 <p> |
|
54 Class implementing the generation of output of the git diff command. |
|
55 </p> |
|
56 <h3>Signals</h3> |
|
57 <dl> |
|
58 |
|
59 <dt>finished()</dt> |
|
60 <dd> |
|
61 emitted when all processes have finished |
|
62 </dd> |
|
63 </dl> |
|
64 <h3>Derived from</h3> |
|
65 QObject |
|
66 <h3>Class Attributes</h3> |
|
67 |
|
68 <table> |
|
69 <tr><td>None</td></tr> |
|
70 </table> |
|
71 <h3>Class Methods</h3> |
|
72 |
|
73 <table> |
|
74 <tr><td>None</td></tr> |
|
75 </table> |
|
76 <h3>Methods</h3> |
|
77 |
|
78 <table> |
|
79 |
|
80 <tr> |
|
81 <td><a href="#GitDiffGenerator.__init__">GitDiffGenerator</a></td> |
|
82 <td>Constructor</td> |
|
83 </tr> |
|
84 <tr> |
|
85 <td><a href="#GitDiffGenerator.__procFinished">__procFinished</a></td> |
|
86 <td>Private slot connected to the finished signal.</td> |
|
87 </tr> |
|
88 <tr> |
|
89 <td><a href="#GitDiffGenerator.__processFileLine">__processFileLine</a></td> |
|
90 <td>Private slot to process a line giving the old/new file.</td> |
|
91 </tr> |
|
92 <tr> |
|
93 <td><a href="#GitDiffGenerator.__processLine">__processLine</a></td> |
|
94 <td>Private method to process one line of output.</td> |
|
95 </tr> |
|
96 <tr> |
|
97 <td><a href="#GitDiffGenerator.__readStderr">__readStderr</a></td> |
|
98 <td>Private slot to handle the readyReadStandardError signal.</td> |
|
99 </tr> |
|
100 <tr> |
|
101 <td><a href="#GitDiffGenerator.__readStdout">__readStdout</a></td> |
|
102 <td>Private slot to handle the readyReadStandardOutput signal.</td> |
|
103 </tr> |
|
104 <tr> |
|
105 <td><a href="#GitDiffGenerator.getResult">getResult</a></td> |
|
106 <td>Public method to return the result data.</td> |
|
107 </tr> |
|
108 <tr> |
|
109 <td><a href="#GitDiffGenerator.start">start</a></td> |
|
110 <td>Public slot to start the git diff command.</td> |
|
111 </tr> |
|
112 <tr> |
|
113 <td><a href="#GitDiffGenerator.stopProcesses">stopProcesses</a></td> |
|
114 <td>Public slot to stop the diff processes.</td> |
|
115 </tr> |
|
116 </table> |
|
117 <h3>Static Methods</h3> |
|
118 |
|
119 <table> |
|
120 <tr><td>None</td></tr> |
|
121 </table> |
|
122 |
|
123 <a NAME="GitDiffGenerator.__init__" ID="GitDiffGenerator.__init__"></a> |
|
124 <h4>GitDiffGenerator (Constructor)</h4> |
|
125 <b>GitDiffGenerator</b>(<i>vcs, parent=None</i>) |
|
126 |
|
127 <p> |
|
128 Constructor |
|
129 </p> |
|
130 <dl> |
|
131 |
|
132 <dt><i>vcs</i></dt> |
|
133 <dd> |
|
134 reference to the vcs object |
|
135 </dd> |
|
136 <dt><i>parent</i></dt> |
|
137 <dd> |
|
138 parent widget (QWidget) |
|
139 </dd> |
|
140 </dl> |
|
141 <a NAME="GitDiffGenerator.__procFinished" ID="GitDiffGenerator.__procFinished"></a> |
|
142 <h4>GitDiffGenerator.__procFinished</h4> |
|
143 <b>__procFinished</b>(<i>exitCode, exitStatus</i>) |
|
144 |
|
145 <p> |
|
146 Private slot connected to the finished signal. |
|
147 </p> |
|
148 <dl> |
|
149 |
|
150 <dt><i>exitCode</i></dt> |
|
151 <dd> |
|
152 exit code of the process (integer) |
|
153 </dd> |
|
154 <dt><i>exitStatus</i></dt> |
|
155 <dd> |
|
156 exit status of the process (QProcess.ExitStatus) |
|
157 </dd> |
|
158 </dl> |
|
159 <a NAME="GitDiffGenerator.__processFileLine" ID="GitDiffGenerator.__processFileLine"></a> |
|
160 <h4>GitDiffGenerator.__processFileLine</h4> |
|
161 <b>__processFileLine</b>(<i>line, isTopDiff</i>) |
|
162 |
|
163 <p> |
|
164 Private slot to process a line giving the old/new file. |
|
165 </p> |
|
166 <dl> |
|
167 |
|
168 <dt><i>line</i></dt> |
|
169 <dd> |
|
170 line to be processed (string) |
|
171 </dd> |
|
172 <dt><i>isTopDiff</i></dt> |
|
173 <dd> |
|
174 flag indicating to show the output in the top |
|
175 output widget (boolean) |
|
176 </dd> |
|
177 </dl> |
|
178 <a NAME="GitDiffGenerator.__processLine" ID="GitDiffGenerator.__processLine"></a> |
|
179 <h4>GitDiffGenerator.__processLine</h4> |
|
180 <b>__processLine</b>(<i>line, isTopDiff</i>) |
|
181 |
|
182 <p> |
|
183 Private method to process one line of output. |
|
184 </p> |
|
185 <dl> |
|
186 |
|
187 <dt><i>line</i></dt> |
|
188 <dd> |
|
189 output line to process (string) |
|
190 </dd> |
|
191 <dt><i>isTopDiff</i></dt> |
|
192 <dd> |
|
193 flag indicating to show the output in the top |
|
194 output widget (boolean) |
|
195 </dd> |
|
196 </dl> |
|
197 <a NAME="GitDiffGenerator.__readStderr" ID="GitDiffGenerator.__readStderr"></a> |
|
198 <h4>GitDiffGenerator.__readStderr</h4> |
|
199 <b>__readStderr</b>(<i>process</i>) |
|
200 |
|
201 <p> |
|
202 Private slot to handle the readyReadStandardError signal. |
|
203 </p> |
|
204 <p> |
|
205 It reads the error output of the process and inserts it into the |
|
206 error pane. |
|
207 </p> |
|
208 <dl> |
|
209 |
|
210 <dt><i>process</i> (QProcess)</dt> |
|
211 <dd> |
|
212 reference to the process providing error output |
|
213 </dd> |
|
214 </dl> |
|
215 <a NAME="GitDiffGenerator.__readStdout" ID="GitDiffGenerator.__readStdout"></a> |
|
216 <h4>GitDiffGenerator.__readStdout</h4> |
|
217 <b>__readStdout</b>(<i>process</i>) |
|
218 |
|
219 <p> |
|
220 Private slot to handle the readyReadStandardOutput signal. |
|
221 </p> |
|
222 <p> |
|
223 It reads the output of the process, formats it and inserts it into |
|
224 the contents pane. |
|
225 </p> |
|
226 <dl> |
|
227 |
|
228 <dt><i>process</i> (QProcess)</dt> |
|
229 <dd> |
|
230 reference to the process providing output |
|
231 </dd> |
|
232 </dl> |
|
233 <a NAME="GitDiffGenerator.getResult" ID="GitDiffGenerator.getResult"></a> |
|
234 <h4>GitDiffGenerator.getResult</h4> |
|
235 <b>getResult</b>(<i></i>) |
|
236 |
|
237 <p> |
|
238 Public method to return the result data. |
|
239 </p> |
|
240 <dl> |
|
241 <dt>Return:</dt> |
|
242 <dd> |
|
243 tuple of lists of string containing lines of the diff, the diff |
|
244 between stage and repo for 'work2stage2repo' mode (empty |
|
245 otherwise), the list of errors and a list of tuples of filenames |
|
246 and the line into the diff output. |
|
247 </dd> |
|
248 </dl> |
|
249 <a NAME="GitDiffGenerator.start" ID="GitDiffGenerator.start"></a> |
|
250 <h4>GitDiffGenerator.start</h4> |
|
251 <b>start</b>(<i>fn, versions=None, diffMode="work2repo", stashName=""</i>) |
|
252 |
|
253 <p> |
|
254 Public slot to start the git diff command. |
|
255 </p> |
|
256 <dl> |
|
257 |
|
258 <dt><i>fn</i></dt> |
|
259 <dd> |
|
260 filename to be diffed (string) |
|
261 </dd> |
|
262 <dt><i>versions</i></dt> |
|
263 <dd> |
|
264 list of versions to be diffed (list of up to 2 strings |
|
265 or None) |
|
266 </dd> |
|
267 <dt><i>diffMode</i></dt> |
|
268 <dd> |
|
269 indication for the type of diff to be performed ( |
|
270 'work2repo' compares the working tree with the HEAD commit, |
|
271 'work2stage' compares the working tree with the staging area, |
|
272 'stage2repo' compares the staging area with the HEAD commit, |
|
273 'work2stage2repo' compares the working tree with the staging area |
|
274 and the staging area with the HEAD commit, |
|
275 'stash' shows the diff for a stash) |
|
276 </dd> |
|
277 <dt><i>stashName</i></dt> |
|
278 <dd> |
|
279 name of the stash to show a diff for (string) |
|
280 </dd> |
|
281 </dl> |
|
282 <dl> |
|
283 <dt>Return:</dt> |
|
284 <dd> |
|
285 flag indicating the start status (boolean) |
|
286 </dd> |
|
287 </dl> |
|
288 <dl> |
|
289 |
|
290 <dt>Raises <b>ValueError</b>:</dt> |
|
291 <dd> |
|
292 raised to indicate a bad value for the 'diffMode' |
|
293 parameter. |
|
294 </dd> |
|
295 </dl> |
|
296 <a NAME="GitDiffGenerator.stopProcesses" ID="GitDiffGenerator.stopProcesses"></a> |
|
297 <h4>GitDiffGenerator.stopProcesses</h4> |
|
298 <b>stopProcesses</b>(<i></i>) |
|
299 |
|
300 <p> |
|
301 Public slot to stop the diff processes. |
|
302 </p> |
|
303 <div align="right"><a href="#top">Up</a></div> |
|
304 <hr /> |
|
305 </body></html> |