eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

Tue, 13 Apr 2021 18:02:59 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 13 Apr 2021 18:02:59 +0200
changeset 8234
fcb6b4b96274
parent 8222
5994b80b8760
child 8240
93b8a353c4bf
permissions
-rw-r--r--

Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 2).

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
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
3 # Copyright (c) 2010 - 2021 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
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 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
11 import re
5445
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
12 import collections
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
7775
4a1db75550bd Changed code to not use deprecated 'QRegExp' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7771
diff changeset
14 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QSize, QPoint, QFileInfo
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
15 from PyQt5.QtGui import (
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7679
diff changeset
16 QColor, QPixmap, QPainter, QPen, QBrush, QIcon, QTextCursor, QPalette
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
17 )
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
18 from PyQt5.QtWidgets import (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
19 QWidget, QDialogButtonBox, QHeaderView, QTreeWidgetItem, QApplication,
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
20 QLineEdit, QMenu, QInputDialog
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
21 )
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 204
diff changeset
23 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
24 from E5Gui import E5MessageBox, E5FileDialog
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7679
diff changeset
25 from E5Gui.E5OverrideCursor import E5OverrideCursor
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 204
diff changeset
26
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 from .Ui_HgLogBrowserDialog import Ui_HgLogBrowserDialog
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
29 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
30 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
31
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
32 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
33 import Preferences
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
34 import Utilities
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
36 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple",
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
37 "cyan", "olive", "magenta", "darkred", "darkmagenta",
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
38 "darkcyan", "gray", "yellow"]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
39 COLORS = [str(QColor(x).name()) for x in COLORNAMES]
7455
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
40
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
41 LIGHTCOLORS = ["#aaaaff", "#7faa7f", "#ffaaaa", "#aaffaa", "#7f7faa",
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
42 "#ffaaff", "#aaffff", "#d5d579", "#ffaaff", "#d57979",
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
43 "#d579d5", "#79d5d5", "#d5d5d5", "#d5d500",
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
44 ]
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
45
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
46
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
47 class HgLogBrowserDialog(QWidget, Ui_HgLogBrowserDialog):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 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
50 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
51 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
52 BranchColumn = 1
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
53 RevisionColumn = 2
1605
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
54 PhaseColumn = 3
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
55 AuthorColumn = 4
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
56 DateColumn = 5
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
57 MessageColumn = 6
899cb1241de5 Added support for Phases as of Mercurial 2.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
58 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
59 BookmarksColumn = 8
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
60
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
61 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
62 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
63 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
64
3554
9ca56a89aec5 A liitle enhancement and a fix to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3546
diff changeset
65 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
66
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
67 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
68 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 Constructor
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 @param vcs reference to the vcs object
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
72 @type Hg
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
73 @param mode mode of the dialog
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
74 @type str (one of log, full_log, incoming, outgoing)
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
75 @param parent parent widget
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
76 @type QWidget
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8151
diff changeset
78 super().__init__(parent)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.setupUi(self)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
81 windowFlags = self.windowFlags()
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
82 windowFlags |= Qt.WindowType.WindowContextHelpButtonHint
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
83 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
84
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
85 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
86 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
87 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
88 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
89 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
90
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
91 if not mode:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
92 if vcs.getPlugin().getPreferences("LogBrowserShowFullLog"):
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
93 mode = "full_log"
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
94 else:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
95 mode = "log"
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
96
782
2c567a5ceade Added different window titles to the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 781
diff changeset
97 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
98 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
99 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
100 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
101 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
102 self.setWindowTitle(self.tr("Mercurial Log (Outgoing)"))
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
103 elif mode == "full_log":
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
104 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
105
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
106 self.buttonBox.button(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
107 QDialogButtonBox.StandardButton.Close).setEnabled(False)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
108 self.buttonBox.button(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
109 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
112 self.filesTree.header().setSortIndicator(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
113 0, Qt.SortOrder.AscendingOrder)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
115 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow"))
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
116 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow"))
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
117
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
118 self.refreshButton = self.buttonBox.addButton(
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
119 self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole)
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
120 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
121 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
122 self.refreshButton.setEnabled(False)
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
123
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
124 self.findPrevButton.setIcon(UI.PixmapCache.getIcon("1leftarrow"))
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
125 self.findNextButton.setIcon(UI.PixmapCache.getIcon("1rightarrow"))
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
126 self.__findBackwards = False
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
127
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
128 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
129 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
130
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
131 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
132 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
133 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
134 self.fieldCombo.addItem(self.tr("File"), "file")
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
135 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
136
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
137 font = Preferences.getEditorOtherFonts("MonospacedFont")
7779
757334671130 Optimized the various diff panes by using QPlainTextEdit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7775
diff changeset
138 self.diffEdit.document().setDefaultFont(font)
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
139
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
140 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
141 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
142 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
143
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 self.vcs = vcs
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
145 if mode in ("log", "incoming", "outgoing", "full_log"):
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
146 if mode == "full_log":
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
147 self.commandMode = "incoming"
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
148 else:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
149 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
150 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
151 else:
215
e8978dca44af Fixed issues with non-existing bundle caches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
152 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
153 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
154 self.__hgClient = vcs.getClient()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155
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
156 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
157 "<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
158 "<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
159 "<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
160 "<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
161 "<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
162 "{4}"
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
163 "<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
164 "</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
165 )
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
166 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
167 "<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
168 )
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
169 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
170 "<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
171 )
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
172 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
173 "<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
174 )
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
175 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
176 "<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
177 )
4059
15b78ac687fb Enhanced the Mercurial log browser functionality by a search mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
178 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
179 "<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
180 )
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
181
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
182 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
183 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
184 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
185 self.__selectedRevisions = []
4250
d3bd7c3dcb80 Fixed issues in the Subversion and Mercurial log browser windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4080
diff changeset
186 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
187
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
188 self.__initData()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
189
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
190 self.__allBranchesFilter = self.tr("All")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 self.fromDate.setDisplayFormat("yyyy-MM-dd")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 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
194 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
195
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
196 # roles used in the log tree
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
197 self.__messageRole = Qt.ItemDataRole.UserRole
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
198 self.__changesRole = Qt.ItemDataRole.UserRole + 1
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
199 self.__edgesRole = Qt.ItemDataRole.UserRole + 2
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
200 self.__parentsRole = Qt.ItemDataRole.UserRole + 3
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
201 self.__latestTagRole = Qt.ItemDataRole.UserRole + 4
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
202 self.__incomingRole = Qt.ItemDataRole.UserRole + 5
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
204 # roles used in the file tree
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
205 self.__diffFileLineRole = Qt.ItemDataRole.UserRole
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
206
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 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
208 '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
209 '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
210 'M': self.tr('Modified'),
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
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
213 self.phases = {
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
214 '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
215 '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
216 '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
217 }
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
218
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
219 self.__dotRadius = 8
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
220 self.__rowHeight = 20
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
221
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
222 self.logTree.setIconSize(
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
223 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
224 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
225 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
226 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
227
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
228 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
229 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
230 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
231 self.__logTreeBoldFont.setBold(True)
7493
1696e91a5393 Added vector icons for the mercurial and subversion plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7489
diff changeset
232 self.__logTreeHasDarkBackground = e5App().usesDarkPalette()
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
5445
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
234 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
235
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
236 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
237
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
238 self.__finishCallbacks = []
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
239 if self.initialCommandMode == "full_log":
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
240 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
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 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
243 """
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
244 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
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 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
247 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
248
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
249 @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
250 @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
251 """
a5d5e757efcf Fixed a bug in the log browser dialogs causing an endless loop.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5449
diff changeset
252 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
253 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
254
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
255 def __initActionsMenu(self):
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
256 """
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
257 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
258 """
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
259 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
260 self.__actionsMenu.setTearOffEnabled(True)
7201
6b42677d7043 Modified sources to be in line with the minimum Qt/PyQt requirement (v 5.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7200
diff changeset
261 self.__actionsMenu.setToolTipsVisible(True)
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
262
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
263 self.__graftAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
264 UI.PixmapCache.getIcon("vcsGraft"),
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
265 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
266 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
267 "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
268
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
269 self.__mergeAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
270 UI.PixmapCache.getIcon("vcsMerge"),
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5494
diff changeset
271 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
272 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
273 "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
274
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
275 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
276 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
277 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
278 "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
279 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
280 """<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
281 """ 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
282 """ 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
283
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
284 self.__tagAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
285 UI.PixmapCache.getIcon("vcsTag"), self.tr("Tag"),
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
286 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
287 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
288
7010
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
289 self.__closeHeadsAct = self.__actionsMenu.addAction(
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
290 UI.PixmapCache.getIcon("closehead"), self.tr("Close Heads"),
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
291 self.__closeHeadsActTriggered)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
292 self.__closeHeadsAct.setToolTip(self.tr("Close the selected heads"))
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
293
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
294 self.__switchAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
295 UI.PixmapCache.getIcon("vcsSwitch"), self.tr("Switch"),
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
296 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
297 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
298 "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
299
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
300 self.__actionsMenu.addSeparator()
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
301
5322
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
302 self.__bookmarkAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
303 UI.PixmapCache.getIcon("addBookmark"),
5322
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
304 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
305 self.__bookmarkAct.setToolTip(
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
306 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
307 self.__bookmarkMoveAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
308 UI.PixmapCache.getIcon("moveBookmark"),
5322
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
309 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
310 self.__bookmarkMoveAct.setToolTip(
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
311 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
312
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
313 self.__actionsMenu.addSeparator()
c2cabdca0734 Added bookmark actions to the Mercurial Log Browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5276
diff changeset
314
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
315 self.__pullAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
316 UI.PixmapCache.getIcon("vcsUpdate"), self.tr("Pull Changes"),
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
317 self.__pullActTriggered)
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
318 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
319 "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
320 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
321 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
322 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
323 "Pull large files for selected revisions"))
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
324
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
325 self.__actionsMenu.addSeparator()
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
326
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
327 self.__pushAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
328 UI.PixmapCache.getIcon("vcsCommit"),
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
329 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
330 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
331 "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
332 " 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
333 self.__pushAllAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
334 UI.PixmapCache.getIcon("vcsCommit"),
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
335 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
336 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
337 "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
338
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
339 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
340
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
341 self.__bundleAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
342 UI.PixmapCache.getIcon("vcsCreateChangegroup"),
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
343 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
344 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
345 "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
346 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
347 """<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
348 """ 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
349 """ 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
350 """ 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
351 """ 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
352 """ 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
353 """ 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
354 """ 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
355 self.__unbundleAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
356 UI.PixmapCache.getIcon("vcsApplyChangegroup"),
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
357 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
358 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
359 "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
360
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 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
362
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
363 self.__gpgSignAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
364 UI.PixmapCache.getIcon("changesetSign"),
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
365 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
366 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
367 "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
368 self.__gpgVerifyAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
369 UI.PixmapCache.getIcon("changesetSignVerify"),
5506
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
370 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
371 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
372 "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
373
9482a0ded319 Added a GPG actions to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5503
diff changeset
374 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
375
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
376 self.__stripAct = self.__actionsMenu.addAction(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
377 UI.PixmapCache.getIcon("fileDelete"),
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5104
diff changeset
378 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
379 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
380 "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
381
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
382 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
383
20dd5c1e43ec Finished adding a 'Create Changegroup' action to the Mercurial log browser tools menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5501
diff changeset
384 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
385 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
386 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
387 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
388 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
389
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
390 self.actionsButton.setIcon(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7493
diff changeset
391 UI.PixmapCache.getIcon("actionsToolButton"))
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
392 self.actionsButton.setMenu(self.__actionsMenu)
1086
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
393
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
394 def __initData(self):
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
395 """
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
396 Private method to (re-)initialize some data.
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
397 """
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
398 self.__maxDate = QDate()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
399 self.__minDate = QDate()
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
400 self.__filterLogsEnabled = True
b48ce064b224 Enhanced the Mercurial log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
401
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 self.buf = [] # buffer for stdout
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 self.diff = None
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 self.__started = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 self.__lastRev = 0
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
406 self.projectMode = False
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
407
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
408 # attributes to store log graph data
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
409 self.__revs = []
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
410 self.__revColors = {}
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
411 self.__revColor = 0
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
412
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
413 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
414
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
415 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
416 self.__projectBranch = ""
5445
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
417
b24720037f1f Added clickable links to the Mercurial log browser details pane.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5444
diff changeset
418 self.__childrenInfo = collections.defaultdict(list)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 def closeEvent(self, e):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3562
diff changeset
422 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
423
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 @param e close event (QCloseEvent)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 """
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
426 if self.__hgClient.isExecuting():
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
427 self.__hgClient.cancel()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428
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
429 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
430 "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
431 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
432 "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
433 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
434 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
435 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
436 ]
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
437 )
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
438
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 e.accept()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440
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
441 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
442 """
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
443 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
444 """
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
445 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
446 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
447 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
448
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8151
diff changeset
449 super().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
450
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
451 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
452 """
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
453 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
454 """
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
455 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
456 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
457 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
458 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
459 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
460 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
461
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 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
463 """
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 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
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 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
467 "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
468 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
469 # 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
470 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
471 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
472 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
473
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
474 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
475 """
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 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
477 """
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
478 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
479 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
480 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
481 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
482 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
483 "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
484 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
485 "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
486
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
487 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
488 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
489 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
490 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
491 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
492 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
493
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3279
diff changeset
494 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
495
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
496 if self.initialCommandMode == "full_log":
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
497 self.commandMode = "incoming"
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
498 else:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
499 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
500
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 def __resizeColumnsLog(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 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
504 """
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
505 self.logTree.header().resizeSections(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
506 QHeaderView.ResizeMode.ResizeToContents)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 self.logTree.header().setStretchLastSection(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 def __resizeColumnsFiles(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 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
512 """
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
513 self.filesTree.header().resizeSections(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
514 QHeaderView.ResizeMode.ResizeToContents)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 self.filesTree.header().setStretchLastSection(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 def __resortFiles(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 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
520 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 sortColumn = self.filesTree.sortColumn()
3023
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
522 self.filesTree.sortItems(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
523 1, self.filesTree.header().sortIndicatorOrder())
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
524 self.filesTree.sortItems(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
525 sortColumn, self.filesTree.header().sortIndicatorOrder())
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
527 def __getColor(self, n):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
528 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
529 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
530
7455
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
531 @param n color index
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
532 @type int
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
533 @return color name
7489
6543bcd150fd Updated source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7455
diff changeset
534 @rtype str
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
535 """
7455
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
536 if self.__logTreeHasDarkBackground:
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
537 return LIGHTCOLORS[n % len(LIGHTCOLORS)]
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
538 else:
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
539 return COLORS[n % len(COLORS)]
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
540
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
541 def __branchColor(self, branchName):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
542 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
543 Private method to calculate a color for a given branch name.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
544
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
545 @param branchName name of the branch (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
546 @return name of the color to use (string)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
547 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
548 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
549 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
550 len(self.__branchColors))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
551 return self.__branchColors[branchName]
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
552
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
553 def __generateEdges(self, rev, parents):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
554 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
555 Private method to generate edge info for the give data.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
556
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
557 @param rev revision to calculate edge info for (integer)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
558 @param parents list of parent revisions (list of integers)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
559 @return tuple containing the column and color index for
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
560 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
561 between the given node and its parents
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
562 (integer, integer, [(integer, integer, integer), ...])
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
563 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
564 if rev not in self.__revs:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
565 # new head
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
566 self.__revs.append(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
567 self.__revColors[rev] = self.__revColor
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
568 self.__revColor += 1
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 col = self.__revs.index(rev)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
571 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
572 nextRevs = self.__revs[:]
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
573
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
574 # 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
575 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
576 nextRevs[col:col + 1] = addparents
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
577
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
578 # set colors for the parents
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
579 for i, p in enumerate(addparents):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
580 if not i:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
581 self.__revColors[p] = color
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
582 else:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
583 self.__revColors[p] = self.__revColor
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
584 self.__revColor += 1
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 # add edges to the graph
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
587 edges = []
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
588 if parents[0] != -1:
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
589 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
590 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
591 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
592 (ecol, nextRevs.index(erev), self.__revColors[erev]))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
593 elif erev == rev:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
594 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
595 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
596 (ecol, nextRevs.index(p), self.__revColors[p]))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
597
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
598 self.__revs = nextRevs
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
599 return col, color, edges
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
600
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
601 def __generateIcon(self, column, color, bottomedges, topedges, dotColor,
7971
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
602 currentRev, closed, isPushableDraft):
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
603 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
604 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
605 given data.
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
606
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
607 @param column column index of the revision
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
608 @type int
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
609 @param color color of the node
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
610 @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
611 @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
612 @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
613 @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
614 @type list of tuples of (int, int, int)
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
615 @param dotColor color to be used for the dot
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
616 @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
617 @param currentRev flag indicating to draw the icon for the
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
618 current revision
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
619 @type bool
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
620 @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
621 branch
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
622 @type bool
7971
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
623 @param isPushableDraft flag indicating an entry of phase 'draft',
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
624 that can by pushed
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
625 @type bool
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
626 @return icon for the node
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
627 @rtype QIcon
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
628 """
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
629 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
630 """
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
631 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
632
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
633 @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
634 @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
635 """
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
636 return int(1.2 * radius) * col + radius // 2 + 3
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
637
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
638 textColor = self.logTree.palette().color(QPalette.ColorRole.Text)
7455
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
639
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
640 radius = self.__dotRadius
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
641 w = len(bottomedges) * radius + 20
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
642 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
643
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
644 dot_x = col2x(column, radius) - radius // 2
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
645 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
646
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
647 pix = QPixmap(w, h)
7455
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
648 pix.fill(QColor(0, 0, 0, 0)) # draw transparent background
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
649 painter = QPainter(pix)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
650 painter.setRenderHint(QPainter.RenderHint.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
651
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
652 # draw the revision history lines
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
653 for y1, y2, lines in ((0, h, bottomedges),
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
654 (-h, 0, topedges)):
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
655 if lines:
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
656 for start, end, ecolor in lines:
7455
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
657 lpen = QPen(QColor(self.__getColor(ecolor)))
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
658 lpen.setWidth(2)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
659 painter.setPen(lpen)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
660 x1 = col2x(start, radius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
661 x2 = col2x(end, radius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
662 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
663
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
664 penradius = 1
7455
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
665 pencolor = textColor
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
666
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
667 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
668
7455
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
669 # draw an indicator for the revision
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 if currentRev:
7455
9d0852f0bb2c GitLogBrowserDialog, HgLogBrowserDialog: added log tree colors to be used with dark backgrounds.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7454
diff changeset
671 # enlarge 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
672 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
673 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
674 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
675 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
676 penradius = 3
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
677 painter.setBrush(dotColor)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
678 pen = QPen(pencolor)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
679 pen.setWidth(penradius)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
680 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
681 if closed:
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
682 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
683 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
684 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
685 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
686 if self.commandMode == "incoming":
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
687 # 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
688 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
689 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
690 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
691 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
692 )
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
693 else:
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
694 # 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
695 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
696 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
697 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
698 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
699 )
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
700 else:
7971
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
701 if isPushableDraft:
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
702 # 'draft' phase: draw an up arrow like outgoing,
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
703 # if it can be pushed
7009
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
704 offset = radius // 2
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
705 painter.drawConvexPolygon(
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
706 QPoint(dot_x + offset, dot_y),
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
707 QPoint(dot_x, dot_y + 2 * offset),
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
708 QPoint(dot_x + 2 * offset, dot_y + 2 * offset)
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
709 )
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
710 else:
eaf5ed6ef298 Mercurial Interface:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6986
diff changeset
711 painter.drawEllipse(dot_x, dot_y, radius, radius)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
712 painter.end()
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
713 return QIcon(pix)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
714
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
715 def __getParents(self, rev):
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
716 """
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
717 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
718 file/directory.
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
719
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
720 @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
721 @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
722 """
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
723 errMsg = ""
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
724 parents = [-1]
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
725
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
726 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
727 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
728 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
729 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
730 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
731 args.append(self.__bundle)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
732 elif (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
733 self.vcs.bundleFile and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
734 os.path.exists(self.vcs.bundleFile)
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
735 ):
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
736 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
737 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
738 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
739 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
740 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
741 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
742 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
743 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
744
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
745 output, errMsg = self.__hgClient.runcommand(args)
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
746
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
747 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
748 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
749
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
750 return parents
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
751
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
752 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
753 """
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
754 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
755 """
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
756 errMsg = ""
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
757
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
758 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
759 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
760
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
761 output, errMsg = self.__hgClient.runcommand(args)
241
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
762
aaa856499ed5 Added code to the Mercurial log browser to highlight the current revision.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 236
diff changeset
763 if errMsg:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
764 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
765 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
766 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
767 errMsg)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
768
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
769 if output:
2544
3868561e3962 Fixed an issue introduced by the last changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2543
diff changeset
770 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
771 if len(outputList) == 2:
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
772 outputRevs = outputList[0].strip()
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
773 if outputRevs.endswith("+"):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
774 outputRevs = outputRevs[:-1]
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 7142
diff changeset
775 self.__projectWorkingDirParents = outputRevs.split('+')
7187
11b0c7802a70 HgLogBrowserDialog: fixed the patch submitted by Christos.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7183
diff changeset
776 else:
11b0c7802a70 HgLogBrowserDialog: fixed the patch submitted by Christos.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7183
diff changeset
777 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
778 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
779
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
780 def __getClosedBranches(self):
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
781 """
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
782 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
783 """
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
784 self.__closedBranchesRevs = []
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
785 errMsg = ""
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
786
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
787 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
788 args.append("--closed")
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
789
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
790 output, errMsg = self.__hgClient.runcommand(args)
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
791
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
792 if errMsg:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
793 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
794 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
795 self.tr("Mercurial Error"),
921
ae00e4fbcec0 Prepared Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
796 errMsg)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
797
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
798 if output:
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
799 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
800 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
801 parts = line.split()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
802 self.__closedBranchesRevs.append(
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
803 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
804
7010
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
805 def __getHeads(self):
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
806 """
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
807 Private method to get the list of all heads.
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
808 """
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
809 self.__headRevisions = []
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
810 errMsg = ""
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
811
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
812 args = self.vcs.initCommand("heads")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
813 args.append("--closed")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
814 args.append("--template")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
815 args.append("{rev}\n")
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
816
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
817 output, errMsg = self.__hgClient.runcommand(args)
7010
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
818
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
819 if errMsg:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
820 E5MessageBox.critical(
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
821 self,
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
822 self.tr("Mercurial Error"),
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
823 errMsg)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
824
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
825 if output:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
826 for line in output.splitlines():
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
827 line = line.strip()
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
828 if line:
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
829 self.__headRevisions.append(line)
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7009
diff changeset
830
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
831 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
832 """
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
833 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
834
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
835 @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
836 @type str
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
837 @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
838 @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
839 """
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
840 errMsg = ""
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
841
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
842 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
843
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
844 output, errMsg = self.__hgClient.runcommand(args)
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
845
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
846 if errMsg:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
847 E5MessageBox.critical(
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
848 self,
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
849 self.tr("Mercurial Error"),
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
850 errMsg)
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
851
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
852 res = ("", "")
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
853 if output:
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
854 for line in output.splitlines():
5477
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
855 if line.strip():
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
856 try:
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
857 name, rev = line.strip().rsplit(None, 1)
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
858 if name == tag:
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
859 res = tuple(rev.split(":", 1))
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
860 break
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
861 except ValueError:
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
862 # ignore silently
fb8875e356d4 Fixed a bug in the Mercurial GPG verify signature dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5463
diff changeset
863 pass
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
864
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
865 return res
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
866
932
efd23a913a09 Finished extending the Mercurial log browser to indicate closed branches.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 921
diff changeset
867 def __generateLogItem(self, author, date, message, revision, changedPaths,
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
868 parents, branches, tags, phase, bookmarks,
7971
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
869 latestTag, canPush=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 Private method to generate a log tree entry.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
872
7971
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
873 @param author author info
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
874 @type str
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
875 @param date date info
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
876 @type str
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
877 @param message text of the log message
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
878 @type list of str
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
879 @param revision revision info
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
880 @type str
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
881 @param changedPaths list of dictionary objects containing
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
882 info about the changed files/directories
7971
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
883 @type dict
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
884 @param parents list of parent revisions
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
885 @type list of int
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
886 @param branches list of branches
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
887 @type list of str
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
888 @param tags list of tags
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
889 @type str
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
890 @param phase phase of the entry
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
891 @type str
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
892 @param bookmarks list of bookmarks
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
893 @type str
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451
diff changeset
894 @param latestTag the latest tag(s) reachable from the changeset
7971
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
895 @type list of str
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
896 @param canPush flag indicating that changesets can be pushed
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
897 @type bool
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
898 @return reference to the generated item
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
899 @rtype QTreeWidgetItem
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
900 """
5451
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
901 logMessageColumnWidth = self.vcs.getPlugin().getPreferences(
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
902 "LogMessageColumnWidth")
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
903 msgtxt = ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 for line in message:
5451
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
905 if ". " in line:
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
906 msgtxt += " " + line.strip().split(". ", 1)[0] + "."
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
907 break
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
908 else:
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
909 msgtxt += " " + line.strip()
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
910 if len(msgtxt) > logMessageColumnWidth:
8ee36e8a315f Added the capability to configure the length of the log message shown in the message column of the Mercurial log browser list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5450
diff changeset
911 msgtxt = "{0}...".format(msgtxt[:logMessageColumnWidth])
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913 rev, node = revision.split(":")
8234
fcb6b4b96274 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8222
diff changeset
914 closedStr = (self.ClosedIndicator
fcb6b4b96274 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8222
diff changeset
915 if rev in self.__closedBranchesRevs else "")
fcb6b4b96274 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8222
diff changeset
916 phaseStr = self.phases.get(phase, phase)
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
917 columnLabels = [
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
918 "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
919 branches[0] + closedStr,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
920 "{0:>7}:{1}".format(rev, node),
4409
ff1cb0107d40 Enhanced the log browser functionality by pull and push actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4395
diff changeset
921 phaseStr,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
922 author,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
923 date,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
924 msgtxt,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
925 ", ".join(tags),
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
926 ]
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
927 if bookmarks is not None:
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
928 columnLabels.append(", ".join(bookmarks))
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
929 itm = QTreeWidgetItem(self.logTree, columnLabels)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 932
diff changeset
931 itm.setForeground(self.BranchColumn,
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
932 QBrush(QColor(self.__branchColor(branches[0]))))
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
933
187
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
934 if not self.projectMode:
d7916a2e31d6 Added some more refinements to the Mercurial log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 185
diff changeset
935 parents = self.__getParents(rev)
208
26ed553ad4fb Corrected the diff functions of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 207
diff changeset
936 if not parents:
26ed553ad4fb Corrected the diff functions of the log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 207
diff changeset
937 parents = [int(rev) - 1]
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
938 column, color, edges = self.__generateEdges(int(rev), parents)
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
939
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 itm.setData(0, self.__messageRole, message)
180
40ac468c2558 Enhanced LogBrowserDialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 179
diff changeset
941 itm.setData(0, self.__changesRole, changedPaths)
210
b1a204f22291 Fixed a few issues with the Mercurial log dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 208
diff changeset
942 itm.setData(0, self.__edgesRole, edges)
5459
cdfdecd2faef Extended the details view of the Mercurial log browser window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5451