47 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
47 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
48 |
48 |
49 self.vcs = vcs |
49 self.vcs = vcs |
50 |
50 |
51 self.__blameRe = re.compile( |
51 self.__blameRe = re.compile( |
52 r"""\^?([0-9a-fA-F]+)\s+\((.+)\s+(\d{4}-\d{2}-\d{2})\s+""" |
52 r"""([?^*]?)([0-9a-fA-F]+)\s+\((.+)\s+(\d{4}-\d{2}-\d{2})\s+""" |
53 r"""(\d{2}:\d{2}):\d{2}\s+[+-]\d{4}\s+(\d+)\)\s?(.*)""" |
53 r"""(\d{2}:\d{2}):\d{2}\s+[+-]\d{4}\s+(\d+)\)\s?(.*)""" |
54 ) |
54 ) |
55 # commit - author - date - time - lineno. - text |
55 # marker - commit - author - date - time - lineno. - text |
56 |
56 |
57 self.blameList.headerItem().setText(self.blameList.columnCount(), "") |
57 self.blameList.headerItem().setText(self.blameList.columnCount(), "") |
|
58 self.blameList.headerItem().setText(0, " ") |
58 font = Preferences.getEditorOtherFonts("MonospacedFont") |
59 font = Preferences.getEditorOtherFonts("MonospacedFont") |
59 self.blameList.setFont(font) |
60 self.blameList.setFont(font) |
60 |
61 |
61 self.process = QProcess() |
62 self.process = QProcess() |
62 self.process.finished.connect(self.__procFinished) |
63 self.process.finished.connect(self.__procFinished) |
80 QTimer.singleShot(2000, self.process.kill) |
81 QTimer.singleShot(2000, self.process.kill) |
81 self.process.waitForFinished(3000) |
82 self.process.waitForFinished(3000) |
82 |
83 |
83 e.accept() |
84 e.accept() |
84 |
85 |
85 def start(self, fn): |
86 def start(self, fn, skiplist=""): |
86 """ |
87 """ |
87 Public slot to start the blame command. |
88 Public slot to start the blame command. |
88 |
89 |
89 @param fn filename to show the blame for (string) |
90 @param fn filename to show the blame for |
|
91 @type str |
|
92 @param skiplist name of a skip list file |
|
93 @type str |
90 """ |
94 """ |
91 self.blameList.clear() |
95 self.blameList.clear() |
92 |
96 |
93 self.errorGroup.hide() |
97 self.errorGroup.hide() |
94 self.intercept = False |
98 self.intercept = False |
179 """ |
185 """ |
180 Private method to resize the list columns. |
186 Private method to resize the list columns. |
181 """ |
187 """ |
182 self.blameList.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) |
188 self.blameList.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) |
183 |
189 |
184 def __generateItem(self, commitId, author, date, time, lineno, text): |
190 def __generateItem(self, mark, commitId, author, date, time, lineno, text): |
185 """ |
191 """ |
186 Private method to generate a blame item in the annotation list. |
192 Private method to generate a blame item in the annotation list. |
187 |
193 |
188 @param commitId commit identifier (string) |
194 @param mark mark character |
189 @param author author of the change (string) |
195 @type str |
190 @param date date of the change (string) |
196 @param commitId commit identifier |
191 @param time time of the change (string) |
197 @type str |
192 @param lineno line number of the change (string) |
198 @param author author of the change |
193 @param text name (path) of the tag (string) |
199 @type str |
|
200 @param date date of the change |
|
201 @type str |
|
202 @param time time of the change |
|
203 @type str |
|
204 @param lineno line number of the change |
|
205 @type str |
|
206 @param text text line of the file |
|
207 @type str |
194 """ |
208 """ |
195 itm = QTreeWidgetItem( |
209 itm = QTreeWidgetItem( |
196 self.blameList, [commitId, author, date, time, lineno, text] |
210 self.blameList, [mark, commitId, author, date, time, lineno, text] |
197 ) |
211 ) |
198 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) |
212 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignHCenter) |
199 itm.setTextAlignment(4, Qt.AlignmentFlag.AlignRight) |
213 itm.setTextAlignment(5, Qt.AlignmentFlag.AlignRight) |
|
214 |
|
215 if mark == "?": |
|
216 itm.setToolTip(0, self.tr("Changed by skipped commit")) |
|
217 elif mark == "*": |
|
218 itm.setToolTip(0, self.tr("Commit cannot be skipped")) |
200 |
219 |
201 def __readStdout(self): |
220 def __readStdout(self): |
202 """ |
221 """ |
203 Private slot to handle the readyReadStdout signal. |
222 Private slot to handle the readyReadStdout signal. |
204 |
223 |
211 line = str( |
230 line = str( |
212 self.process.readLine(), Preferences.getSystem("IOEncoding"), "replace" |
231 self.process.readLine(), Preferences.getSystem("IOEncoding"), "replace" |
213 ).strip() |
232 ).strip() |
214 match = self.__blameRe.match(line) |
233 match = self.__blameRe.match(line) |
215 if match is not None: |
234 if match is not None: |
216 commitId, author, date, time, lineno, text = match.groups() |
235 mark, commitId, author, date, time, lineno, text = match.groups() |
217 self.__generateItem(commitId, author, date, time, lineno, text) |
236 self.__generateItem(mark, commitId, author, date, time, lineno, text) |
218 |
237 |
219 def __readStderr(self): |
238 def __readStderr(self): |
220 """ |
239 """ |
221 Private slot to handle the readyReadStderr signal. |
240 Private slot to handle the readyReadStderr signal. |
222 |
241 |