26 def __init__(self, vcs, parent=None): |
26 def __init__(self, vcs, parent=None): |
27 """ |
27 """ |
28 Constructor |
28 Constructor |
29 |
29 |
30 @param vcs reference to the vcs object |
30 @param vcs reference to the vcs object |
31 @param parent parent widget (QWidget) |
31 @type Hg |
|
32 @param parent parent widget |
|
33 @type QWidget |
32 """ |
34 """ |
33 super().__init__(parent) |
35 super().__init__(parent) |
34 |
36 |
35 self.vcs = vcs |
37 self.vcs = vcs |
36 |
38 |
45 |
47 |
46 def __getVersionArg(self, version): |
48 def __getVersionArg(self, version): |
47 """ |
49 """ |
48 Private method to get a hg revision argument for the given revision. |
50 Private method to get a hg revision argument for the given revision. |
49 |
51 |
50 @param version revision (integer or string) |
52 @param version revision |
51 @return version argument (string) |
53 @type int or str |
|
54 @return version argument |
|
55 @rtype str |
52 """ |
56 """ |
53 if version == "WORKING": |
57 if version == "WORKING": |
54 return None |
58 return None |
55 else: |
59 else: |
56 return str(version).strip() |
60 return str(version).strip() |
57 |
61 |
58 def start(self, fn, versions=None, bundle=None, qdiff=False): |
62 def start(self, fn, versions=None, bundle=None, qdiff=False): |
59 """ |
63 """ |
60 Public slot to start the hg diff command. |
64 Public slot to start the hg diff command. |
61 |
65 |
62 @param fn filename to be diffed (string) |
66 @param fn filename to be diffed |
63 @param versions list of versions to be diffed (list of up to |
67 @type str |
64 2 strings or None) |
68 @param versions list of versions to be diffed |
65 @param bundle name of a bundle file (string) |
69 @type list of up to 2 str or None |
66 @param qdiff flag indicating qdiff command shall be used (boolean) |
70 @param bundle name of a bundle file |
|
71 @type str |
|
72 @param qdiff flag indicating qdiff command shall be used |
|
73 @type bool |
67 @return flag indicating a successful start of the diff command |
74 @return flag indicating a successful start of the diff command |
68 (boolean) |
75 @rtype bool |
69 """ |
76 """ |
70 if qdiff: |
77 if qdiff: |
71 args = self.vcs.initCommand("qdiff") |
78 args = self.vcs.initCommand("qdiff") |
72 else: |
79 else: |
73 args = self.vcs.initCommand("diff") |
80 args = self.vcs.initCommand("diff") |
142 |
149 |
143 def getResult(self): |
150 def getResult(self): |
144 """ |
151 """ |
145 Public method to return the result data. |
152 Public method to return the result data. |
146 |
153 |
147 @return tuple of lists of string containing lines of the diff, the |
154 @return tuple containing a list of lines of the diff, a list of errors |
148 list of errors and a list of tuples of filenames and the line |
155 and a list of tuples of filenames and the line into the diff output |
149 into the diff output. |
156 @rtype tuple of (list of str, list of str, list of tuple of (str, int)) |
150 """ |
157 """ |
151 return (self.__output, self.__errors, self.__fileSeparators) |
158 return (self.__output, self.__errors, self.__fileSeparators) |
152 |
159 |
153 def __extractFileName(self, line): |
160 def __extractFileName(self, line): |
154 """ |
161 """ |
155 Private method to extract the file name out of a file separator line. |
162 Private method to extract the file name out of a file separator line. |
156 |
163 |
157 @param line line to be processed (string) |
164 @param line line to be processed |
158 @return extracted file name (string) |
165 @type str |
|
166 @return extracted file name |
|
167 @rtype str |
159 """ |
168 """ |
160 f = line.split(None, 1)[1] |
169 f = line.split(None, 1)[1] |
161 f = f.rsplit(None, 6)[0] |
170 f = f.rsplit(None, 6)[0] |
162 f = "__NULL__" if f == "/dev/null" else f.split("/", 1)[1] |
171 f = "__NULL__" if f == "/dev/null" else f.split("/", 1)[1] |
163 return f |
172 return f |