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