eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7779
757334671130
child 7970
c4ee8a81584c
permissions
-rw-r--r--

Updated copyright for 2021.

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
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7779
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 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
7 Module implementing a dialog to show the output of the hg status command
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
8 process.
178
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
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import os
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
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
13 from PyQt5.QtCore import pyqtSlot, Qt, QSize
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: 7192
diff changeset
14 from PyQt5.QtGui import QTextCursor
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
15 from PyQt5.QtWidgets import (
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
16 QWidget, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
17 )
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 from E5Gui.E5Application import e5App
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 495
diff changeset
20 from E5Gui import E5MessageBox
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 from .Ui_HgStatusDialog import Ui_HgStatusDialog
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
24 from .HgDiffHighlighter import HgDiffHighlighter
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
25 from .HgDiffGenerator import HgDiffGenerator
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
26
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 import Preferences
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
28 import UI.PixmapCache
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 917
diff changeset
30
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 class HgStatusDialog(QWidget, Ui_HgStatusDialog):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
33 Class implementing a dialog to show the output of the hg status command
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
34 process.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
36 def __init__(self, vcs, mq=False, parent=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 Constructor
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 @param vcs reference to the vcs object
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
41 @param mq flag indicating to show a queue repo status (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 @param parent parent widget (QWidget)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2405
diff changeset
44 super(HgStatusDialog, self).__init__(parent)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.setupUi(self)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
47 self.__toBeCommittedColumn = 0
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
48 self.__statusColumn = 1
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
49 self.__pathColumn = 2
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.__lastColumn = self.statusList.columnCount()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
52 self.refreshButton = self.buttonBox.addButton(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
53 self.tr("Refresh"), QDialogButtonBox.ActionRole)
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
54 self.refreshButton.setToolTip(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
55 self.tr("Press to refresh the status display"))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.refreshButton.setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
60 self.diff = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.vcs = vcs
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 470
diff changeset
62 self.vcs.committed.connect(self.__committed)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
63 self.__hgClient = self.vcs.getClient()
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
64 self.__mq = mq
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.statusList.headerItem().setText(self.__lastColumn, "")
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
67 self.statusList.header().setSortIndicator(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
68 self.__pathColumn, Qt.AscendingOrder)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
70 font = Preferences.getEditorOtherFonts("MonospacedFont")
7779
757334671130 Optimized the various diff panes by using QPlainTextEdit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
71 self.diffEdit.document().setDefaultFont(font)
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
72
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
73 self.diffHighlighter = HgDiffHighlighter(self.diffEdit.document())
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
74 self.__diffGenerator = HgDiffGenerator(vcs, self)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
75 self.__diffGenerator.finished.connect(self.__generatorFinished)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
76
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
77 self.__selectedName = ""
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
78
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.modifiedIndicators = [
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
80 self.tr('added'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
81 self.tr('modified'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
82 self.tr('removed'),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 ]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 self.unversionedIndicators = [
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
86 self.tr('not tracked'),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 ]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
89 self.missingIndicators = [
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
90 self.tr('missing')
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
91 ]
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
92
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.status = {
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
94 'A': self.tr('added'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
95 'C': self.tr('normal'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
96 'I': self.tr('ignored'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
97 'M': self.tr('modified'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
98 'R': self.tr('removed'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
99 '?': self.tr('not tracked'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
100 '!': self.tr('missing'),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 }
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
102
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
103 self.__initActionsMenu()
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
104
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
105 if mq:
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
106 self.diffLabel.setVisible(False)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
107 self.diffEdit.setVisible(False)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
108 self.actionsButton.setEnabled(False)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
109 self.diffSplitter.setSizes([600, 0])
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
110 else:
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
111 self.diffSplitter.setSizes([300, 300])
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
112
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
113 def __initActionsMenu(self):
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
114 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
115 Private method to initialize the actions menu.
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
116 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
117 self.__actionsMenu = QMenu()
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
118 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: 7192
diff changeset
119 self.__actionsMenu.setToolTipsVisible(True)
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
120 self.__actionsMenu.aboutToShow.connect(self.__showActionsMenu)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
121
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
122 self.__commitAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
123 self.tr("Commit"), self.__commit)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
124 self.__commitAct.setToolTip(self.tr("Commit the selected changes"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
125 self.__commitSelectAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
126 self.tr("Select all for commit"), self.__commitSelectAll)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
127 self.__commitDeselectAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
128 self.tr("Unselect all from commit"), self.__commitDeselectAll)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
129
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
130 self.__actionsMenu.addSeparator()
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
131
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
132 self.__addAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
133 self.tr("Add"), self.__add)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
134 self.__addAct.setToolTip(self.tr("Add the selected files"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
135 self.__lfAddLargeAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
136 self.tr("Add as Large Files"), lambda: self.__lfAdd("large"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
137 self.__lfAddLargeAct.setToolTip(self.tr(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
138 "Add the selected files as a large files using the 'Large Files'"
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
139 " extension"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
140 self.__lfAddNormalAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
141 self.tr("Add as Normal Files"), lambda: self.__lfAdd("normal"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
142 self.__lfAddNormalAct.setToolTip(self.tr(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
143 "Add the selected files as a normal files using the 'Large Files'"
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
144 " extension"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
145
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
146 self.__actionsMenu.addSeparator()
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
147
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
148 self.__diffAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
149 self.tr("Differences"), self.__diff)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
150 self.__diffAct.setToolTip(self.tr(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
151 "Shows the differences of the selected entry in a"
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
152 " separate dialog"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
153 self.__sbsDiffAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
154 self.tr("Differences Side-By-Side"), self.__sbsDiff)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
155 self.__sbsDiffAct.setToolTip(self.tr(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
156 "Shows the differences of the selected entry side-by-side in"
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
157 " a separate dialog"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
158
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
159 self.__actionsMenu.addSeparator()
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
160
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
161 self.__revertAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
162 self.tr("Revert"), self.__revert)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
163 self.__revertAct.setToolTip(self.tr(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
164 "Reverts the changes of the selected files"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
165
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
166 self.__actionsMenu.addSeparator()
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
167
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
168 self.__forgetAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
169 self.tr("Forget missing"), self.__forget)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
170 self.__forgetAct.setToolTip(self.tr(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
171 "Forgets about the selected missing files"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
172 self.__restoreAct = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
173 self.tr("Restore missing"), self.__restoreMissing)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
174 self.__restoreAct.setToolTip(self.tr(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
175 "Restores the selected missing files"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
176
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
177 self.__actionsMenu.addSeparator()
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
178
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
179 self.__commitMergeAct = self.__actionsMenu.addAction(
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
180 self.tr("Commit Merge"), self.__commitMerge)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
181 self.__commitMergeAct.setToolTip(self.tr("Commit all the merged"
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
182 " changes."))
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
183 self.__abortMergeAct = self.__actionsMenu.addAction(
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
184 self.tr("Abort Merge"), self.__abortMerge)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
185 self.__commitMergeAct.setToolTip(self.tr("Abort an uncommitted merge "
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
186 "and lose all changes"))
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
187
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
188 self.__actionsMenu.addSeparator()
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
189
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
190 act = self.__actionsMenu.addAction(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
191 self.tr("Adjust column sizes"), self.__resizeColumns)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
192 act.setToolTip(self.tr(
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
193 "Adjusts the width of all columns to their contents"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
194
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
195 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: 7370
diff changeset
196 UI.PixmapCache.getIcon("actionsToolButton"))
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
197 self.actionsButton.setMenu(self.__actionsMenu)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
199 def closeEvent(self, e):
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
200 """
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
201 Protected slot implementing a close event handler.
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
202
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
203 @param e close event (QCloseEvent)
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
204 """
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
205 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
206 self.__hgClient.cancel()
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
207
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
208 if self.__mq:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
209 self.vcs.getPlugin().setPreferences(
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
210 "MqStatusDialogGeometry", self.saveGeometry())
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
211 self.vcs.getPlugin().setPreferences(
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
212 "MqStatusDialogSplitterState", self.diffSplitter.saveState())
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
213 else:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
214 self.vcs.getPlugin().setPreferences(
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
215 "StatusDialogGeometry", self.saveGeometry())
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
216 self.vcs.getPlugin().setPreferences(
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
217 "StatusDialogSplitterState", self.diffSplitter.saveState())
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
218
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
219 e.accept()
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
220
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
221 def show(self):
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
222 """
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
223 Public slot to show the dialog.
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
224 """
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
225 super(HgStatusDialog, self).show()
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
226
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
227 if self.__mq:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
228 geom = self.vcs.getPlugin().getPreferences(
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
229 "MqStatusDialogGeometry")
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
230 else:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
231 geom = self.vcs.getPlugin().getPreferences(
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
232 "StatusDialogGeometry")
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
233 if geom.isEmpty():
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
234 s = QSize(800, 600)
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
235 self.resize(s)
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
236 else:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
237 self.restoreGeometry(geom)
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
238
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
239 if self.__mq:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
240 diffSplitterState = self.vcs.getPlugin().getPreferences(
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
241 "MqStatusDialogSplitterState")
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
242 else:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
243 diffSplitterState = self.vcs.getPlugin().getPreferences(
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
244 "StatusDialogSplitterState")
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
245 if diffSplitterState is not None:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
246 self.diffSplitter.restoreState(diffSplitterState)
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
247
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 def __resort(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 Private method to resort the tree.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 """
3023
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
252 self.statusList.sortItems(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
253 self.statusList.sortColumn(),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 self.statusList.header().sortIndicatorOrder())
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 def __resizeColumns(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 Private method to resize the list columns.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 self.statusList.header().resizeSections(QHeaderView.ResizeToContents)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 self.statusList.header().setStretchLastSection(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 def __generateItem(self, status, path):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 Private method to generate a status item in the status list.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 @param status status indicator (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 @param path path of the file or directory (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 """
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
270 statusText = self.status[status]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 itm = QTreeWidgetItem(self.statusList, [
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 917
diff changeset
272 "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 917
diff changeset
273 statusText,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 917
diff changeset
274 path,
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 ])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
277 itm.setTextAlignment(1, Qt.AlignHCenter)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
278 itm.setTextAlignment(2, Qt.AlignLeft)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
280 if status in "AMR":
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
281 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable)
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
282 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked)
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
283 else:
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
284 itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable)
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
285
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
286 if statusText not in self.__statusFilters:
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
287 self.__statusFilters.append(statusText)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
288
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 def start(self, fn):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 """
198
7ab8e126f404 Fixed a few issues with the Mercurial plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 197
diff changeset
291 Public slot to start the hg status command.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 @param fn filename(s)/directoryname(s) to show the status of
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 (string or list of strings)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 self.errorGroup.hide()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 self.intercept = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 self.args = fn
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
300 self.actionsButton.setEnabled(False)
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
301
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
302 self.statusFilterCombo.clear()
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
303 self.__statusFilters = []
4126
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
304 self.statusList.clear()
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
305
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
306 if self.__mq:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
307 self.setWindowTitle(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
308 self.tr("Mercurial Queue Repository Status"))
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
309 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
310 self.setWindowTitle(self.tr('Mercurial Status'))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311
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: 3190
diff changeset
312 args = self.vcs.initCommand("status")
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
313 if self.__mq:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
314 args.append('--mq')
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
315 if isinstance(fn, list):
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
316 self.dname, fnames = self.vcs.splitPathList(fn)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
317 else:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
318 self.dname, fname = self.vcs.splitPath(fn)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 else:
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
320 if self.vcs.hasSubrepositories():
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
321 args.append("--subrepos")
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
322
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
323 if isinstance(fn, list):
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
324 self.dname, fnames = self.vcs.splitPathList(fn)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
325 self.vcs.addArguments(args, fn)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
326 else:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
327 self.dname, fname = self.vcs.splitPath(fn)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
328 args.append(fn)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 repodir = self.dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 repodir = os.path.dirname(repodir)
1318
6fa303bd65d6 Fixed issues in various Mercurial files that could cause infinite loops on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1311
diff changeset
334 if os.path.splitdrive(repodir)[1] == os.sep:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336
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
337 self.refreshButton.setEnabled(False)
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
338
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
339 out, err = self.__hgClient.runcommand(args)
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
340 if err:
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
341 self.__showError(err)
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
342 if out:
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
343 for line in out.splitlines():
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
344 self.__processOutputLine(line)
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
345 if self.__hgClient.wasCanceled():
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
346 break
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
347 self.__finish()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 def __finish(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
351 Private slot called when the process finished or the user pressed
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
352 the button.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 """
221
38689444e922 Corrected the button handling of some Mercurial dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 216
diff changeset
354 self.refreshButton.setEnabled(True)
38689444e922 Corrected the button handling of some Mercurial dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 216
diff changeset
355
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
359 self.buttonBox.button(QDialogButtonBox.Close).setFocus(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
360 Qt.OtherFocusReason)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
362 self.__statusFilters.sort()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
363 self.__statusFilters.insert(0, "<{0}>".format(self.tr("all")))
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
364 self.statusFilterCombo.addItems(self.__statusFilters)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
365
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
366 if not self.__mq:
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
367 self.actionsButton.setEnabled(True)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 self.__resort()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 self.__resizeColumns()
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
371
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
372 self.__refreshDiff()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 def on_buttonBox_clicked(self, button):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 Private slot called by a button of the button box clicked.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 @param button button that was clicked (QAbstractButton)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 if button == self.buttonBox.button(QDialogButtonBox.Close):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 self.close()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
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
383 self.__hgClient.cancel()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 elif button == self.refreshButton:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 self.on_refreshButton_clicked()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
387 def __processOutputLine(self, line):
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
388 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
389 Private method to process the lines of output.
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
390
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
391 @param line output line to be processed (string)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
392 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
393 if line[0] in "ACIMR?!" and line[1] == " ":
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
394 status, path = line.strip().split(" ", 1)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
395 self.__generateItem(status, path)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
397 def __showError(self, out):
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
398 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
399 Private slot to show some error.
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
400
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
401 @param out error to be shown (string)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
402 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
403 self.errorGroup.show()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
404 self.errors.insertPlainText(out)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
405 self.errors.ensureCursorVisible()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 @pyqtSlot()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 def on_refreshButton_clicked(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 Private slot to refresh the status display.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 """
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
412 selectedItems = self.statusList.selectedItems()
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
413 if len(selectedItems) == 1:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
414 self.__selectedName = selectedItems[0].text(self.__pathColumn)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
415 else:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
416 self.__selectedName = ""
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
417
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 self.start(self.args)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
420 @pyqtSlot(str)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
421 def on_statusFilterCombo_activated(self, txt):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
422 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
423 Private slot to react to the selection of a status filter.
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
424
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
425 @param txt selected status filter (string)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
426 """
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
427 if txt == "<{0}>".format(self.tr("all")):
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
428 for topIndex in range(self.statusList.topLevelItemCount()):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
429 topItem = self.statusList.topLevelItem(topIndex)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
430 topItem.setHidden(False)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
431 else:
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
432 for topIndex in range(self.statusList.topLevelItemCount()):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
433 topItem = self.statusList.topLevelItem(topIndex)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
434 topItem.setHidden(topItem.text(self.__statusColumn) != txt)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
435
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
436 @pyqtSlot()
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
437 def on_statusList_itemSelectionChanged(self):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
438 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
439 Private slot to act upon changes of selected items.
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
440 """
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
441 self.__generateDiffs()
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
442
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
443 ###########################################################################
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
444 ## Menu handling methods
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
445 ###########################################################################
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
447 def __showActionsMenu(self):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 """
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
449 Private slot to prepare the actions button menu before it is shown.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 """
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
451 if self.vcs.canCommitMerge(self.dname):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
452 self.__commitMergeAct.setEnabled(True)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
453 self.__abortMergeAct.setEnabled(True)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
454
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
455 self.__addAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
456 self.__diffAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
457 self.__sbsDiffAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
458 self.__revertAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
459 self.__forgetAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
460 self.__restoreAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
461 self.__commitAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
462 self.__commitSelectAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
463 self.__commitDeselectAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
464
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
465 self.__lfAddLargeAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
466 self.__lfAddNormalAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
467
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
468 else:
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
469 self.__commitMergeAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
470 self.__abortMergeAct.setEnabled(False)
3406
b3612f0fbf55 Changed the context menu of the Mercurial status dialog to only enable items available in the current situation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3342
diff changeset
471
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
472 modified = len(self.__getModifiedItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
473 unversioned = len(self.__getUnversionedItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
474 missing = len(self.__getMissingItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
475 commitable = len(self.__getCommitableItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
476 commitableUnselected = len(self.__getCommitableUnselectedItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
477
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
478 self.__addAct.setEnabled(unversioned)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
479 self.__diffAct.setEnabled(modified)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
480 self.__sbsDiffAct.setEnabled(modified == 1)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
481 self.__revertAct.setEnabled(modified)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
482 self.__forgetAct.setEnabled(missing)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
483 self.__restoreAct.setEnabled(missing)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
484 self.__commitAct.setEnabled(commitable)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
485 self.__commitSelectAct.setEnabled(commitableUnselected)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
486 self.__commitDeselectAct.setEnabled(commitable)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
487
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
488 if self.vcs.isExtensionActive("largefiles"):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
489 enable = bool(unversioned)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
490 else:
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
491 enable = False
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
492 self.__lfAddLargeAct.setEnabled(enable)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
493 self.__lfAddNormalAct.setEnabled(enable)
3342
f8cd11fa94ed Fixed an issue in the Mercurial status dialog causing the Add button menu to have largefiles entries enabled even when the extension is not active.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3326
diff changeset
494
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 def __commit(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 Private slot to handle the Commit context menu entry.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 """
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
499 if self.__mq:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
500 self.vcs.vcsCommit(self.dname, "", mq=True)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
501 else:
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
502 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
503 for itm in self.__getCommitableItems()]
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
504 if not names:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
505 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
506 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
507 self.tr("Commit"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
508 self.tr("""There are no entries selected to be"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
509 """ committed."""))
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
510 return
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
511
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
512 if Preferences.getVCS("AutoSaveFiles"):
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
513 vm = e5App().getObject("ViewManager")
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
514 for name in names:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
515 vm.saveEditor(name)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
516 self.vcs.vcsCommit(names, '')
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 def __committed(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 Private slot called after the commit has finished.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 if self.isVisible():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 self.on_refreshButton_clicked()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 self.vcs.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
526 def __commitSelectAll(self):
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
527 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
528 Private slot to select all entries for commit.
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
529 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
530 self.__commitSelect(True)
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
531
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
532 def __commitDeselectAll(self):
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
533 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
534 Private slot to deselect all entries from commit.
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
535 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
536 self.__commitSelect(False)
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
537
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 def __add(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 Private slot to handle the Add context menu entry.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 """
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
542 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 for itm in self.__getUnversionedItems()]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 if not names:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
545 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
546 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
547 self.tr("Add"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
548 self.tr("""There are no unversioned entries"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
549 """ available/selected."""))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 self.vcs.vcsAdd(names)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 self.on_refreshButton_clicked()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 project = e5App().getObject("Project")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 for name in names:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 project.getModel().updateVCSStatus(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 self.vcs.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
560 def __lfAdd(self, mode):
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
561 """
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
562 Private slot to add a file to the repository.
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
563
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
564 @param mode add mode (string one of 'normal' or 'large')
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
565 """
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
566 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
567 for itm in self.__getUnversionedItems()]
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
568 if not names:
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
569 E5MessageBox.information(
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
570 self,
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
571 self.tr("Add"),
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
572 self.tr("""There are no unversioned entries"""
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
573 """ available/selected."""))
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
574 return
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
575
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
576 self.vcs.getExtensionObject("largefiles").hgAdd(
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
577 names, mode)
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
578 self.on_refreshButton_clicked()
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
579
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
580 project = e5App().getObject("Project")
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
581 for name in names:
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
582 project.getModel().updateVCSStatus(name)
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
583 self.vcs.checkVCSStatus()
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
584
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
585 def __forget(self):
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
586 """
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
587 Private slot to handle the Remove context menu entry.
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
588 """
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
589 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
590 for itm in self.__getMissingItems()]
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
591 if not names:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
592 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
593 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
594 self.tr("Remove"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
595 self.tr("""There are no missing entries"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
596 """ available/selected."""))
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
597 return
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
598
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
599 self.vcs.hgForget(names)
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
600 self.on_refreshButton_clicked()
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
601
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 def __revert(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 Private slot to handle the Revert context menu entry.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 """
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
606 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 for itm in self.__getModifiedItems()]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 if not names:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
609 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
610 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
611 self.tr("Revert"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
612 self.tr("""There are no uncommitted changes"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
613 """ available/selected."""))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615
1311
95685f9ad9f8 Added support for importing patches to the Mercurial interface and made it's revert action check, if the project should be reread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1294
diff changeset
616 self.vcs.hgRevert(names)
2616
954b4069325b Fixed a little issue in the various VCS status dialogs __revert function causing the status dialog to get hidden behind the main window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2405
diff changeset
617 self.raise_()
954b4069325b Fixed a little issue in the various VCS status dialogs __revert function causing the status dialog to get hidden behind the main window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2405
diff changeset
618 self.activateWindow()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 self.on_refreshButton_clicked()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 project = e5App().getObject("Project")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 for name in names:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 project.getModel().updateVCSStatus(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 self.vcs.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
626 def __restoreMissing(self):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
627 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
628 Private slot to handle the Restore Missing context menu entry.
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
629 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
630 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
631 for itm in self.__getMissingItems()]
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
632 if not names:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
633 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
634 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
635 self.tr("Revert"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
636 self.tr("""There are no missing entries"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
637 """ available/selected."""))
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
638 return
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
639
1311
95685f9ad9f8 Added support for importing patches to the Mercurial interface and made it's revert action check, if the project should be reread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1294
diff changeset
640 self.vcs.hgRevert(names)
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
641 self.on_refreshButton_clicked()
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
642 self.vcs.checkVCSStatus()
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
643
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
644 def __diff(self):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
645 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
646 Private slot to handle the Diff context menu entry.
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
647 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
648 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
649 for itm in self.__getModifiedItems()]
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
650 if not names:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
651 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
652 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
653 self.tr("Differences"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
654 self.tr("""There are no uncommitted changes"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
655 """ available/selected."""))
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
656 return
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
657
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
658 if self.diff is None:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
659 from .HgDiffDialog import HgDiffDialog
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
660 self.diff = HgDiffDialog(self.vcs)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
661 self.diff.show()
4072
46fb585f60f2 Extended the diff dialogs of the various VCS interfaces to allow a refresh in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
662 self.diff.start(names, refreshable=True)
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
663
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
664 def __sbsDiff(self):
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
665 """
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
666 Private slot to handle the Diff context menu entry.
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
667 """
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
668 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
669 for itm in self.__getModifiedItems()]
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
670 if not names:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
671 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
672 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
673 self.tr("Side-by-Side Diff"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
674 self.tr("""There are no uncommitted changes"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
675 """ available/selected."""))
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
676 return
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
677 elif len(names) > 1:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
678 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
679 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
680 self.tr("Side-by-Side Diff"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
681 self.tr("""Only one file with uncommitted changes"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
682 """ must be selected."""))
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
683 return
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
684
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
685 self.vcs.hgSbsDiff(names[0])
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
686
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
687 def __getCommitableItems(self):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
688 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
689 Private method to retrieve all entries the user wants to commit.
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
690
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
691 @return list of all items, the user has checked
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
692 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
693 commitableItems = []
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
694 for index in range(self.statusList.topLevelItemCount()):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
695 itm = self.statusList.topLevelItem(index)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
696 if itm.checkState(self.__toBeCommittedColumn) == Qt.Checked:
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
697 commitableItems.append(itm)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
698 return commitableItems
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
699
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
700 def __getCommitableUnselectedItems(self):
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
701 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
702 Private method to retrieve all entries the user may commit but hasn't
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
703 selected.
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
704
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
705 @return list of all items, the user has checked
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
706 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
707 items = []
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
708 for index in range(self.statusList.topLevelItemCount()):
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
709 itm = self.statusList.topLevelItem(index)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
710 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
711 itm.flags() & Qt.ItemIsUserCheckable and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
712 itm.checkState(self.__toBeCommittedColumn) == Qt.Unchecked
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
713 ):
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
714 items.append(itm)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
715 return items
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
716
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717 def __getModifiedItems(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 Private method to retrieve all entries, that have a modified status.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 @return list of all items with a modified status
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723 modifiedItems = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 for itm in self.statusList.selectedItems():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 if itm.text(self.__statusColumn) in self.modifiedIndicators:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726 modifiedItems.append(itm)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 return modifiedItems
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729 def __getUnversionedItems(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
731 Private method to retrieve all entries, that have an unversioned
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
732 status.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 @return list of all items with an unversioned status
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 unversionedItems = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 for itm in self.statusList.selectedItems():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 if itm.text(self.__statusColumn) in self.unversionedIndicators:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 unversionedItems.append(itm)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 return unversionedItems
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
741
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
742 def __getMissingItems(self):
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
743 """
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
744 Private method to retrieve all entries, that have a missing status.
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
745
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
746 @return list of all items with a missing status
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
747 """
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
748 missingItems = []
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
749 for itm in self.statusList.selectedItems():
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
750 if itm.text(self.__statusColumn) in self.missingIndicators:
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
751 missingItems.append(itm)
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
752 return missingItems
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
753
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
754 def __commitSelect(self, selected):
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
755 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
756 Private slot to select or deselect all entries.
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
757
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
758 @param selected commit selection state to be set (boolean)
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
759 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
760 for index in range(self.statusList.topLevelItemCount()):
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
761 itm = self.statusList.topLevelItem(index)
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
762 if itm.flags() & Qt.ItemIsUserCheckable:
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
763 if selected:
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
764 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked)
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
765 else:
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
766 itm.setCheckState(self.__toBeCommittedColumn, Qt.Unchecked)
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
767
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
768 def __commitMerge(self):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
769 """
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
770 Private slot to handle the Commit Merge context menu entry.
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
771 """
7188
f9c57c6fa7c4 HgStatusDialog: backed out the disabling of the status list for merges because it prevents to review the individual changes and to inspect the list for long lists of changed files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7183
diff changeset
772 self.vcs.vcsCommit(self.dname, self.tr('Merge'), merge=True)
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
773 self.__committed()
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
774
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
775 def __abortMerge(self):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
776 """
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
777 Private slot used to abort an uncommitted merge.
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
778 """
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
779 self.vcs.hgAbortMerge(self.dname)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
780 self.__committed()
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
781
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
782 ###########################################################################
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
783 ## Diff handling methods below
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
784 ###########################################################################
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
785
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
786 def __generateDiffs(self):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
787 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
788 Private slot to generate diff outputs for the selected item.
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
789 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
790 self.diffEdit.clear()
5765
39d8b26ff557 Made the colors of the diff dialogs configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
791 self.diffHighlighter.regenerateRules()
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
792
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
793 if not self.__mq:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
794 selectedItems = self.statusList.selectedItems()
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
795 if len(selectedItems) == 1:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
796 fn = os.path.join(self.dname,
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
797 selectedItems[0].text(self.__pathColumn))
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
798 self.__diffGenerator.start(fn)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
799
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
800 def __generatorFinished(self):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
801 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
802 Private slot connected to the finished signal of the diff generator.
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
803 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
804 diff = self.__diffGenerator.getResult()[0]
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
805
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
806 if diff:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
807 for line in diff[:]:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
808 if line.startswith("@@ "):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
809 break
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
810 else:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
811 diff.pop(0)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
812 self.diffEdit.setPlainText("".join(diff))
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
813
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
814 tc = self.diffEdit.textCursor()
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
815 tc.movePosition(QTextCursor.Start)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
816 self.diffEdit.setTextCursor(tc)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
817 self.diffEdit.ensureCursorVisible()
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
818
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
819 def __refreshDiff(self):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
820 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
821 Private method to refresh the diff output after a refresh.
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
822 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
823 if self.__selectedName and not self.__mq:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
824 for index in range(self.statusList.topLevelItemCount()):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
825 itm = self.statusList.topLevelItem(index)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
826 if itm.text(self.__pathColumn) == self.__selectedName:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
827 itm.setSelected(True)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
828 break
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
829
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
830 self.__selectedName = ""

eric ide

mercurial