eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

Fri, 30 Aug 2019 19:25:42 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 30 Aug 2019 19:25:42 +0200
changeset 7187
11b0c7802a70
parent 7183
4ac1c9daa90b
child 7192
a22eee00b052
child 7194
b184e8ca7219
permissions
-rw-r--r--

HgLogBrowserDialog: fixed the patch submitted by Christos.

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
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6247
diff changeset
3 # Copyright (c) 2010 - 2019 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:
5624
cdd346d8858b Removed a bunch of __IGNORE_WARNING_M131__ markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
12 str = unicode
3484
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
5736
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5670
diff changeset
20 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5670
diff changeset
21 QSize, QPoint, QFileInfo
5477
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, \
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
25 QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog, QToolTip
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
5848
56388f41b1e6 Fixed an issue sending input to the mercurial and subversion processes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5765
diff changeset
38 from Globals import qVersionTuple, strToQByteArray
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
40 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple",
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
41 "cyan", "olive", "magenta", "darkred", "darkmagenta",
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
42 "darkcyan", "gray", "yellow"]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
43 COLORS = [str(QColor(x).name()) for x in COLORNAMES]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
44
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
45
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
46 class HgLogBrowserDialog(QWidget, Ui_HgLogBrowserDialog):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 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
49 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
50 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
51 BranchColumn = 1
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
52 RevisionColumn = 2
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
53 PhaseColumn = 3
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
54 AuthorColumn = 4
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
55 DateColumn = 5
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
56 MessageColumn = 6
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
57 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
58 BookmarksColumn = 8
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
59
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
60 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
61 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
62 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
63
3554
9ca56a89aec5 A liitle enhancement and a fix to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3546
diff changeset
64 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
65
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
66 def __init__(self, vcs, mode="", parent=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 Constructor
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 @param vcs reference to the vcs object
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
71 @type Hg
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
72 @param mode mode of the dialog
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
73 @type str (one of log, full_log, incoming, outgoing)
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
74 @param parent parent widget
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
75 @type QWidget
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 """
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
77 super(HgLogBrowserDialog, self).__init__(parent)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.setupUi(self)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
80 windowFlags = self.windowFlags()
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
81 windowFlags |= Qt.WindowContextHelpButtonHint
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
82 self.setWindowFlags(windowFlags)
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
83
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
84 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
85 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
86 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
87 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
88 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
89
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
90 if not mode:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
91 if vcs.getPlugin().getPreferences("LogBrowserShowFullLog"):
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
92 mode = "full_log"
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
93 else:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
94 mode = "log"
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
95
782
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
96 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
97 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
98 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
99 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
100 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
101 self.setWindowTitle(self.tr("Mercurial Log (Outgoing)"))
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
102 elif mode == "full_log":
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
103 self.setWindowTitle(self.tr("Mercurial Full Log"))
782
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
104
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
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
111 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
112 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
113
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
114 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
115 self.tr("&Refresh"), QDialogButtonBox.ActionRole)
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
116 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
117 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
118 self.refreshButton.setEnabled(False)
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
119
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
120 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
121 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
122 self.__findBackwards = False
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
123
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
124 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
125 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
126
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
127 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
128 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
129 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
130 self.fieldCombo.addItem(self.tr("File"), "file")
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
131 self.fieldCombo.addItem(self.tr("Phase"), "phase")
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
132
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
133 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
134 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
135 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
136
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
137 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
138 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
139 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
140
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 self.vcs = vcs
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
142 if mode in ("log", "incoming", "outgoing", "full_log"):
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
143 if mode == "full_log":
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
144 self.commandMode = "incoming"
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
145 else:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
146 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
147 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
148 else:
215
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
149 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
150 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
151 self.__hgClient = vcs.getClient()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152
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
153 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
154 "<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
155 "<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
156 "<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
157 "<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
158 "<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
159 "{4}"
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
160 "<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
161 "</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
162 )
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
163 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
164 "<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
165 )
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
166 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
167 "<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
168 )
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
169 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
170 "<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
171 )
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
172 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
173 "<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
174 )
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
175 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
176 "<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
177 )
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
178
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
179 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
180 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
181 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
182 self.__selectedRevisions = []
4250
d3bd7c3dcb80 Fixed issues in the Subversion and Mercurial log browser windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4080
diff changeset
183 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
184
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
185 self.__initData()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
186
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
187 self.__allBranchesFilter = self.tr("All")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 self.fromDate.setDisplayFormat("yyyy-MM-dd")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 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
191 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
192
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
193 # roles used in the log tree
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 self.__messageRole = Qt.UserRole
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
195 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
196 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
197 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
198 self.__latestTagRole = Qt.UserRole + 4
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
199 self.__incomingRole = Qt.UserRole + 5
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
201 # 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
202 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
203
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
204 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
205 self.process = None
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
206 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
207 self.process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
208 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
209 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
210 self.process.readyReadStandardError.connect(self.__readStderr)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 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
213 '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
214 '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
215 'M': self.tr('Modified'),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 }
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
218 self.phases = {
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
219 '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
220 '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
221 '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
222 }
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
223
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
224 self.__dotRadius = 8
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
225 self.__rowHeight = 20
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
226
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
227 self.logTree.setIconSize(
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
228 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
229 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
230 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
231 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
232
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
233 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
234 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
235 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
236 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
237
5445
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
238 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
239
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
240 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
241
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
242 self.__finishCallbacks = []
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
243 if self.initialCommandMode == "full_log":
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
244 self.__addFinishCallback(self.on_nextButton_clicked)
5450
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
245
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
246 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
247 """
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
248 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
249
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
250 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
251 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
252
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
253 @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
254 @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
255 """
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
256 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
257 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
258
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
259 def __initActionsMenu(self):
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
260 """
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
261 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
262 """
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
263 self.__actionsMenu = QMenu()
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
264 self.__actionsMenu.setTearOffEnabled(True)
5736
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5670
diff changeset
265 if qVersionTuple() >= (5, 1, 0):
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
266 self.__actionsMenu.setToolTipsVisible(True)
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
267 else:
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
268 self.__actionsMenu.hovered.connect(self.__actionsMenuHovered)
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
269
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
270 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
271 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
272 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
273 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
274 "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
275
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
276 self.__mergeAct = self.__actionsMenu.addAction(
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
277 UI.PixmapCache.getIcon("vcsMerge.png"),
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
278 self.tr("Merge with Changeset"), self.__mergeActTriggered)
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
279 self.__mergeAct.setToolTip(self.tr(
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
280 "Merge the working directory with the selected changeset"))
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
281
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
282 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
283 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
284 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
285 "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
286 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
287 """<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
288 """ 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
289 """ 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
290
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
291 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
292 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
293 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
294 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
295
7010
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
296 self.__closeHeadsAct = self.__actionsMenu.addAction(
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
297 UI.PixmapCache.getIcon("closehead"), self.tr("Close Heads"),
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
298 self.__closeHeadsActTriggered)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
299 self.__closeHeadsAct.setToolTip(self.tr("Close the selected heads"))
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
300
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
301 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
302 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
303 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
304 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
305 "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
306
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
307 self.__actionsMenu.addSeparator()
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
308
5322
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
309 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
310 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
311 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
312 self.__bookmarkAct.setToolTip(
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
313 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
314 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
315 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
316 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
317 self.__bookmarkMoveAct.setToolTip(
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
318 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
319
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
320 self.__actionsMenu.addSeparator()
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
321
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
322 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
323 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
324 self.__pullActTriggered)
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
325 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
326 "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
327 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
328 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
329 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
330 "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
331 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
332 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
333 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
334 "Fetch changes from a remote repository"))
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
335
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
336 self.__actionsMenu.addSeparator()
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
337
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
338 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
339 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
340 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
341 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
342 "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
343 " 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
344 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
345 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
346 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
347 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
348 "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
349
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
350 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
351
5501
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
352 self.__bundleAct = self.__actionsMenu.addAction(
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
353 UI.PixmapCache.getIcon("vcsCreateChangegroup.png"),
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
354 self.tr("Create Changegroup"), self.__bundleActTriggered)
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
355 self.__bundleAct.setToolTip(self.tr(
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
356 "Create a changegroup file containing the selected changesets"))
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
357 self.__bundleAct.setWhatsThis(self.tr(
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
358 """<b>Create Changegroup</b>\n<p>This creates a changegroup"""
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
359 """ file containing the selected revisions. If no revisions"""
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
360 """ are selected, all changesets will be bundled. If one"""
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
361 """ revision is selected, it will be interpreted as the base"""
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
362 """ revision. Otherwise the lowest revision will be used as"""
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
363 """ the base revision and all other revision will be bundled."""
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
364 """ If the dialog is showing outgoing changesets, all"""
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
365 """ selected changesets will be bundled.</p>"""))
5514
1aa13333eb9f Added a an entry to apply the currently previewed changegroup file to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5513
diff changeset
366 self.__unbundleAct = self.__actionsMenu.addAction(
1aa13333eb9f Added a an entry to apply the currently previewed changegroup file to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5513
diff changeset
367 UI.PixmapCache.getIcon("vcsApplyChangegroup.png"),
1aa13333eb9f Added a an entry to apply the currently previewed changegroup file to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5513
diff changeset
368 self.tr("Apply Changegroup"), self.__unbundleActTriggered)
1aa13333eb9f Added a an entry to apply the currently previewed changegroup file to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5513
diff changeset
369 self.__unbundleAct.setToolTip(self.tr(
1aa13333eb9f Added a an entry to apply the currently previewed changegroup file to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5513
diff changeset
370 "Apply the currently viewed changegroup file"))
5501
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
371
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
372 self.__actionsMenu.addSeparator()
59ed7b2dd952 Started to add a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5496
diff changeset
373
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
374 self.__gpgSignAct = self.__actionsMenu.addAction(
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
375 UI.PixmapCache.getIcon("changesetSign.png"),
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
376 self.tr("Sign Revisions"), self.__gpgSignActTriggered)
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
377 self.__gpgSignAct.setToolTip(self.tr(
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
378 "Add a signature for the selected revisions"))
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
379 self.__gpgVerifyAct = self.__actionsMenu.addAction(
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
380 UI.PixmapCache.getIcon("changesetSignVerify.png"),
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
381 self.tr("Verify Signatures"), self.__gpgVerifyActTriggered)
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
382 self.__gpgVerifyAct.setToolTip(self.tr(
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
383 "Verify all signatures there may be for the selected revision"))
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
384
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
385 self.__actionsMenu.addSeparator()
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
386
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
387 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
388 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
389 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
390 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
391 "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
392
5503
20dd5c1e43ec Finished adding a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5501
diff changeset
393 self.__actionsMenu.addSeparator()
20dd5c1e43ec Finished adding a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5501
diff changeset
394
20dd5c1e43ec Finished adding a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5501
diff changeset
395 self.__selectAllAct = self.__actionsMenu.addAction(
20dd5c1e43ec Finished adding a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5501
diff changeset
396 self.tr("Select All Entries"), self.__selectAllActTriggered)
20dd5c1e43ec Finished adding a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5501
diff changeset
397 self.__unselectAllAct = self.__actionsMenu.addAction(
20dd5c1e43ec Finished adding a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5501
diff changeset
398 self.tr("Deselect All Entries"),
20dd5c1e43ec Finished adding a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5501
diff changeset
399 lambda: self.__selectAllActTriggered(False))
20dd5c1e43ec Finished adding a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5501
diff changeset
400
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
401 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
402 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
403 self.actionsButton.setMenu(self.__actionsMenu)
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
404
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
405 def __actionsMenuHovered(self, action):
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
406 """
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
407 Private slot to show the tooltip for an action menu entry.
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
408
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
409 @param action action to show tooltip for
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
410 @type QAction
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
411 """
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
412 QToolTip.showText(
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
413 QCursor.pos(), action.toolTip(),
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
414 self.__actionsMenu, self.__actionsMenu.actionGeometry(action))
5487
7ce9c29cd26f Added some TODOs to further enhance the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5486
diff changeset
415
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
416 def __initData(self):
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
417 """
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
418 Private method to (re-)initialize some data.
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
419 """
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
420 self.__maxDate = QDate()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
421 self.__minDate = QDate()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
422 self.__filterLogsEnabled = True
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
423
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 self.buf = [] # buffer for stdout
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 self.diff = None
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 self.__started = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 self.__lastRev = 0
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
428 self.projectMode = False
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
429
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
430 # attributes to store log graph data
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
431 self.__revs = []
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
432 self.__revColors = {}
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
433 self.__revColor = 0
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
434
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
435 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
436
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
437 self.__projectWorkingDirParents = []
2543
eb9472947653 Added a 'Copy Changesets' button to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2444
diff changeset
438 self.__projectBranch = ""
5445
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
439
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
440 self.__childrenInfo = collections.defaultdict(list)
178
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 def closeEvent(self, e):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3562
diff changeset
444 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
445
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 @param e close event (QCloseEvent)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 """
1256
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
448 if self.__hgClient:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
449 if self.__hgClient.isExecuting():
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
450 self.__hgClient.cancel()
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
451 else:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
452 if self.process is not None and \
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
453 self.process.state() != QProcess.NotRunning:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
454 self.process.terminate()
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
455 QTimer.singleShot(2000, self.process.kill)
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1250
diff changeset
456 self.process.waitForFinished(3000)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457
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
458 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
459 "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
460 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
461 "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
462 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
463 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
464 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
465 ]
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
466 )
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
467
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 e.accept()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469
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
470 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
471 """
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
472 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
473 """
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
474 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
475 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
476 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
477
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3359
diff changeset
478 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
479
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
480 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
481 """
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
482 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
483 """
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
484 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
485 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
486 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
487 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
488 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
489 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
490
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
491 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
492 """
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
493 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
494 """
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
495 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
496 "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
497 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
498 # 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
499 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
500 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
501 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
502
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
503 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
504 """
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
505 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
506 """
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
507 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
508 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
509 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
510 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
511 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
512 "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
513 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
514 "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
515
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
516 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
517 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
518 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
519 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
520 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
521 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
522
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
523 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
524
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
525 if self.initialCommandMode == "full_log":
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
526 self.commandMode = "incoming"
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
527 else:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
528 self.commandMode = self.initialCommandMode
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
529
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 def __resizeColumnsLog(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 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
533 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 self.logTree.header().resizeSections(QHeaderView.ResizeToContents)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535 self.logTree.header().setStretchLastSection(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
536
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 def __resizeColumnsFiles(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 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
540 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 self.filesTree.header().resizeSections(QHeaderView.ResizeToContents)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 self.filesTree.header().setStretchLastSection(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 def __resortFiles(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 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
547 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 sortColumn = self.filesTree.sortColumn()
3023
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
549 self.filesTree.sortItems(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
550 1, self.filesTree.header().sortIndicatorOrder())
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
551 self.filesTree.sortItems(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
552 sortColumn, self.filesTree.header().sortIndicatorOrder())
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
554 def __getColor(self, n):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
555 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
556 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
557
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
558 @param n color index (integer)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
559 @return color name (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
560 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
561 return COLORS[n % len(COLORS)]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
562
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
563 def __branchColor(self, branchName):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
564 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
565 Private method to calculate a color for a given branch name.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
566
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
567 @param branchName name of the branch (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
568 @return name of the color to use (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
569 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
570 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
571 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
572 len(self.__branchColors))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
573 return self.__branchColors[branchName]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
574
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
575 def __generateEdges(self, rev, parents):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
576 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
577 Private method to generate edge info for the give data.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
578
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
579 @param rev revision to calculate edge info for (integer)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
580 @param parents list of parent revisions (list of integers)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
581 @return tuple containing the column and color index for
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
582 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
583 between the given node and its parents
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
584 (integer, integer, [(integer, integer, integer), ...])
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
585 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
586 if rev not in self.__revs:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
587 # new head
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
588 self.__revs.append(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
589 self.__revColors[rev] = self.__revColor
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
590 self.__revColor += 1
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
591
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
592 col = self.__revs.index(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
593 color = self.__revColors.pop(rev)
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
594 nextRevs = self.__revs[:]
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
595
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
596 # add parents to next
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
597 addparents = [p for p in parents if p not in nextRevs]
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
598 nextRevs[col:col + 1] = addparents
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
599
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
600 # set colors for the parents
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
601 for i, p in enumerate(addparents):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
602 if not i:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
603 self.__revColors[p] = color
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
604 else:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
605 self.__revColors[p] = self.__revColor
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
606 self.__revColor += 1
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
607
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
608 # add edges to the graph
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
609 edges = []
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
610 if parents[0] != -1:
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
611 for ecol, erev in enumerate(self.__revs):
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
612 if erev in nextRevs:
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
613 edges.append(
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
614 (ecol, nextRevs.index(erev), self.__revColors[erev]))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
615 elif erev == rev:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
616 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
617 edges.append(
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
618 (ecol, nextRevs.index(p), self.__revColors[p]))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
619
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
620 self.__revs = nextRevs
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
621 return col, color, edges
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
622
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
623 def __generateIcon(self, column, color, bottomedges, topedges, dotColor,
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
624 currentRev, closed, isDraft):
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
625 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
626 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
627 given data.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
628
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
629 @param column column index of the revision
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
630 @type int
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
631 @param color color of the node
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
632 @type int
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
633 @param bottomedges list of edges for the bottom of the node
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
634 @type list of tuples of (int, int, int)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
635 @param topedges list of edges for the top of the node
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
636 @type list of tuples of (int, int, int)
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
637 @param dotColor color to be used for the dot
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
638 @type 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
639 @param currentRev flag indicating to draw the icon for the
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
640 current revision
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
641 @type bool
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
642 @param closed flag indicating to draw an icon for a closed
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
643 branch
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
644 @type bool
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
645 @param isDraft flag indicating an entry of phase 'draft'
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
646 @type bool
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
647 @return icon for the node
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
648 @rtype QIcon
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
649 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
650 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
651 """
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
652 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
653
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
654 @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
655 @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
656 """
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
657 return int(1.2 * radius) * col + radius // 2 + 3
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
658
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
659 radius = self.__dotRadius
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
660 w = len(bottomedges) * radius + 20
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
661 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
662
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
663 dot_x = col2x(column, radius) - radius // 2
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
664 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
665
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
666 pix = QPixmap(w, h)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
667 pix.fill(QColor(0, 0, 0, 0))
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
668 painter = QPainter(pix)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
669 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
670
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
671 pen = QPen(Qt.blue)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
672 pen.setWidth(2)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
673 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
674
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
675 lpen = QPen(pen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
676 lpen.setColor(Qt.black)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
677 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
678
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
679 # draw the revision history lines
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
680 for y1, y2, lines in ((0, h, bottomedges),
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
681 (-h, 0, topedges)):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
682 if lines:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
683 for start, end, ecolor in lines:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
684 lpen = QPen(pen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
685 lpen.setColor(QColor(self.__getColor(ecolor)))
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
686 lpen.setWidth(2)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
687 painter.setPen(lpen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
688 x1 = col2x(start, radius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
689 x2 = col2x(end, radius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
690 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
691
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
692 penradius = 1
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
693 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
694
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
695 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
696
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
697 # 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
698 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
699 # 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
700 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
701 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
702 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
703 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
704 penradius = 3
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
705 painter.setBrush(dotColor)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
706 pen = QPen(pencolor)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
707 pen.setWidth(penradius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
708 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
709 if closed:
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
710 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
711 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
712 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
713 offset = radius // 2
6986
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
714 if self.commandMode == "incoming":
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
715 # incoming: draw a down arrow
6986
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
716 painter.drawConvexPolygon(
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
717 QPoint(dot_x, dot_y),
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
718 QPoint(dot_x + 2 * offset, dot_y),
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
719 QPoint(dot_x + offset, dot_y + 2 * offset)
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
720 )
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
721 else:
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
722 # outgoing: draw an up arrow
6986
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
723 painter.drawConvexPolygon(
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
724 QPoint(dot_x + offset, dot_y),
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
725 QPoint(dot_x, dot_y + 2 * offset),
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
726 QPoint(dot_x + 2 * offset, dot_y + 2 * offset)
23886c1dd3d0 HgLogBrowserDialog: changed the icon for incoming and outgoing changesets to make the changeset type more distinguishable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
727 )
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
728 else:
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
729 if isDraft:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
730 # 'draft' phase: draw an up arrow like outgoing
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
731 offset = radius // 2
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
732 painter.drawConvexPolygon(
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
733 QPoint(dot_x + offset, dot_y),
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
734 QPoint(dot_x, dot_y + 2 * offset),
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
735 QPoint(dot_x + 2 * offset, dot_y + 2 * offset)
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
736 )
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
737 else:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
738 painter.drawEllipse(dot_x, dot_y, radius, radius)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
739 painter.end()
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
740 return QIcon(pix)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
741
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
742 def __getParents(self, rev):
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
743 """
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
744 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
745 file/directory.
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
746
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
747 @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
748 @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
749 """
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
750 errMsg = ""
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
751 parents = [-1]
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
752
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
753 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
754 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
755 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
756 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
757 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
758 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
759 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
760 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
761 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
762 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
763 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
764 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
765 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
766 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
767 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
768 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
769
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
770 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
771 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
772 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
773 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
774 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
775 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
776 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
777 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
778 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
779 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
780 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
781 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
782 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
783 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
784 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
785 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
786 "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
787 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
788 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
789
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
790 if errMsg:
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
791 E5MessageBox.critical(
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
792 self,
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
793 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
794 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
795
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
796 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
797 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
798
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
799 return parents
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
800
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
801 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
802 """
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
803 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
804 """
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
805 errMsg = ""
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
806
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
807 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
808 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
809
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
810 output = ""
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
811 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
812 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
813 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
814 process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
815 process.setWorkingDirectory(self.repodir)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
816 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
817 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
818 if procStarted:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
819 finished = process.waitForFinished(30000)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
820 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
821 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
822 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
823 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
824 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
825 errMsg = self.tr(
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
826 "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
827 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
828 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
829
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
830 if errMsg:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
831 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
832 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
833 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
834 errMsg)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
835
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
836 if output:
2544
3868561e3962 Fixed an issue introduced by the last changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2543
diff changeset
837 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
838 if len(outputList) == 2:
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
839 outputRevs = outputList[0].strip()
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
840 if outputRevs.endswith("+"):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
841 outputRevs = outputRevs[:-1]
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
842 self.__projectWorkingDirParents = outputRevs.split('+')
7187
11b0c7802a70 HgLogBrowserDialog: fixed the patch submitted by Christos.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7183
diff changeset
843 else:
11b0c7802a70 HgLogBrowserDialog: fixed the patch submitted by Christos.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7183
diff changeset
844 self.__projectWorkingDirParents = [outputRevs]
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
845 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
846
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
847 def __getClosedBranches(self):
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
848 """
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
849 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
850 """
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
851 self.__closedBranchesRevs = []
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
852 errMsg = ""
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
853
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
854 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
855 args.append("--closed")
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
856
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
857 output = ""
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
858 if self.__hgClient:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
859 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
860 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
861 process = QProcess()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
862 process.setWorkingDirectory(self.repodir)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
863 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
864 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
865 if procStarted:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
866 finished = process.waitForFinished(30000)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
867 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
868 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
869 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
870 else:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
871 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
872 errMsg = self.tr(
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
873 "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
874 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
875 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
876
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
877 if errMsg:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
878 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
879 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
880 self.tr("Mercurial Error"),
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
881 errMsg)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
882
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
883 if output:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
884 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
885 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
886 parts = line.split()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
887 self.__closedBranchesRevs.append(
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
888 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
889
7010
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
890 def __getHeads(self):
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
891 """
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
892 Private method to get the list of all heads.
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
893 """
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
894 self.__headRevisions = []
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
895 errMsg = ""
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
896
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
897 args = self.vcs.initCommand("heads")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
898 args.append("--closed")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
899 args.append("--template")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
900 args.append("{rev}\n")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
901
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
902 output = ""
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
903 if self.__hgClient:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
904 output, errMsg = self.__hgClient.runcommand(args)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
905 else:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
906 process = QProcess()
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
907 process.setWorkingDirectory(self.repodir)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
908 process.start('hg', args)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
909 procStarted = process.waitForStarted(5000)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
910 if procStarted:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
911 finished = process.waitForFinished(30000)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
912 if finished and process.exitCode() == 0:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
913 output = str(process.readAllStandardOutput(),
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
914 self.vcs.getEncoding(), 'replace')
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
915 else:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
916 if not finished:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
917 errMsg = self.tr(
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
918 "The hg process did not finish within 30s.")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
919 else:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
920 errMsg = self.tr("Could not start the hg executable.")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
921
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
922 if errMsg:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
923 E5MessageBox.critical(
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
924 self,
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
925 self.tr("Mercurial Error"),
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
926 errMsg)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
927
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
928 if output:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
929 for line in output.splitlines():
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
930 line = line.strip()
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
931 if line:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
932 self.__headRevisions.append(line)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
933
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
934 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
935 """
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
936 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
937
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
938 @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
939 @type str
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
940 @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
941 @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
942 """
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
943 errMsg = ""
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
944
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
945 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
946
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
947 output = ""
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
948 if self.__hgClient:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451