Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

Sun, 05 Feb 2017 19:02:52 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 05 Feb 2017 19:02:52 +0100
changeset 5490
95db14ec60b2
parent 5489
5c9a82215917
child 5493
09cd66fa3243
permissions
-rw-r--r--

Added some code to cope with unlimited recursions.

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
5389
9b1c800daff3 Updated copyright for 2017.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5353
diff changeset
3 # Copyright (c) 2010 - 2017 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
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
10 from __future__ import unicode_literals
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
11 try:
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3359
diff changeset
12 str = unicode
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3359
diff changeset
13 except NameError:
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
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
3317
d7639a86e90f Added support for Mercurial outgoing with largefiles by looking for a .hglf path prefix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
17 import re
5445
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
18 import collections
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
20 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
21 QSize, QPoint, QFileInfo
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
22 from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QBrush, \
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
23 QIcon, QTextCursor
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
24 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \
5322
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
25 QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 204
diff changeset
27 from E5Gui.E5Application import e5App
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
28 from E5Gui import E5MessageBox, E5FileDialog
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 204
diff changeset
29
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 from .Ui_HgLogBrowserDialog import Ui_HgLogBrowserDialog
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
32 from .HgDiffHighlighter import HgDiffHighlighter
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
33 from .HgDiffGenerator import HgDiffGenerator
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
34
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
35 import UI.PixmapCache
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
36 import Preferences
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
37 import Utilities
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
39 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple",
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
40 "cyan", "olive", "magenta", "darkred", "darkmagenta",
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
41 "darkcyan", "gray", "yellow"]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
42 COLORS = [str(QColor(x).name()) for x in COLORNAMES]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
43
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
44
3279
8df9706ef7f4 Extended the Mercurial log browser by an action to switch to the selected revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3273
diff changeset
45 class HgLogBrowserDialog(QWidget, Ui_HgLogBrowserDialog):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 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
48 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
49 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
50 BranchColumn = 1
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
51 RevisionColumn = 2
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
52 PhaseColumn = 3
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
53 AuthorColumn = 4
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
54 DateColumn = 5
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
55 MessageColumn = 6
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
56 TagsColumn = 7
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
57 BookmarksColumn = 8
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
58
3317
d7639a86e90f Added support for Mercurial outgoing with largefiles by looking for a .hglf path prefix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
59 LargefilesCacheL = ".hglf/"
d7639a86e90f Added support for Mercurial outgoing with largefiles by looking for a .hglf path prefix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
60 LargefilesCacheW = ".hglf\\"
d7639a86e90f Added support for Mercurial outgoing with largefiles by looking for a .hglf path prefix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
61 PathSeparatorRe = re.compile(r"/|\\")
d7639a86e90f Added support for Mercurial outgoing with largefiles by looking for a .hglf path prefix.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
62
3554
9ca56a89aec5 A liitle enhancement and a fix to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3546
diff changeset
63 ClosedIndicator = " \u2612"
9ca56a89aec5 A liitle enhancement and a fix to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3546
diff changeset
64
3283
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
65 def __init__(self, vcs, mode="log", parent=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 Constructor
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 @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
70 @param mode mode of the dialog (string; one of log, incoming, outgoing)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 @param parent parent widget (QWidget)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
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
73 super(HgLogBrowserDialog, self).__init__(parent)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.setupUi(self)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
5486
a74fafdb67e0 Refined the layout of the Mercurial log browser dialog by introducing a splitter between the log and details part.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5477
diff changeset
76 self.mainSplitter.setSizes([300, 400])
a74fafdb67e0 Refined the layout of the Mercurial log browser dialog by introducing a splitter between the log and details part.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5477
diff changeset
77 self.mainSplitter.setStretchFactor(0, 1)
a74fafdb67e0 Refined the layout of the Mercurial log browser dialog by introducing a splitter between the log and details part.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5477
diff changeset
78 self.mainSplitter.setStretchFactor(1, 2)
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
79 self.diffSplitter.setStretchFactor(0, 1)
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
80 self.diffSplitter.setStretchFactor(1, 2)
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
81
782
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
82 if mode == "log":
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
83 self.setWindowTitle(self.tr("Mercurial Log"))
782
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
84 elif mode == "incoming":
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
85 self.setWindowTitle(self.tr("Mercurial Log (Incoming)"))
782
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
86 elif mode == "outgoing":
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
87 self.setWindowTitle(self.tr("Mercurial Log (Outgoing)"))
782
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
88
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
5449
7679d1d3671a Added up and down buttons to move the current entry to the Mercurial and Subversion log browsers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5448
diff changeset
95 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png"))
7679d1d3671a Added up and down buttons to move the current entry to the Mercurial and Subversion log browsers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5448
diff changeset
96 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png"))
7679d1d3671a Added up and down buttons to move the current entry to the Mercurial and Subversion log browsers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5448
diff changeset
97
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
98 self.refreshButton = self.buttonBox.addButton(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
99 self.tr("&Refresh"), QDialogButtonBox.ActionRole)
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
100 self.refreshButton.setToolTip(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
101 self.tr("Press to refresh the list of changesets"))
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
102 self.refreshButton.setEnabled(False)
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
103
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
104 self.findPrevButton.setIcon(UI.PixmapCache.getIcon("1leftarrow.png"))
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
105 self.findNextButton.setIcon(UI.PixmapCache.getIcon("1rightarrow.png"))
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
106 self.__findBackwards = False
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
107
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
108 self.modeComboBox.addItem(self.tr("Find"), "find")
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
109 self.modeComboBox.addItem(self.tr("Filter"), "filter")
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
110
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
111 self.fieldCombo.addItem(self.tr("Revision"), "revision")
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
112 self.fieldCombo.addItem(self.tr("Author"), "author")
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
113 self.fieldCombo.addItem(self.tr("Message"), "message")
4060
6dc9821fc9c8 Extended the Mercurial log browser search and filter functions to the list of changed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4059
diff changeset
114 self.fieldCombo.addItem(self.tr("File"), "file")
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
115
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
116 font = Preferences.getEditorOtherFonts("MonospacedFont")
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
117 self.diffEdit.setFontFamily(font.family())
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
118 self.diffEdit.setFontPointSize(font.pointSize())
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
119
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
120 self.diffHighlighter = HgDiffHighlighter(self.diffEdit.document())
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
121 self.__diffGenerator = HgDiffGenerator(vcs, self)
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
122 self.__diffGenerator.finished.connect(self.__generatorFinished)
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
123
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 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
125 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
126 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
127 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
128 else:
215
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
129 self.commandMode = "log"
3287
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
130 self.initialCommandMode = "log"
3518
1d681235c1b4 Fixed the Mercurial command server client handling large data chunks on slow machines.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3516
diff changeset
131 self.__hgClient = vcs.getClient()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
3562
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
133 self.__detailsTemplate = self.tr(
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
134 "<table>"
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
135 "<tr><td><b>Revision</b></td><td>{0}</td></tr>"
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
136 "<tr><td><b>Date</b></td><td>{1}</td></tr>"
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
137 "<tr><td><b>Author</b></td><td>{2}</td></tr>"
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
138 "<tr><td><b>Branch</b></td><td>{3}</td></tr>"
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
139 "{4}"
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
140 "<tr><td><b>Message</b></td><td>{5}</td></tr>"
3562
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
141 "</table>"
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
142 )
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
143 self.__parentsTemplate = self.tr(
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
144 "<tr><td><b>Parents</b></td><td>{0}</td></tr>"
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
145 )
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
146 self.__childrenTemplate = self.tr(
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
147 "<tr><td><b>Children</b></td><td>{0}</td></tr>"
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
148 )
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
149 self.__tagsTemplate = self.tr(
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
150 "<tr><td><b>Tags</b></td><td>{0}</td></tr>"
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
151 )
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
152 self.__latestTagTemplate = self.tr(
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
153 "<tr><td><b>Latest Tag</b></td><td>{0}</td></tr>"
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
154 )
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
155 self.__bookmarksTemplate = self.tr(
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
156 "<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>"
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
157 )
3536
c06338ca892b Enhanced the Mercurial log browser dialog to show a summary of the data of the selected changeset in a text edit pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3534
diff changeset
158
3287
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
159 self.__bundle = ""
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
160 self.__filename = ""
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
161 self.__isFile = False
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
162 self.__selectedRevisions = []
4250
d3bd7c3dcb80 Fixed issues in the Subversion and Mercurial log browser windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4080
diff changeset
163 self.intercept = False
3287
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
164
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
165 self.__initData()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
166
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
167 self.__allBranchesFilter = self.tr("All")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 self.fromDate.setDisplayFormat("yyyy-MM-dd")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 self.toDate.setDisplayFormat("yyyy-MM-dd")
3287
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
171 self.__resetUI()
779
04c3a6026543 Fixed an issue where long incoming patchsets were not shown completely.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
172
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
173 # roles used in the log tree
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 self.__messageRole = Qt.UserRole
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
175 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
176 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
177 self.__parentsRole = Qt.UserRole + 3
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
178 self.__latestTagRole = Qt.UserRole + 4
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
180 # roles used in the file tree
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
181 self.__diffFileLineRole = Qt.UserRole
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
182
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
183 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
184 self.process = None
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
185 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
186 self.process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
187 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
188 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
189 self.process.readyReadStandardError.connect(self.__readStderr)
178
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 self.flags = {
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
192 'A': self.tr('Added'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
193 'D': self.tr('Deleted'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
194 'M': self.tr('Modified'),
178
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
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
197 self.phases = {
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
198 'draft': self.tr("Draft"),
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
199 'public': self.tr("Public"),
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
200 'secret': self.tr("Secret"),
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
201 }
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
202
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
203 self.__dotRadius = 8
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
204 self.__rowHeight = 20
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
205
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
206 self.logTree.setIconSize(
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
207 QSize(100 * self.__rowHeight, self.__rowHeight))
3562
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
208 self.BookmarksColumn = self.logTree.columnCount()
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
209 self.logTree.headerItem().setText(
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3554
diff changeset
210 self.BookmarksColumn, self.tr("Bookmarks"))
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
211
5448
1a86766ed19a Change the Mercurial log browser such, that the current log entry is highlighted with a bold font.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5445
diff changeset
212 self.__logTreeNormalFont = self.logTree.font()
1a86766ed19a Change the Mercurial log browser such, that the current log entry is highlighted with a bold font.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5445
diff changeset
213 self.__logTreeNormalFont.setBold(False)
1a86766ed19a Change the Mercurial log browser such, that the current log entry is highlighted with a bold font.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5445
diff changeset
214 self.__logTreeBoldFont = self.logTree.font()
1a86766ed19a Change the Mercurial log browser such, that the current log entry is highlighted with a bold font.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5445
diff changeset
215 self.__logTreeBoldFont.setBold(True)
1a86766ed19a Change the Mercurial log browser such, that the current log entry is highlighted with a bold font.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5445
diff changeset
216
5445
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
217 self.detailsEdit.anchorClicked.connect(self.__revisionClicked)
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
218
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
219 self.__initActionsMenu()
5450
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
220
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
221 self.__finishCallbacks = []
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
222
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
223 def __addFinishCallback(self, callback):
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
224 """
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
225 Private method to add a method to be called once the process finished.
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
226
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
227 The callback methods are invoke in a FIFO style and are consumed. If
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
228 a callback method needs to be called again, it must be added again.
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
229
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
230 @param callback callback method
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
231 @type function
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
232 """
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
233 if callback not in self.__finishCallbacks:
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
234 self.__finishCallbacks.append(callback)
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
235
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
236 def __initActionsMenu(self):
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
237 """
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
238 Private method to initialize the actions menu.
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
239 """
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
240 self.__actionsMenu = QMenu()
5104
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
241 self.__graftAct = self.__actionsMenu.addAction(
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
242 UI.PixmapCache.getIcon("vcsGraft.png"),
5104
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
243 self.tr("Copy Changesets"), self.__graftActTriggered)
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
244 self.__graftAct.setToolTip(self.tr(
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
245 "Copy the selected changesets to the current branch"))
3279
8df9706ef7f4 Extended the Mercurial log browser by an action to switch to the selected revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3273
diff changeset
246
5104
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
247 self.__phaseAct = self.__actionsMenu.addAction(
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
248 self.tr("Change Phase"), self.__phaseActTriggered)
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
249 self.__phaseAct.setToolTip(self.tr(
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
250 "Change the phase of the selected revisions"))
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
251 self.__phaseAct.setWhatsThis(self.tr(
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
252 """<b>Change Phase</b>\n<p>This changes the phase of the"""
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
253 """ selected revisions. The selected revisions have to have"""
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
254 """ the same current phase.</p>"""))
3279
8df9706ef7f4 Extended the Mercurial log browser by an action to switch to the selected revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3273
diff changeset
255
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
256 self.__tagAct = self.__actionsMenu.addAction(
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
257 UI.PixmapCache.getIcon("vcsTag.png"), self.tr("Tag"),
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
258 self.__tagActTriggered)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
259 self.__tagAct.setToolTip(self.tr("Tag the selected revision"))
3279
8df9706ef7f4 Extended the Mercurial log browser by an action to switch to the selected revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3273
diff changeset
260
8df9706ef7f4 Extended the Mercurial log browser by an action to switch to the selected revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3273
diff changeset
261 self.__switchAct = self.__actionsMenu.addAction(
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
262 UI.PixmapCache.getIcon("vcsSwitch.png"), self.tr("Switch"),
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
263 self.__switchActTriggered)
3279
8df9706ef7f4 Extended the Mercurial log browser by an action to switch to the selected revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3273
diff changeset
264 self.__switchAct.setToolTip(self.tr(
8df9706ef7f4 Extended the Mercurial log browser by an action to switch to the selected revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3273
diff changeset
265 "Switch the working directory to the selected revision"))
8df9706ef7f4 Extended the Mercurial log browser by an action to switch to the selected revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3273
diff changeset
266
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
267 self.__actionsMenu.addSeparator()
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
268
5322
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
269 self.__bookmarkAct = self.__actionsMenu.addAction(
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
270 UI.PixmapCache.getIcon("addBookmark.png"),
5322
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
271 self.tr("Define Bookmark..."), self.__bookmarkActTriggered)
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
272 self.__bookmarkAct.setToolTip(
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
273 self.tr("Bookmark the selected revision"))
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
274 self.__bookmarkMoveAct = self.__actionsMenu.addAction(
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
275 UI.PixmapCache.getIcon("moveBookmark.png"),
5322
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
276 self.tr("Move Bookmark..."), self.__bookmarkMoveActTriggered)
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
277 self.__bookmarkMoveAct.setToolTip(
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
278 self.tr("Move bookmark to the selected revision"))
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
279
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
280 self.__actionsMenu.addSeparator()
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
281
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
282 self.__pullAct = self.__actionsMenu.addAction(
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
283 UI.PixmapCache.getIcon("vcsUpdate.png"), self.tr("Pull Changes"),
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
284 self.__pullActTriggered)
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
285 self.__pullAct.setToolTip(self.tr(
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
286 "Pull changes from a remote repository"))
5104
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
287 self.__lfPullAct = self.__actionsMenu.addAction(
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
288 self.tr("Pull Large Files"), self.__lfPullActTriggered)
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
289 self.__lfPullAct.setToolTip(self.tr(
0b9420dc1093 Removed the support for the obsolete transplant Mercuril extension and made v3.0 the minimum Mercurial version.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
290 "Pull large files for selected revisions"))
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
291 self.__fetchAct = self.__actionsMenu.addAction(
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
292 self.tr("Fetch Changes"), self.__fetchActTriggered)
5276
c8055cb37262 Improved the handling of Mercurial log browser actions, that potentially modify the project file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5270
diff changeset
293 self.__fetchAct.setToolTip(self.tr(
c8055cb37262 Improved the handling of Mercurial log browser actions, that potentially modify the project file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5270
diff changeset
294 "Fetch changes from a remote repository"))
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
295
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
296 self.__actionsMenu.addSeparator()
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
297
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
298 self.__pushAct = self.__actionsMenu.addAction(
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
299 UI.PixmapCache.getIcon("vcsCommit.png"),
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
300 self.tr("Push Selected Changes"), self.__pushActTriggered)
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
301 self.__pushAct.setToolTip(self.tr(
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
302 "Push changes of the selected changeset and its ancestors"
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
303 " to a remote repository"))
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
304 self.__pushAllAct = self.__actionsMenu.addAction(
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
305 UI.PixmapCache.getIcon("vcsCommit.png"),
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
306 self.tr("Push All Changes"), self.__pushAllActTriggered)
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
307 self.__pushAllAct.setToolTip(self.tr(
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
308 "Push all changes to a remote repository"))
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
309
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
310 self.__actionsMenu.addSeparator()
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
311
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
312 self.__stripAct = self.__actionsMenu.addAction(
5324
337c27027c66 Fixed the handling of the switch action of the Mercurial log browser dialog context menu in the presence of a bookmark.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5322
diff changeset
313 UI.PixmapCache.getIcon("fileDelete.png"),
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
314 self.tr("Strip Changesets"), self.__stripActTriggered)
5276
c8055cb37262 Improved the handling of Mercurial log browser actions, that potentially modify the project file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5270
diff changeset
315 self.__stripAct.setToolTip(self.tr(
c8055cb37262 Improved the handling of Mercurial log browser actions, that potentially modify the project file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5270
diff changeset
316 "Strip changesets from a repository"))
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
317
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
318 self.actionsButton.setIcon(
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
319 UI.PixmapCache.getIcon("actionsToolButton.png"))
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
320 self.actionsButton.setMenu(self.__actionsMenu)
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
321
5487
7ce9c29cd26f Added some TODOs to further enhance the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5486
diff changeset
322 # TODO: add action "Merge" (1 revision selected)
7ce9c29cd26f Added some TODOs to further enhance the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5486
diff changeset
323 # TODO: add action "Create Changegroup" (>=2 revs, lowest rev is base)
7ce9c29cd26f Added some TODOs to further enhance the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5486
diff changeset
324 # TODO: add action "Sign Revision" (>= 1 revs) (GPG extension)
7ce9c29cd26f Added some TODOs to further enhance the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5486
diff changeset
325 # TODO: add action "Verify Signature" (1 rev) (GPG extension)
7ce9c29cd26f Added some TODOs to further enhance the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5486
diff changeset
326
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
327 def __initData(self):
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
328 """
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
329 Private method to (re-)initialize some data.
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
330 """
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
331 self.__maxDate = QDate()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
332 self.__minDate = QDate()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
333 self.__filterLogsEnabled = True
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
334
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 self.buf = [] # buffer for stdout
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 self.diff = None
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 self.__started = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 self.__lastRev = 0
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
339 self.projectMode = False
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
340
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
341 # attributes to store log graph data
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
342 self.__revs = []
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
343 self.__revColors = {}
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
344 self.__revColor = 0
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
345
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
346 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
347
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
348 self.__projectRevision = -1
2543
eb9472947653 Added a 'Copy Changesets' button to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2444
diff changeset
349 self.__projectBranch = ""
5445
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
350
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
351 self.__childrenInfo = collections.defaultdict(list)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 def closeEvent(self, e):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3562
diff changeset
355 Protected slot implementing a close event handler.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 @param e close event (QCloseEvent)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 """
1256
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
359 if self.__hgClient:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
360 if self.__hgClient.isExecuting():
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
361 self.__hgClient.cancel()
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
362 else:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
363 if self.process is not None and \
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
364 self.process.state() != QProcess.NotRunning:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
365 self.process.terminate()
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
366 QTimer.singleShot(2000, self.process.kill)
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
367 self.process.waitForFinished(3000)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368
5488
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
369 self.vcs.getPlugin().setPreferences(
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
370 "LogBrowserGeometry", self.saveGeometry())
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
371 self.vcs.getPlugin().setPreferences(
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
372 "LogBrowserSplitterStates", [
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
373 self.mainSplitter.saveState(),
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
374 self.detailsSplitter.saveState(),
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
375 self.diffSplitter.saveState(),
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
376 ]
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
377 )
3283
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
378
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 e.accept()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380
3283
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
381 def show(self):
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
382 """
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
383 Public slot to show the dialog.
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
384 """
5488
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
385 self.__reloadGeometry()
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
386 self.__restoreSplitterStates()
3283
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
387 self.__resetUI()
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
388
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3359
diff changeset
389 super(HgLogBrowserDialog, self).show()
5488
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
390
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
391 def __reloadGeometry(self):
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
392 """
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
393 Private method to restore the geometry.
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
394 """
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
395 geom = self.vcs.getPlugin().getPreferences("LogBrowserGeometry")
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
396 if geom.isEmpty():
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
397 s = QSize(1000, 800)
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
398 self.resize(s)
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
399 else:
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
400 self.restoreGeometry(geom)
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
401
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
402 def __restoreSplitterStates(self):
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
403 """
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
404 Private method to restore the state of the various splitters.
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
405 """
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
406 states = self.vcs.getPlugin().getPreferences(
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
407 "LogBrowserSplitterStates")
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
408 if len(states) == 3:
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
409 # we have three splitters
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
410 self.mainSplitter.restoreState(states[0])
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
411 self.detailsSplitter.restoreState(states[1])
d3729abac667 Enhanced the Mercurial log browser window by saving and restoring the internal state (geometry and the three splitters).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5487
diff changeset
412 self.diffSplitter.restoreState(states[2])
3283
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
413
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
414 def __resetUI(self):
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
415 """
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
416 Private method to reset the user interface.
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
417 """
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
418 self.branchCombo.clear()
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
419 self.fromDate.setDate(QDate.currentDate())
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
420 self.toDate.setDate(QDate.currentDate())
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
421 self.fieldCombo.setCurrentIndex(self.fieldCombo.findData("message"))
3283
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
422 self.limitSpinBox.setValue(self.vcs.getPlugin().getPreferences(
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
423 "LogLimit"))
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
424 self.stopCheckBox.setChecked(self.vcs.getPlugin().getPreferences(
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
425 "StopLogOnCopy"))
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
426
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
427 if self.initialCommandMode in ("incoming", "outgoing"):
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
428 self.nextButton.setEnabled(False)
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
429 self.limitSpinBox.setEnabled(False)
3287
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
430 else:
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
431 self.nextButton.setEnabled(True)
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
432 self.limitSpinBox.setEnabled(True)
3283
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
433
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
434 self.logTree.clear()
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
435
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
436 self.commandMode = self.initialCommandMode
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
437
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 def __resizeColumnsLog(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 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
441 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 self.logTree.header().resizeSections(QHeaderView.ResizeToContents)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 self.logTree.header().setStretchLastSection(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 def __resizeColumnsFiles(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 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
448 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449 self.filesTree.header().resizeSections(QHeaderView.ResizeToContents)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 self.filesTree.header().setStretchLastSection(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 def __resortFiles(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 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
455 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 sortColumn = self.filesTree.sortColumn()
3023
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
457 self.filesTree.sortItems(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
458 1, self.filesTree.header().sortIndicatorOrder())
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
459 self.filesTree.sortItems(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
460 sortColumn, self.filesTree.header().sortIndicatorOrder())
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
462 def __getColor(self, n):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
463 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
464 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
465
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
466 @param n color index (integer)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
467 @return color name (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
468 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
469 return COLORS[n % len(COLORS)]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
470
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
471 def __branchColor(self, branchName):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
472 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
473 Private method to calculate a color for a given branch name.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
474
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
475 @param branchName name of the branch (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
476 @return name of the color to use (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
477 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
478 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
479 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
480 len(self.__branchColors))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
481 return self.__branchColors[branchName]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
482
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
483 def __generateEdges(self, rev, parents):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
484 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
485 Private method to generate edge info for the give data.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
486
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
487 @param rev revision to calculate edge info for (integer)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
488 @param parents list of parent revisions (list of integers)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
489 @return tuple containing the column and color index for
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
490 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
491 between the given node and its parents
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
492 (integer, integer, [(integer, integer, integer), ...])
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
493 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
494 if rev not in self.__revs:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
495 # new head
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
496 self.__revs.append(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
497 self.__revColors[rev] = self.__revColor
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
498 self.__revColor += 1
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
499
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
500 col = self.__revs.index(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
501 color = self.__revColors.pop(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
502 next = self.__revs[:]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
503
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
504 # add parents to next
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
505 addparents = [p for p in parents if p not in next]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
506 next[col:col + 1] = addparents
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
507
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
508 # set colors for the parents
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
509 for i, p in enumerate(addparents):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
510 if not i:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
511 self.__revColors[p] = color
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
512 else:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
513 self.__revColors[p] = self.__revColor
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
514 self.__revColor += 1
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
515
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
516 # add edges to the graph
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
517 edges = []
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
518 if parents[0] != -1:
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
519 for ecol, erev in enumerate(self.__revs):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
520 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
521 edges.append(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
522 (ecol, next.index(erev), self.__revColors[erev]))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
523 elif erev == rev:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
524 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
525 edges.append(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
526 (ecol, next.index(p), self.__revColors[p]))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
527
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
528 self.__revs = next
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
529 return col, color, edges
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
530
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
531 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
532 currentRev, closed):
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
533 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
534 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
535 given data.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
536
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
537 @param column column index of the revision (integer)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
538 @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
539 @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
540 (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
541 @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
542 (list of tuples of three integers)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
543 @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
544 @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
545 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
546 @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
547 branch (boolean)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
548 @return icon for the node (QIcon)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
549 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
550 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
551 """
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
552 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
553
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
554 @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
555 @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
556 """
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
557 return int(1.2 * radius) * col + radius // 2 + 3
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
558
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
559 radius = self.__dotRadius
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
560 w = len(bottomedges) * radius + 20
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
561 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
562
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
563 dot_x = col2x(column, radius) - radius // 2
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
564 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
565
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
566 pix = QPixmap(w, h)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
567 pix.fill(QColor(0, 0, 0, 0))
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
568 painter = QPainter(pix)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
569 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
570
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
571 pen = QPen(Qt.blue)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
572 pen.setWidth(2)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
573 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
574
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
575 lpen = QPen(pen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
576 lpen.setColor(Qt.black)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
577 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
578
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
579 # draw the revision history lines
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
580 for y1, y2, lines in ((0, h, bottomedges),
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
581 (-h, 0, topedges)):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
582 if lines:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
583 for start, end, ecolor in lines:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
584 lpen = QPen(pen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
585 lpen.setColor(QColor(self.__getColor(ecolor)))
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
586 lpen.setWidth(2)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
587 painter.setPen(lpen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
588 x1 = col2x(start, radius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
589 x2 = col2x(end, radius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
590 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
591
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
592 penradius = 1
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
593 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
594
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
595 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
596
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
597 # 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
598 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
599 # 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
600 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
601 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
602 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
603 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
604 penradius = 3
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
605 painter.setBrush(dotColor)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
606 pen = QPen(pencolor)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
607 pen.setWidth(penradius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
608 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
609 if closed:
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
610 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
611 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
612 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
613 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
614 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
615 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
616 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
617 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
618 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
619 )
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
620 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
621 painter.drawEllipse(dot_x, dot_y, radius, radius)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
622 painter.end()
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
623 return QIcon(pix)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
624
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
625 def __getParents(self, rev):
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
626 """
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
627 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
628 file/directory.
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
629
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
630 @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
631 @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
632 """
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
633 errMsg = ""
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
634 parents = [-1]
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
635
2581
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
636 if int(rev) > 0:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
637 args = self.vcs.initCommand("parents")
2581
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
638 if self.commandMode == "incoming":
3287
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
639 if self.__bundle:
2581
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
640 args.append("--repository")
3287
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
641 args.append(self.__bundle)
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
642 elif self.vcs.bundleFile and \
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
643 os.path.exists(self.vcs.bundleFile):
2581
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
644 args.append("--repository")
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
645 args.append(self.vcs.bundleFile)
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
646 args.append("--template")
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
647 args.append("{rev}\n")
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
648 args.append("-r")
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
649 args.append(rev)
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
650 if not self.projectMode:
3287
c3d784c057b3 Changed the Subversion Log Browser dialogs to maintain its position after being closed and fixed a few issues in the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
651 args.append(self.__filename)
2581
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
652
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
653 output = ""
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
654 if self.__hgClient:
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
655 output, errMsg = self.__hgClient.runcommand(args)
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
656 else:
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
657 process = QProcess()
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
658 process.setWorkingDirectory(self.repodir)
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
659 process.start('hg', args)
2771
281c9b30dd91 Changed all QProcess.waitForStarted() calls to use a 5s timeout (except the debugger interfaces, which have a 10s timeout).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2731
diff changeset
660 procStarted = process.waitForStarted(5000)
2581
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
661 if procStarted:
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
662 finished = process.waitForFinished(30000)
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
663 if finished and process.exitCode() == 0:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
664 output = str(process.readAllStandardOutput(),
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
665 self.vcs.getEncoding(), 'replace')
2581
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
666 else:
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
667 if not finished:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
668 errMsg = self.tr(
2581
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
669 "The hg process did not finish within 30s.")
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
670 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
671 errMsg = self.tr("Could not start the hg executable.")
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
672
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
673 if errMsg:
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
674 E5MessageBox.critical(
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
675 self,
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
676 self.tr("Mercurial Error"),
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
677 errMsg)
2581
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
678
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
679 if output:
a3498dcc75cc Fixed an 'invalid' error message caused by the code trying to get the parents for revision 0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2570
diff changeset
680 parents = [int(p) for p in output.strip().splitlines()]
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
681
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
682 return parents
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
683
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
684 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
685 """
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
686 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
687 """
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
688 errMsg = ""
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
689
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
690 args = self.vcs.initCommand("identify")
2543
eb9472947653 Added a 'Copy Changesets' button to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2444
diff changeset
691 args.append("-nb")
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
692
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
693 output = ""
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
694 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
695 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
696 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
697 process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
698 process.setWorkingDirectory(self.repodir)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
699 process.start('hg', args)
2771
281c9b30dd91 Changed all QProcess.waitForStarted() calls to use a 5s timeout (except the debugger interfaces, which have a 10s timeout).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2731
diff changeset
700 procStarted = process.waitForStarted(5000)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
701 if procStarted:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
702 finished = process.waitForFinished(30000)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
703 if finished and process.exitCode() == 0:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
704 output = str(process.readAllStandardOutput(),
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
705 self.vcs.getEncoding(), 'replace')
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
706 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
707 if not finished:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
708 errMsg = self.tr(
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
709 "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
710 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
711 errMsg = self.tr("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
712
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
713 if errMsg:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
714 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
715 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
716 self.tr("Mercurial Error"),
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
717 errMsg)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
718
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
719 if output:
2544
3868561e3962 Fixed an issue introduced by the last changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2543
diff changeset
720 outputList = output.strip().split(None, 1)
2543
eb9472947653 Added a 'Copy Changesets' button to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2444
diff changeset
721 if len(outputList) == 2:
eb9472947653 Added a 'Copy Changesets' button to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2444
diff changeset
722 self.__projectRevision = outputList[0].strip()
eb9472947653 Added a 'Copy Changesets' button to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2444
diff changeset
723 if self.__projectRevision.endswith("+"):
eb9472947653 Added a 'Copy Changesets' button to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2444
diff changeset
724 self.__projectRevision = self.__projectRevision[:-1]
2642
c9f965bd21d2 Fixed an issue in the Mercurial log browser dialog causing the 'Copy Changeset' button not being updated correctly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2581
diff changeset
725 self.__projectBranch = outputList[1].strip()
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
726
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
727 def __getClosedBranches(self):
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
728 """
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
729 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
730 """
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
731 self.__closedBranchesRevs = []
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
732 errMsg = ""
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
733
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
734 args = self.vcs.initCommand("branches")
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
735 args.append("--closed")
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
736
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
737 output = ""
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
738 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
739 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
740 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
741 process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
742 process.setWorkingDirectory(self.repodir)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
743 process.start('hg', args)
2771
281c9b30dd91 Changed all QProcess.waitForStarted() calls to use a 5s timeout (except the debugger interfaces, which have a 10s timeout).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2731
diff changeset
744 procStarted = process.waitForStarted(5000)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
745 if procStarted:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
746 finished = process.waitForFinished(30000)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
747 if finished and process.exitCode() == 0:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
748 output = str(process.readAllStandardOutput(),
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
749 self.vcs.getEncoding(), 'replace')
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
750 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
751 if not finished:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
752 errMsg = self.tr(
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
753 "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
754 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
755 errMsg = self.tr("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
756
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
757 if errMsg:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
758 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
759 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
760 self.tr("Mercurial Error"),
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
761 errMsg)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
762
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
763 if output:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
764 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
765 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
766 parts = line.split()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
767 self.__closedBranchesRevs.append(
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
768 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
769
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
770 def __getRevisionOfTag(self, tag):
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
771 """
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
772 Private method to get the revision of a tag.
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
773
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
774 @param tag tag name
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
775 @type str
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
776 @return tuple containing the revision and changeset ID
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
777 @rtype tuple of (str, str)
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
778 """
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
779 errMsg = ""
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
780
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
781 args = self.vcs.initCommand("tags")
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
782
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
783 output = ""
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
784 if self.__hgClient:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
785 output, errMsg = self.__hgClient.runcommand(args)
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
786 else:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
787 process = QProcess()
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
788 process.setWorkingDirectory(self.repodir)
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
789 process.start('hg', args)
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
790 procStarted = process.waitForStarted(5000)
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
791 if procStarted:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
792 finished = process.waitForFinished(30000)
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
793 if finished and process.exitCode() == 0:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
794 output = str(process.readAllStandardOutput(),
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
795 self.vcs.getEncoding(), 'replace')
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
796 else:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
797 if not finished:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
798 errMsg = self.tr(
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
799 "The hg process did not finish within 30s.")
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
800 else:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
801 errMsg = self.tr("Could not start the hg executable.")
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
802
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
803 if errMsg:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
804 E5MessageBox.critical(
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
805 self,
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
806 self.tr("Mercurial Error"),
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
807 errMsg)
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
808
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
809 res = ("", "")
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
810 if output:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
811 for line in output.splitlines():
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
812 if line.strip():
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
813 try:
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
814 name, rev = line.strip().rsplit(None, 1)
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
815 if name == tag:
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
816 res = tuple(rev.split(":", 1))
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
817 break
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
818 except ValueError:
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
819 # ignore silently
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
820 pass
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
821
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
822 return res
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
823
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
824 def __generateLogItem(self, author, date, message, revision, changedPaths,
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
825 parents, branches, tags, phase, bookmarks,
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
826 latestTag):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828 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
829
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830 @param author author info (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831 @param date date info (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 @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
833 @param revision revision info (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834 @param changedPaths list of dictionary objects containing
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
835 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
836 @param parents list of parent revisions (list of integers)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
837 @param branches list of branches (list of strings)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
838 @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
839 @param phase phase of the entry (string)
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
840 @param bookmarks list of bookmarks (string)
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
841 @param latestTag the latest tag(s) reachable from the changeset
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
842 (list of strings)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
843 @return reference to the generated item (QTreeWidgetItem)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844 """
5451
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
845 logMessageColumnWidth = self.vcs.getPlugin().getPreferences(
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
846 "LogMessageColumnWidth")
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
847 msgtxt = ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 for line in message:
5451
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
849 if ". " in line:
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
850 msgtxt += " " + line.strip().split(". ", 1)[0] + "."
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
851 break
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
852 else:
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
853 msgtxt += " " + line.strip()
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
854 if len(msgtxt) > logMessageColumnWidth:
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
855 msgtxt = "{0}...".format(msgtxt[:logMessageColumnWidth])
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857 rev, node = revision.split(":")
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
858 if rev in self.__closedBranchesRevs:
3554
9ca56a89aec5 A liitle enhancement and a fix to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3546
diff changeset
859 closedStr = self.ClosedIndicator
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
860 else:
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
861 closedStr = ""
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
862 if phase in self.phases:
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
863 phaseStr = self.phases[phase]
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
864 else:
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
865 phaseStr = phase
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
866 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
867 "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
868 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
869 "{0:>7}:{1}".format(rev, node),
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
870 phaseStr,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
871 author,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
872 date,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
873 msgtxt,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
874 ", ".join(tags),
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
875 ]
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
876 if bookmarks is not None:
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
877 columnLabels.append(", ".join(bookmarks))
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
878 itm = QTreeWidgetItem(self.logTree, columnLabels)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
880 itm.setForeground(self.BranchColumn,
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
881 QBrush(QColor(self.__branchColor(branches[0]))))
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
882
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
883 if not self.projectMode:
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
884 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
885 if not parents:
26ed553ad4fb Corrected the diff functions of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 207
diff changeset
886 parents = [int(rev) - 1]
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
887 column, color, edges = self.__generateEdges(int(rev), parents)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
888
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 itm.setData(0, self.__messageRole, message)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
890 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
891 itm.setData(0, self.__edgesRole, edges)
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
892 itm.setData(0, self.__latestTagRole, latestTag)
3242
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
893 if parents == [-1]:
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
894 itm.setData(0, self.__parentsRole, [])
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
895 else:
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
896 itm.setData(0, self.__parentsRole, parents)
5445
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
897 for parent in parents:
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
898 self.__childrenInfo[parent].append(int(rev))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
899
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
900 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
901 topedges = \
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
902 self.logTree.topLevelItem(
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
903 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
904 .data(0, self.__edgesRole)
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
905 else:
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
906 topedges = None
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
907
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
908 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
909 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
910 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
911 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
912 itm.setIcon(0, icon)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914 try:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 self.__lastRev = int(revision.split(":")[0])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
916 except ValueError:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 self.__lastRev = 0
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 return itm
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920
5444
4799e2cf8401 Corrected the Mercurial log browser window refresh action to load as much entries as are already shown (i.e. do not start from scratch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
921 def __getLogEntries(self, startRev=None, noEntries=0):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
923 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
924
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925 @param startRev revision number to start from (integer, string)
5444
4799e2cf8401 Corrected the Mercurial log browser window refresh action to load as much entries as are already shown (i.e. do not start from scratch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
926 @keyparam noEntries number of entries to get (0 = default) (int)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
931 QApplication.processEvents()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 QApplication.processEvents()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 self.buf = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 self.cancelled = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 self.errors.clear()
1269
7b4d9f1d7c6c Fixed an issue in the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1265
diff changeset
939 self.intercept = False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940
5444
4799e2cf8401 Corrected the Mercurial log browser window refresh action to load as much entries as are already shown (i.e. do not start from scratch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
941 if noEntries == 0:
4799e2cf8401 Corrected the Mercurial log browser window refresh action to load as much entries as are already shown (i.e. do not start from scratch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
942 noEntries = self.limitSpinBox.value()
4799e2cf8401 Corrected the Mercurial log browser window refresh action to load as much entries as are already shown (i.e. do not start from scratch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
943
3242
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
944 preargs = []
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3287
diff changeset
945 args = self.vcs.initCommand(self.commandMode)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 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
947 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
948 args.append('--limit')
5444
4799e2cf8401 Corrected the Mercurial log browser window refresh action to load as much entries as are already shown (i.e. do not start from scratch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
949 args.append(str(noEntries))
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
950 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
951 args.append("--newest-first")