Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

Mon, 25 Mar 2013 03:11:06 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Mon, 25 Mar 2013 03:11:06 +0100
branch
Py2 comp.
changeset 2525
8b507a9a2d40
parent 2444
0fdd7f9ebd0b
child 2545
2d385ccc14f9
permissions
-rw-r--r--

Script changes: Future import added, super calls modified and unicode behavior for str.

178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
2302
f29e9405c851 Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2223
diff changeset
3 # Copyright (c) 2010 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to browse the log history.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2444
diff changeset
10 from __future__ import unicode_literals # __IGNORE_WARNING__
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2444
diff changeset
11 try:
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2444
diff changeset
12 str = unicode
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2444
diff changeset
13 except (NameError):
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2444
diff changeset
14 pass
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2444
diff changeset
15
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import os
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
18 from PyQt4.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
19 QSize, QPoint
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
20 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, \
1131
7781e396c903 Changed the code to use super() to access the superclass.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1086
diff changeset
21 QTreeWidgetItem, QApplication, QCursor, QLineEdit, QColor, \
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
22 QPixmap, QPainter, QPen, QBrush, QIcon
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 204
diff changeset
24 from E5Gui.E5Application import e5App
537
72b32daeb8d6 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 470
diff changeset
25 from E5Gui import E5MessageBox
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 204
diff changeset
26
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 from .Ui_HgLogBrowserDialog import Ui_HgLogBrowserDialog
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 import Preferences
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
31 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple",
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
32 "cyan", "olive", "magenta", "darkred", "darkmagenta",
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
33 "darkcyan", "gray", "yellow"]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
34 COLORS = [str(QColor(x).name()) for x in COLORNAMES]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
35
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
36
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 class HgLogBrowserDialog(QDialog, Ui_HgLogBrowserDialog):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 Class implementing a dialog to browse the log history.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
41 IconColumn = 0
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
42 BranchColumn = 1
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
43 RevisionColumn = 2
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
44 PhaseColumn = 3
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
45 AuthorColumn = 4
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
46 DateColumn = 5
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
47 MessageColumn = 6
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
48 TagsColumn = 7
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
49
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
50 def __init__(self, vcs, mode="log", bundle=None, parent=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 Constructor
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 @param vcs reference to the vcs object
215
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
55 @param mode mode of the dialog (string; one of log, incoming, outgoing)
213
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
56 @param bundle name of a bundle file (string)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 @param parent parent widget (QWidget)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2444
diff changeset
59 super(HgLogBrowserDialog, self).__init__(parent)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.setupUi(self)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
782
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
62 if mode == "log":
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
63 self.setWindowTitle(self.trUtf8("Mercurial Log"))
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
64 elif mode == "incoming":
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
65 self.setWindowTitle(self.trUtf8("Mercurial Log (Incoming)"))
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
66 elif mode == "outgoing":
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
67 self.setWindowTitle(self.trUtf8("Mercurial Log (Outgoing)"))
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
68
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
75 self.refreshButton = \
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
76 self.buttonBox.addButton(self.trUtf8("&Refresh"), QDialogButtonBox.ActionRole)
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
77 self.refreshButton.setToolTip(
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
78 self.trUtf8("Press to refresh the list of changesets"))
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
79 self.refreshButton.setEnabled(False)
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
80
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.vcs = vcs
181
4af57f97c1bc Added code to choose the way incoming and outgoing logs are shown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 180
diff changeset
82 if mode in ("log", "incoming", "outgoing"):
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
83 self.commandMode = mode
1264
da42fd833a66 Fixed a little bug in the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1263
diff changeset
84 self.initialCommandMode = mode
181
4af57f97c1bc Added code to choose the way incoming and outgoing logs are shown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 180
diff changeset
85 else:
215
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
86 self.commandMode = "log"
213
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
87 self.bundle = bundle
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
88 self.__hgClient = vcs.getClient()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
90 self.__initData()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
91
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
92 self.__allBranchesFilter = self.trUtf8("All")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 self.fromDate.setDisplayFormat("yyyy-MM-dd")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 self.toDate.setDisplayFormat("yyyy-MM-dd")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.fromDate.setDate(QDate.currentDate())
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.toDate.setDate(QDate.currentDate())
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
98 self.fieldCombo.setCurrentIndex(self.fieldCombo.findText(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
99 self.trUtf8("Message")))
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
100 self.limitSpinBox.setValue(self.vcs.getPlugin().getPreferences(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
101 "LogLimit"))
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
102 self.stopCheckBox.setChecked(self.vcs.getPlugin().getPreferences(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
103 "StopLogOnCopy"))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104
779
04c3a6026543 Fixed an issue where long incoming patchsets were not shown completely.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
105 if mode in ("incoming", "outgoing"):
04c3a6026543 Fixed an issue where long incoming patchsets were not shown completely.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
106 self.nextButton.setEnabled(False)
04c3a6026543 Fixed an issue where long incoming patchsets were not shown completely.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
107 self.limitSpinBox.setEnabled(False)
04c3a6026543 Fixed an issue where long incoming patchsets were not shown completely.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
108
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 self.__messageRole = Qt.UserRole
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
110 self.__changesRole = Qt.UserRole + 1
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
111 self.__edgesRole = Qt.UserRole + 2
208
26ed553ad4fb Corrected the diff functions of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 207
diff changeset
112 self.__parentsRole = Qt.UserRole + 3
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
114 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
115 self.process = None
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
116 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
117 self.process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
118 self.process.finished.connect(self.__procFinished)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
119 self.process.readyReadStandardOutput.connect(self.__readStdout)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
120 self.process.readyReadStandardError.connect(self.__readStderr)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self.flags = {
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
123 'A': self.trUtf8('Added'),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
124 'D': self.trUtf8('Deleted'),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
125 'M': self.trUtf8('Modified'),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 }
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
128 self.__dotRadius = 8
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
129 self.__rowHeight = 20
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
130
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
131 self.logTree.setIconSize(
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
132 QSize(100 * self.__rowHeight, self.__rowHeight))
1263
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
133 if self.vcs.version >= (1, 8):
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
134 self.logTree.headerItem().setText(self.logTree.columnCount(),
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
135 self.trUtf8("Bookmarks"))
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
136 if self.vcs.version < (2, 1):
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
137 self.logTree.setColumnHidden(self.PhaseColumn, True)
1608
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1605
diff changeset
138 self.phaseLine.hide()
b6390d242303 Added capability to change the phase of changesets to the project VCS menu and the Mercurial log-browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1605
diff changeset
139 self.phaseButton.hide()
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
140
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
141 def __initData(self):
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
142 """
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
143 Private method to (re-)initialize some data.
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
144 """
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
145 self.__maxDate = QDate()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
146 self.__minDate = QDate()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
147 self.__filterLogsEnabled = True
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
148
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 self.buf = [] # buffer for stdout
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 self.diff = None
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 self.__started = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 self.__lastRev = 0
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
153 self.projectMode = False
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
154
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
155 # attributes to store log graph data
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
156 self.__revs = []
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
157 self.__revColors = {}
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
158 self.__revColor = 0
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
159
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
160 self.__branchColors = {}
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
161
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
162 self.__projectRevision = -1
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 def closeEvent(self, e):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 Private slot implementing a close event handler.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 @param e close event (QCloseEvent)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 """
1256
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
170 if self.__hgClient:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
171 if self.__hgClient.isExecuting():
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
172 self.__hgClient.cancel()
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
173 else:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
174 if self.process is not None and \
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
175 self.process.state() != QProcess.NotRunning:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
176 self.process.terminate()
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
177 QTimer.singleShot(2000, self.process.kill)
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
178 self.process.waitForFinished(3000)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 e.accept()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 def __resizeColumnsLog(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 Private method to resize the log tree columns.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 self.logTree.header().resizeSections(QHeaderView.ResizeToContents)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 self.logTree.header().setStretchLastSection(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 def __resizeColumnsFiles(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 Private method to resize the changed files tree columns.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 self.filesTree.header().resizeSections(QHeaderView.ResizeToContents)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 self.filesTree.header().setStretchLastSection(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 def __resortFiles(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 Private method to resort the changed files tree.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 sortColumn = self.filesTree.sortColumn()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
201 self.filesTree.sortItems(1,
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 self.filesTree.header().sortIndicatorOrder())
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
203 self.filesTree.sortItems(sortColumn,
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 self.filesTree.header().sortIndicatorOrder())
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
206 def __getColor(self, n):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
207 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
208 Private method to get the (rotating) name of the color given an index.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
209
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
210 @param n color index (integer)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
211 @return color name (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
212 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
213 return COLORS[n % len(COLORS)]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
214
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
215 def __branchColor(self, branchName):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
216 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
217 Private method to calculate a color for a given branch name.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
218
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
219 @param branchName name of the branch (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
220 @return name of the color to use (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
221 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
222 if branchName not in self.__branchColors:
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
223 self.__branchColors[branchName] = self.__getColor(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
224 len(self.__branchColors))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
225 return self.__branchColors[branchName]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
226
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
227 def __generateEdges(self, rev, parents):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
228 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
229 Private method to generate edge info for the give data.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
230
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
231 @param rev revision to calculate edge info for (integer)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
232 @param parents list of parent revisions (list of integers)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
233 @return tuple containing the column and color index for
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
234 the given node and a list of tuples indicating the edges
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
235 between the given node and its parents
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
236 (integer, integer, [(integer, integer, integer), ...])
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
237 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
238 if rev not in self.__revs:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
239 # new head
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
240 self.__revs.append(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
241 self.__revColors[rev] = self.__revColor
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
242 self.__revColor += 1
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
243
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
244 col = self.__revs.index(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
245 color = self.__revColors.pop(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
246 next = self.__revs[:]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
247
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
248 # add parents to next
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
249 addparents = [p for p in parents if p not in next]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
250 next[col:col + 1] = addparents
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
251
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
252 # set colors for the parents
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
253 for i, p in enumerate(addparents):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
254 if not i:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
255 self.__revColors[p] = color
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
256 else:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
257 self.__revColors[p] = self.__revColor
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
258 self.__revColor += 1
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
259
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
260 # add edges to the graph
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
261 edges = []
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
262 if parents[0] != -1:
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
263 for ecol, erev in enumerate(self.__revs):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
264 if erev in next:
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
265 edges.append(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
266 (ecol, next.index(erev), self.__revColors[erev]))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
267 elif erev == rev:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
268 for p in parents:
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
269 edges.append(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
270 (ecol, next.index(p), self.__revColors[p]))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
271
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
272 self.__revs = next
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
273 return col, color, edges
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
274
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
275 def __generateIcon(self, column, color, bottomedges, topedges, dotColor,
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
276 currentRev, closed):
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
277 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
278 Private method to generate an icon containing the revision tree for the
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
279 given data.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
280
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
281 @param column column index of the revision (integer)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
282 @param color color of the node (integer)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
283 @param bottomedges list of edges for the bottom of the node
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
284 (list of tuples of three integers)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
285 @param topedges list of edges for the top of the node
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
286 (list of tuples of three integers)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
287 @param dotColor color to be used for the dot (QColor)
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
288 @param currentRev flag indicating to draw the icon for the
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
289 current revision (boolean)
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
290 @param closed flag indicating to draw an icon for a closed
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
291 branch (boolean)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
292 @return icon for the node (QIcon)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
293 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
294 def col2x(col, radius):
244
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 243
diff changeset
295 """
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 243
diff changeset
296 Local function to calculate a x-position for a column.
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 243
diff changeset
297
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 243
diff changeset
298 @param col column number (integer)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 243
diff changeset
299 @param radius radius of the indicator circle (integer)
30be2b4a9721 Added a menu to the highlighting styles config page to change individual aspects of a font only.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 243
diff changeset
300 """
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
301 return int(1.2 * radius) * col + radius // 2 + 3
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
302
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
303 radius = self.__dotRadius
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
304 w = len(bottomedges) * radius + 20
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
305 h = self.__rowHeight
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
306
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
307 dot_x = col2x(column, radius) - radius // 2
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
308 dot_y = h // 2
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
309
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
310 pix = QPixmap(w, h)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
311 pix.fill(QColor(0, 0, 0, 0))
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
312 painter = QPainter(pix)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
313 painter.setRenderHint(QPainter.Antialiasing)
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
314
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
315 pen = QPen(Qt.blue)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
316 pen.setWidth(2)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
317 painter.setPen(pen)
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
318
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
319 lpen = QPen(pen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
320 lpen.setColor(Qt.black)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
321 painter.setPen(lpen)
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
322
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
323 # draw the revision history lines
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
324 for y1, y2, lines in ((0, h, bottomedges),
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
325 (-h, 0, topedges)):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
326 if lines:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
327 for start, end, ecolor in lines:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
328 lpen = QPen(pen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
329 lpen.setColor(QColor(self.__getColor(ecolor)))
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
330 lpen.setWidth(2)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
331 painter.setPen(lpen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
332 x1 = col2x(start, radius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
333 x2 = col2x(end, radius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
334 painter.drawLine(x1, dot_y + y1, x2, dot_y + y2)
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
335
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
336 penradius = 1
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
337 pencolor = Qt.black
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
338
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
339 dot_y = (h // 2) - radius // 2
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
340
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
341 # draw a dot for the revision
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
342 if currentRev:
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
343 # enlarge dot for the current revision
1637
b60eb2fdbaea Improved the indication of the current branches head in the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1608
diff changeset
344 delta = 1
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
345 radius += 2 * delta
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
346 dot_y -= delta
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
347 dot_x -= delta
1637
b60eb2fdbaea Improved the indication of the current branches head in the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1608
diff changeset
348 penradius = 3
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
349 painter.setBrush(dotColor)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
350 pen = QPen(pencolor)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
351 pen.setWidth(penradius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
352 painter.setPen(pen)
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
353 if closed:
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
354 painter.drawRect(dot_x - 2, dot_y + 1,
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
355 radius + 4, radius - 2)
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
356 elif self.commandMode in ("incoming", "outgoing"):
781
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
357 offset = radius // 2
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
358 painter.drawConvexPolygon(
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
359 QPoint(dot_x + offset, dot_y),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
360 QPoint(dot_x, dot_y + offset),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
361 QPoint(dot_x + offset, dot_y + 2 * offset),
781
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
362 QPoint(dot_x + 2 * offset, dot_y + offset)
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
363 )
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
364 else:
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
365 painter.drawEllipse(dot_x, dot_y, radius, radius)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
366 painter.end()
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
367 return QIcon(pix)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
368
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
369 def __getParents(self, rev):
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
370 """
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
371 Private method to get the parents of the currently viewed
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
372 file/directory.
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
373
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
374 @param rev revision number to get parents for (string)
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
375 @return list of parent revisions (list of integers)
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
376 """
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
377 errMsg = ""
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
378 parents = [-1]
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
379
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
380 args = []
210
b1a204f22291 Fixed a few issues with the Mercurial log dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 208
diff changeset
381 args.append("parents")
215
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
382 if self.commandMode == "incoming":
213
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
383 if self.bundle:
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
384 args.append("--repository")
215
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
385 args.append(self.bundle)
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
386 elif self.vcs.bundleFile and os.path.exists(self.vcs.bundleFile):
213
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
387 args.append("--repository")
215
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
388 args.append(self.vcs.bundleFile)
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
389 args.append("--template")
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
390 args.append("{rev}\n")
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
391 args.append("-r")
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
392 args.append(rev)
210
b1a204f22291 Fixed a few issues with the Mercurial log dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 208
diff changeset
393 if not self.projectMode:
b1a204f22291 Fixed a few issues with the Mercurial log dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 208
diff changeset
394 args.append(self.filename)
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
395
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
396 output = ""
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
397 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
398 output, errMsg = self.__hgClient.runcommand(args)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
399 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
400 process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
401 process.setWorkingDirectory(self.repodir)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
402 process.start('hg', args)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
403 procStarted = process.waitForStarted()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
404 if procStarted:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
405 finished = process.waitForFinished(30000)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
406 if finished and process.exitCode() == 0:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
407 output = \
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
408 str(process.readAllStandardOutput(),
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
409 Preferences.getSystem("IOEncoding"),
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
410 'replace')
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
411 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
412 if not finished:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
413 errMsg = self.trUtf8(
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
414 "The hg process did not finish within 30s.")
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
415 else:
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
416 errMsg = self.trUtf8("Could not start the hg executable.")
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
417
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
418 if errMsg:
537
72b32daeb8d6 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 470
diff changeset
419 E5MessageBox.critical(self,
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
420 self.trUtf8("Mercurial Error"),
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
421 errMsg)
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
422
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
423 if output:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
424 parents = [int(p) for p in output.strip().splitlines()]
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
425
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
426 return parents
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
427
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
428 def __identifyProject(self):
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
429 """
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
430 Private method to determine the revision of the project directory.
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
431 """
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
432 errMsg = ""
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
433
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
434 args = []
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
435 args.append("identify")
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
436 args.append("-n")
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
437
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
438 output = ""
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
439 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
440 output, errMsg = self.__hgClient.runcommand(args)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
441 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
442 process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
443 process.setWorkingDirectory(self.repodir)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
444 process.start('hg', args)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
445 procStarted = process.waitForStarted()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
446 if procStarted:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
447 finished = process.waitForFinished(30000)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
448 if finished and process.exitCode() == 0:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
449 output = \
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
450 str(process.readAllStandardOutput(),
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
451 Preferences.getSystem("IOEncoding"),
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
452 'replace')
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
453 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
454 if not finished:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
455 errMsg = self.trUtf8(
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
456 "The hg process did not finish within 30s.")
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
457 else:
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
458 errMsg = self.trUtf8("Could not start the hg executable.")
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
459
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
460 if errMsg:
537
72b32daeb8d6 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 470
diff changeset
461 E5MessageBox.critical(self,
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
462 self.trUtf8("Mercurial Error"),
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
463 errMsg)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
464
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
465 if output:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
466 self.__projectRevision = output.strip()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
467 if self.__projectRevision.endswith("+"):
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
468 self.__projectRevision = self.__projectRevision[:-1]
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
469
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
470 def __getClosedBranches(self):
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
471 """
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
472 Private method to get the list of closed branches.
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
473 """
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
474 self.__closedBranchesRevs = []
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
475 errMsg = ""
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
476
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
477 args = []
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
478 args.append("branches")
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
479 args.append("--closed")
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
480
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
481 output = ""
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
482 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
483 output, errMsg = self.__hgClient.runcommand(args)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
484 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
485 process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
486 process.setWorkingDirectory(self.repodir)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
487 process.start('hg', args)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
488 procStarted = process.waitForStarted()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
489 if procStarted:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
490 finished = process.waitForFinished(30000)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
491 if finished and process.exitCode() == 0:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
492 output = \
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
493 str(process.readAllStandardOutput(),
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
494 Preferences.getSystem("IOEncoding"),
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
495 'replace')
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
496 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
497 if not finished:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
498 errMsg = self.trUtf8(
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
499 "The hg process did not finish within 30s.")
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
500 else:
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
501 errMsg = self.trUtf8("Could not start the hg executable.")
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
502
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
503 if errMsg:
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
504 E5MessageBox.critical(self,
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
505 self.trUtf8("Mercurial Error"),
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
506 errMsg)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
507
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
508 if output:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
509 for line in output.splitlines():
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
510 if line.strip().endswith("(closed)"):
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
511 parts = line.split()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
512 self.__closedBranchesRevs.append(
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
513 parts[-2].split(":", 1)[0])
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
514
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
515 def __generateLogItem(self, author, date, message, revision, changedPaths,
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
516 parents, branches, tags, phase, bookmarks=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 Private method to generate a log tree entry.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 @param author author info (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 @param date date info (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 @param message text of the log message (list of strings)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 @param revision revision info (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 @param changedPaths list of dictionary objects containing
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
525 info about the changed files/directories
179
09260f69bf37 Included parents info in log browser items.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 178
diff changeset
526 @param parents list of parent revisions (list of integers)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
527 @param branches list of branches (list of strings)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
528 @param tags list of tags (string)
2444
0fdd7f9ebd0b Fixed a source docu and regenerated them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2405
diff changeset
529 @param phase phase of the entry (string)
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
530 @param bookmarks list of bookmarks (string)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 @return reference to the generated item (QTreeWidgetItem)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 msg = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 for line in message:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535 msg.append(line.strip())
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
536
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 rev, node = revision.split(":")
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
538 if rev in self.__closedBranchesRevs:
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
539 closedStr = "--"
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
540 else:
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
541 closedStr = ""
185
f002e13c9aed Some more finetuning of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 181
diff changeset
542 msgtxt = msg[0]
f002e13c9aed Some more finetuning of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 181
diff changeset
543 if len(msgtxt) > 30:
f002e13c9aed Some more finetuning of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 181
diff changeset
544 msgtxt = "{0}...".format(msgtxt[:30])
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
545 columnLabels = [
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
546 "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
547 branches[0] + closedStr,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
548 "{0:>7}:{1}".format(rev, node),
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
549 phase,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
550 author,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
551 date,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
552 msgtxt,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
553 ", ".join(tags),
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
554 ]
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
555 if bookmarks is not None:
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
556 columnLabels.append(", ".join(bookmarks))
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
557 itm = QTreeWidgetItem(self.logTree, columnLabels)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
559 itm.setForeground(self.BranchColumn,
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
560 QBrush(QColor(self.__branchColor(branches[0]))))
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
561
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
562 if not self.projectMode:
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
563 parents = self.__getParents(rev)
208
26ed553ad4fb Corrected the diff functions of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 207
diff changeset
564 if not parents:
26ed553ad4fb Corrected the diff functions of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 207
diff changeset
565 parents = [int(rev) - 1]
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
566 column, color, edges = self.__generateEdges(int(rev), parents)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
567
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 itm.setData(0, self.__messageRole, message)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
569 itm.setData(0, self.__changesRole, changedPaths)
210
b1a204f22291 Fixed a few issues with the Mercurial log dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 208
diff changeset
570 itm.setData(0, self.__edgesRole, edges)
208
26ed553ad4fb Corrected the diff functions of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 207
diff changeset
571 itm.setData(0, self.__parentsRole, parents)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
573 if self.logTree.topLevelItemCount() > 1:
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
574 topedges = \
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
575 self.logTree.topLevelItem(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
576 self.logTree.indexOfTopLevelItem(itm) - 1)\
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
577 .data(0, self.__edgesRole)
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
578 else:
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
579 topedges = None
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
580
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
581 icon = self.__generateIcon(column, color, edges, topedges,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
582 QColor(self.__branchColor(branches[0])),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
583 rev == self.__projectRevision,
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
584 rev in self.__closedBranchesRevs)
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
585 itm.setIcon(0, icon)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 try:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 self.__lastRev = int(revision.split(":")[0])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 except ValueError:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 self.__lastRev = 0
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
592 return itm
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
594 def __generateFileItem(self, action, path, copyfrom):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
596 Private method to generate a changed files tree entry.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 @param action indicator for the change action ("A", "D" or "M")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 @param path path of the file in the repository (string)
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
600 @param copyfrom path the file was copied from (string)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 @return reference to the generated item (QTreeWidgetItem)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 itm = QTreeWidgetItem(self.filesTree, [
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
604 self.flags[action],
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
605 path,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
606 copyfrom,
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 ])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 return itm
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
611 def __getLogEntries(self, startRev=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 Private method to retrieve log entries from the repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 @param startRev revision number to start from (integer, string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
618 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 QApplication.processEvents()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 QApplication.processEvents()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 self.buf = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 self.cancelled = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 self.errors.clear()
1269
7b4d9f1d7c6c Fixed an issue in the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1265
diff changeset
628 self.intercept = False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 args = []
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
631 args.append(self.commandMode)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 self.vcs.addArguments(args, self.vcs.options['global'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 self.vcs.addArguments(args, self.vcs.options['log'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 args.append('--verbose')
779
04c3a6026543 Fixed an issue where long incoming patchsets were not shown completely.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
635 if self.commandMode not in ("incoming", "outgoing"):
04c3a6026543 Fixed an issue where long incoming patchsets were not shown completely.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
636 args.append('--limit')
04c3a6026543 Fixed an issue where long incoming patchsets were not shown completely.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
637 args.append(str(self.limitSpinBox.value()))
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
638 if self.commandMode in ("incoming", "outgoing"):
181
4af57f97c1bc Added code to choose the way incoming and outgoing logs are shown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 180
diff changeset
639 args.append("--newest-first")
1906
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1637
diff changeset
640 if self.vcs.hasSubrepositories():
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1637
diff changeset
641 args.append("--subrepos")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 if startRev is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 args.append('--rev')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 args.append('{0}:0'.format(startRev))
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
645 if not self.projectMode and \
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
646 not self.fname == "." and \
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
647 not self.stopCheckBox.isChecked():
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 args.append('--follow')
204
61552f56788a Fixed an issue introduced by the last change to Mercurial log browser and dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 203
diff changeset
649 if self.commandMode == "log":
61552f56788a Fixed an issue introduced by the last change to Mercurial log browser and dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 203
diff changeset
650 args.append('--copies')
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
651 args.append('--style')
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
652 if self.vcs.version >= (2, 1):
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
653 args.append(os.path.join(os.path.dirname(__file__),
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
654 "styles", "logBrowserBookmarkPhase.style"))
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
655 elif self.vcs.version >= (1, 8):
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
656 args.append(os.path.join(os.path.dirname(__file__),
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
657 "styles", "logBrowserBookmark.style"))
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
658 else:
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
659 args.append(os.path.join(os.path.dirname(__file__),
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
660 "styles", "logBrowser.style"))
215
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
661 if self.commandMode == "incoming":
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
662 if self.bundle:
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
663 args.append(self.bundle)
1906
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1637
diff changeset
664 elif not self.vcs.hasSubrepositories():
213
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
665 project = e5App().getObject("Project")
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
666 self.vcs.bundleFile = os.path.join(
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
667 project.getProjectManagementDir(), "hg-bundle.hg")
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
668 args.append('--bundle')
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
669 args.append(self.vcs.bundleFile)
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
670 if not self.projectMode:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 args.append(self.filename)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
673 if self.__hgClient:
1242
dfb9609caf51 Continued implementing an interface to the Mercurial command server. Modified client all all dialogs done so far to provide a cancel capability..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1241
diff changeset
674 self.inputGroup.setEnabled(False)
dfb9609caf51 Continued implementing an interface to the Mercurial command server. Modified client all all dialogs done so far to provide a cancel capability..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1241
diff changeset
675 self.inputGroup.hide()
dfb9609caf51 Continued implementing an interface to the Mercurial command server. Modified client all all dialogs done so far to provide a cancel capability..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1241
diff changeset
676
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
677 out, err = self.__hgClient.runcommand(args)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
678 self.buf = out.splitlines(True)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
679 if err:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
680 self.__showError(err)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
681 self.__processBuffer()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
682 self.__finish()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
683 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
684 self.process.kill()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
685
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
686 self.process.setWorkingDirectory(self.repodir)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
687
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
688 self.inputGroup.setEnabled(True)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
689 self.inputGroup.show()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
690
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
691 self.process.start('hg', args)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
692 procStarted = self.process.waitForStarted()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
693 if not procStarted:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
694 self.inputGroup.setEnabled(False)
1248
7d0eff6435a9 Added a forgotten line of code to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1242
diff changeset
695 self.inputGroup.hide()
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
696 E5MessageBox.critical(self,
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
697 self.trUtf8('Process Generation Error'),
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
698 self.trUtf8(
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
699 'The process {0} could not be started. '
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
700 'Ensure, that it is in the search path.'
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
701 ).format('hg'))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 def start(self, fn):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704 """
198
7ab8e126f404 Fixed a few issues with the Mercurial plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 187
diff changeset
705 Public slot to start the hg log command.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
706
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707 @param fn filename to show the log for (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
708 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 self.errorGroup.hide()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 QApplication.processEvents()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 self.filename = fn
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713 self.dname, self.fname = self.vcs.splitPath(fn)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 self.repodir = self.dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717 while not os.path.isdir(os.path.join(self.repodir, self.vcs.adminDir)):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 self.repodir = os.path.dirname(self.repodir)
1324
370e8b9cfc23 Fixed an issue introduced by the last fix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1319
diff changeset
719 if os.path.splitdrive(self.repodir)[1] == os.sep:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
722 self.projectMode = (self.fname == "." and self.dname == self.repodir)
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
723 self.stopCheckBox.setDisabled(self.projectMode or self.fname == ".")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 self.activateWindow()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 self.raise_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 self.logTree.clear()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 self.__started = True
243
a1d982e68edf Fixed an issue introduced by the latest change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 241
diff changeset
729 self.__identifyProject()
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
730 self.__getClosedBranches()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 self.__getLogEntries()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 def __procFinished(self, exitCode, exitStatus):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 Private slot connected to the finished signal.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 @param exitCode exit code of the process (integer)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 @param exitStatus exit status of the process (QProcess.ExitStatus)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 self.__processBuffer()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 self.__finish()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 def __finish(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 """
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
745 Private slot called when the process finished or the user pressed
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
746 the button.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748 if self.process is not None and \
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 self.process.state() != QProcess.NotRunning:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 self.process.terminate()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 QTimer.singleShot(2000, self.process.kill)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 self.process.waitForFinished(3000)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 QApplication.restoreOverrideCursor()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 self.inputGroup.setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 self.inputGroup.hide()
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
762 self.refreshButton.setEnabled(True)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 def __processBuffer(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 """
198
7ab8e126f404 Fixed a few issues with the Mercurial plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 187
diff changeset
766 Private method to process the buffered output of the hg log command.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768 noEntries = 0
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
769 log = {"message": [], "bookmarks": None, "phase": ""}
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 changedPaths = []
181
4af57f97c1bc Added code to choose the way incoming and outgoing logs are shown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 180
diff changeset
771 initialText = True
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
772 fileCopies = {}
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 for s in self.buf:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 if s != "@@@\n":
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 try:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 key, value = s.split("|", 1)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 except ValueError:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 key = ""
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 value = s
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 if key == "change":
181
4af57f97c1bc Added code to choose the way incoming and outgoing logs are shown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 180
diff changeset
781 initialText = False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 log["revision"] = value.strip()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 elif key == "user":
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
784 log["author"] = value.strip()
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
785 elif key == "parents":
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
786 log["parents"] = \
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
787 [int(x.split(":", 1)[0])
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
788 for x in value.strip().split()]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 elif key == "date":
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 log["date"] = " ".join(value.strip().split()[:2])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 elif key == "description":
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 log["message"].append(value.strip())
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 elif key == "file_adds":
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 if value.strip():
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
795 for f in value.strip().split(", "):
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
796 if f in fileCopies:
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
797 changedPaths.append({
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
798 "action": "A",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
799 "path": f,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
800 "copyfrom": fileCopies[f],
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
801 })
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
802 else:
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
803 changedPaths.append({
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
804 "action": "A",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
805 "path": f,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
806 "copyfrom": "",
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
807 })
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808 elif key == "files_mods":
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 if value.strip():
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
810 for f in value.strip().split(", "):
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
811 changedPaths.append({
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
812 "action": "M",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
813 "path": f,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
814 "copyfrom": "",
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 })
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 elif key == "file_dels":
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 if value.strip():
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
818 for f in value.strip().split(", "):
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
819 changedPaths.append({
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
820 "action": "D",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
821 "path": f,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
822 "copyfrom": "",
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 })
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
824 elif key == "file_copies":
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
825 if value.strip():
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
826 for entry in value.strip().split(", "):
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
827 newName, oldName = entry[:-1].split(" (")
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
828 fileCopies[newName] = oldName
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
829 elif key == "branches":
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
830 if value.strip():
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
831 log["branches"] = value.strip().split(", ")
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
832 else:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
833 log["branches"] = ["default"]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
834 elif key == "tags":
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
835 log["tags"] = value.strip().split(", ")
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
836 elif key == "bookmarks":
1019
d8a9697f78d1 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1017
diff changeset
837 log["bookmarks"] = value.strip().split(", ")
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
838 elif key == "phase":
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
839 log["phase"] = value.strip()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 else:
181
4af57f97c1bc Added code to choose the way incoming and outgoing logs are shown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 180
diff changeset
841 if initialText:
4af57f97c1bc Added code to choose the way incoming and outgoing logs are shown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 180
diff changeset
842 continue
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
843 if value.strip():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844 log["message"].append(value.strip())
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
845 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846 if len(log) > 1:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
847 self.__generateLogItem(log["author"], log["date"],
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
848 log["message"], log["revision"], changedPaths,
1061
3e21869872e3 Fixed PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1019
diff changeset
849 log["parents"], log["branches"], log["tags"],
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
850 log["phase"], log["bookmarks"])
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851 dt = QDate.fromString(log["date"], Qt.ISODate)
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
852 if not self.__maxDate.isValid() and \
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
853 not self.__minDate.isValid():
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 self.__maxDate = dt
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 self.__minDate = dt
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857 if self.__maxDate < dt:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 self.__maxDate = dt
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859 if self.__minDate > dt:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
860 self.__minDate = dt
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
861 noEntries += 1
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
862 log = {"message": [], "bookmarks": None, "phase": ""}
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 changedPaths = []
203
0bd3912f3c5f Refined the Mercurial log browser and log dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 201
diff changeset
864 fileCopies = {}
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866 self.__resizeColumnsLog()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
868 if self.__started:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869 self.logTree.setCurrentItem(self.logTree.topLevelItem(0))
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870 self.__started = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871
781
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
872 if self.commandMode in ("incoming", "outgoing"):
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
873 self.commandMode = "log" # switch to log mode
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
874 if self.__lastRev > 0:
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
875 self.nextButton.setEnabled(True)
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
876 self.limitSpinBox.setEnabled(True)
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
877 else:
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
878 if noEntries < self.limitSpinBox.value() and not self.cancelled:
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
879 self.nextButton.setEnabled(False)
2f85b5573e62 Changed the Mercurial log browser to show incoming/outgoing changesets with the current log (by pressing the next button).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
880 self.limitSpinBox.setEnabled(False)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
881
316
b7e499650928 Added a branch filter to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 296
diff changeset
882 # update the log filters
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
883 self.__filterLogsEnabled = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
884 self.fromDate.setMinimumDate(self.__minDate)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
885 self.fromDate.setMaximumDate(self.__maxDate)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
886 self.fromDate.setDate(self.__minDate)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
887 self.toDate.setMinimumDate(self.__minDate)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 self.toDate.setMaximumDate(self.__maxDate)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 self.toDate.setDate(self.__maxDate)
316
b7e499650928 Added a branch filter to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 296
diff changeset
890
b7e499650928 Added a branch filter to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 296
diff changeset
891 branchFilter = self.branchCombo.currentText()
b7e499650928 Added a branch filter to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 296
diff changeset
892 if not branchFilter:
b7e499650928 Added a branch filter to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 296
diff changeset
893 branchFilter = self.__allBranchesFilter
b7e499650928 Added a branch filter to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 296
diff changeset
894 self.branchCombo.clear()
b7e499650928 Added a branch filter to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 296
diff changeset
895 self.branchCombo.addItems(
b7e499650928 Added a branch filter to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 296
diff changeset
896 [self.__allBranchesFilter] + sorted(self.__branchColors.keys()))
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
897 self.branchCombo.setCurrentIndex(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
898 self.branchCombo.findText(branchFilter))
316
b7e499650928 Added a branch filter to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 296
diff changeset
899
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
900 self.__filterLogsEnabled = True
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901 self.__filterLogs()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903 def __readStdout(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
905 Private slot to handle the readyReadStandardOutput signal.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 It reads the output of the process and inserts it into a buffer.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
909 self.process.setReadChannel(QProcess.StandardOutput)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
910
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 while self.process.canReadLine():
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
912 line = str(self.process.readLine(),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
913 Preferences.getSystem("IOEncoding"),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914 'replace')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 self.buf.append(line)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
916
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 def __readStderr(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
919 Private slot to handle the readyReadStandardError signal.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921 It reads the error output of the process and inserts it into the
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 error pane.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
923 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 if self.process is not None:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
925 s = str(self.process.readAllStandardError(),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
926 Preferences.getSystem("IOEncoding"),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 'replace')
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
928 self.__showError(s)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
929
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
930 def __showError(self, out):
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
931 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
932 Private slot to show some error.
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
933
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
934 @param out error to be shown (string)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
935 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
936 self.errorGroup.show()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
937 self.errors.insertPlainText(out)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
938 self.errors.ensureCursorVisible()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 def __diffRevisions(self, rev1, rev2):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942 Private method to do a diff of two revisions.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 @param rev1 first revision number (integer)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 @param rev2 second revision number (integer)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 """
1265
22f70d13a41e Made some window handling smoother.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1264
diff changeset
947 if self.diff is None:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
948 from .HgDiffDialog import HgDiffDialog
1265
22f70d13a41e Made some window handling smoother.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1264
diff changeset
949 self.diff = HgDiffDialog(self.vcs)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 self.diff.show()
213
42bb97ff0bbb Added code to preview a changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 210
diff changeset
951 self.diff.start(self.filename, [rev1, rev2], self.bundle)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953 def on_buttonBox_clicked(self, button):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955 Private slot called by a button of the button box clicked.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957 @param button button that was clicked (QAbstractButton)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959 if button == self.buttonBox.button(QDialogButtonBox.Close):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
960 self.close()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961 elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 self.cancelled = True
1242
dfb9609caf51 Continued implementing an interface to the Mercurial command server. Modified client all all dialogs done so far to provide a cancel capability..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1241
diff changeset
963 if self.__hgClient:
dfb9609caf51 Continued implementing an interface to the Mercurial command server. Modified client all all dialogs done so far to provide a cancel capability..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1241
diff changeset
964 self.__hgClient.cancel()
dfb9609caf51 Continued implementing an interface to the Mercurial command server. Modified client all all dialogs done so far to provide a cancel capability..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1241
diff changeset
965 else:
dfb9609caf51 Continued implementing an interface to the Mercurial command server. Modified client all all dialogs done so far to provide a cancel capability..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1241
diff changeset
966 self.__finish()
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
967 elif button == self.refreshButton:
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
968 self.on_refreshButton_clicked()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969
235
7cb9905b0cf9 Little enhancement to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 215
diff changeset
970 def __updateDiffButtons(self):
7cb9905b0cf9 Little enhancement to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 215
diff changeset
971 """
7cb9905b0cf9 Little enhancement to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 215
diff changeset
972 Private slot to update the enabled status of the diff buttons.
7cb9905b0cf9 Little enhancement to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 215
diff changeset
973 """
7cb9905b0cf9 Little enhancement to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 215
diff changeset
974 selectionLength = len(self.logTree.selectedItems())
7cb9905b0cf9 Little enhancement to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 215
diff changeset
975 if selectionLength <= 1:
7cb9905b0cf9 Little enhancement to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 215
diff changeset
976 current = self.logTree.currentItem()
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
977 if current is None:
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
978 self.diffP1Button.setEnabled(False)
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
979 self.diffP2Button.setEnabled(False)
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
980 else:
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
981 parents = current.data(0, self.__parentsRole)
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev