6 """ |
6 """ |
7 Module implementing a dialog to show the output of the hg annotate command. |
7 Module implementing a dialog to show the output of the hg annotate command. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
|
11 import re |
11 |
12 |
12 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, Qt, QCoreApplication |
13 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, Qt, QCoreApplication |
13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, QLineEdit, \ |
14 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, QLineEdit, \ |
14 QTreeWidgetItem |
15 QTreeWidgetItem |
15 |
16 |
37 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
38 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
38 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
39 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
39 |
40 |
40 self.vcs = vcs |
41 self.vcs = vcs |
41 self.__hgClient = vcs.getClient() |
42 self.__hgClient = vcs.getClient() |
|
43 |
|
44 self.__annotateRe = re.compile( |
|
45 r"""(.+)\s+(\d+)\s+([0-9a-fA-F]+)\s+([0-9-]+)\s+(.+)""") |
42 |
46 |
43 self.annotateList.headerItem().setText( |
47 self.annotateList.headerItem().setText( |
44 self.annotateList.columnCount(), "") |
48 self.annotateList.columnCount(), "") |
45 font = Preferences.getEditorOtherFonts("MonospacedFont") |
49 font = Preferences.getEditorOtherFonts("MonospacedFont") |
46 self.annotateList.setFont(font) |
50 self.annotateList.setFont(font) |
230 try: |
234 try: |
231 info, text = line.split(": ", 1) |
235 info, text = line.split(": ", 1) |
232 except ValueError: |
236 except ValueError: |
233 info = line[:-2] |
237 info = line[:-2] |
234 text = "" |
238 text = "" |
235 author, rev, changeset, date, file = info.split() |
239 match = self.__annotateRe.match(info) |
236 self.__generateItem(rev, changeset, author, date, text) |
240 author, rev, changeset, date, file = match.groups() |
|
241 self.__generateItem(rev.strip(), changeset.strip(), author.strip(), |
|
242 date.strip(), text) |
237 |
243 |
238 def __readStderr(self): |
244 def __readStderr(self): |
239 """ |
245 """ |
240 Private slot to handle the readyReadStderr signal. |
246 Private slot to handle the readyReadStderr signal. |
241 |
247 |