Plugins/VcsPlugins/vcsMercurial/HgAnnotateDialog.py

branch
Py2 comp.
changeset 3515
1b8381afe38f
parent 3484
645c12de6b0c
parent 3469
53a53c45a3f0
child 3591
2f2a4a76dd22
equal deleted inserted replaced
3506:d85fadb263a0 3515:1b8381afe38f
12 str = unicode 12 str = unicode
13 except NameError: 13 except NameError:
14 pass 14 pass
15 15
16 import os 16 import os
17 import re
17 18
18 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, Qt, QCoreApplication 19 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, Qt, QCoreApplication
19 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, QLineEdit, \ 20 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, QLineEdit, \
20 QTreeWidgetItem 21 QTreeWidgetItem
21 22
43 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 44 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
44 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 45 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
45 46
46 self.vcs = vcs 47 self.vcs = vcs
47 self.__hgClient = vcs.getClient() 48 self.__hgClient = vcs.getClient()
49
50 self.__annotateRe = re.compile(
51 r"""(.+)\s+(\d+)\s+([0-9a-fA-F]+)\s+([0-9-]+)\s+(.+)""")
48 52
49 self.annotateList.headerItem().setText( 53 self.annotateList.headerItem().setText(
50 self.annotateList.columnCount(), "") 54 self.annotateList.columnCount(), "")
51 font = Preferences.getEditorOtherFonts("MonospacedFont") 55 font = Preferences.getEditorOtherFonts("MonospacedFont")
52 self.annotateList.setFont(font) 56 self.annotateList.setFont(font)
236 try: 240 try:
237 info, text = line.split(": ", 1) 241 info, text = line.split(": ", 1)
238 except ValueError: 242 except ValueError:
239 info = line[:-2] 243 info = line[:-2]
240 text = "" 244 text = ""
241 author, rev, changeset, date, file = info.split() 245 match = self.__annotateRe.match(info)
242 self.__generateItem(rev, changeset, author, date, text) 246 author, rev, changeset, date, file = match.groups()
247 self.__generateItem(rev.strip(), changeset.strip(), author.strip(),
248 date.strip(), text)
243 249
244 def __readStderr(self): 250 def __readStderr(self):
245 """ 251 """
246 Private slot to handle the readyReadStderr signal. 252 Private slot to handle the readyReadStderr signal.
247 253

eric ide

mercurial