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, QFont, QHeaderView, \ |
14 from PyQt4.QtGui import QDialog, QDialogButtonBox, QFont, QHeaderView, \ |
14 QTreeWidgetItem, QLineEdit |
15 QTreeWidgetItem, QLineEdit |
15 |
16 |
38 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
39 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
39 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
40 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
40 |
41 |
41 self.vcs = vcs |
42 self.vcs = vcs |
42 self.__hgClient = vcs.getClient() |
43 self.__hgClient = vcs.getClient() |
|
44 |
|
45 self.__annotateRe = re.compile( |
|
46 r"""(.+)\s+(\d+)\s+([0-9a-fA-F]+)\s+([0-9-]+)\s+(.+)""") |
43 |
47 |
44 self.annotateList.headerItem().setText( |
48 self.annotateList.headerItem().setText( |
45 self.annotateList.columnCount(), "") |
49 self.annotateList.columnCount(), "") |
46 font = QFont(self.annotateList.font()) |
50 font = QFont(self.annotateList.font()) |
47 if Utilities.isWindowsPlatform(): |
51 if Utilities.isWindowsPlatform(): |
238 try: |
242 try: |
239 info, text = line.split(": ", 1) |
243 info, text = line.split(": ", 1) |
240 except ValueError: |
244 except ValueError: |
241 info = line[:-2] |
245 info = line[:-2] |
242 text = "" |
246 text = "" |
243 author, rev, changeset, date, file = info.split() |
247 match = self.__annotateRe.match(info) |
244 self.__generateItem(rev, changeset, author, date, text) |
248 author, rev, changeset, date, file = match.groups() |
|
249 self.__generateItem(rev.strip(), changeset.strip(), author.strip(), |
|
250 date.strip(), text) |
245 |
251 |
246 def __readStderr(self): |
252 def __readStderr(self): |
247 """ |
253 """ |
248 Private slot to handle the readyReadStderr signal. |
254 Private slot to handle the readyReadStderr signal. |
249 |
255 |