eric6/Plugins/VcsPlugins/vcsMercurial/StripExtension/HgStripDialog.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 7780
41420f82c0ac
child 8043
0acf98cd089a
permissions
-rw-r--r--

Updated copyright for 2021.

5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2016 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter the data to strip changesets.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt5.QtCore import pyqtSlot
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .Ui_HgStripDialog import Ui_HgStripDialog
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 class HgStripDialog(QDialog, Ui_HgStripDialog):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 """
6047
39586a2de99d Fixed some forgotten source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
18 Class implementing a dialog to enter the data to strip changesets.
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
20 def __init__(self, tagsList, branchesList, bookmarksList=None, rev="",
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 parent=None):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Constructor
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
25 @param tagsList list of tags
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
26 @type list of str
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
27 @param branchesList list of branches
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
28 @type list of str
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
29 @param bookmarksList list of bookmarks
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
30 @type list of str
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
31 @keyparam rev revision to strip from
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
32 @type str
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
33 @param parent reference to the parent widget
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
34 @type QWidget
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 super(HgStripDialog, self).__init__(parent)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.setupUi(self)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.tagCombo.addItems(sorted(tagsList))
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.branchCombo.addItems(["default"] + sorted(branchesList))
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 if bookmarksList is not None:
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.bookmarkCombo.addItems([""] + sorted(bookmarksList))
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
43 self.idEdit.setText(rev)
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 msh = self.minimumSizeHint()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.resize(max(self.width(), msh.width()), msh.height())
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.__updateOK()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.idEdit.setFocus()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 def __updateOK(self):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 Private slot to update the OK button.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 enabled = True
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 if self.numberButton.isChecked():
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 enabled = enabled and self.numberSpinBox.value() >= 0
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 elif self.idButton.isChecked():
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 enabled = enabled and self.idEdit.text() != ""
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 elif self.tagButton.isChecked():
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 enabled = enabled and self.tagCombo.currentText() != ""
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 elif self.branchButton.isChecked():
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 enabled = enabled and self.branchCombo.currentText() != ""
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 @pyqtSlot(bool)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 def on_numberButton_toggled(self, checked):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 Private slot to handle changes of the Number select button.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
73 @param checked state of the button
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
74 @type bool
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.__updateOK()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 @pyqtSlot(bool)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 def on_idButton_toggled(self, checked):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 Private slot to handle changes of the ID select button.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
83 @param checked state of the button
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
84 @type bool
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.__updateOK()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 @pyqtSlot(bool)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 def on_tagButton_toggled(self, checked):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 Private slot to handle changes of the Tag select button.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
93 @param checked state of the button
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
94 @type bool
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.__updateOK()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 @pyqtSlot(bool)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 def on_branchButton_toggled(self, checked):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 Private slot to handle changes of the Branch select button.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
103 @param checked state of the button
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
104 @type bool
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.__updateOK()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 @pyqtSlot(int)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 def on_numberSpinBox_valueChanged(self, val):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 Private slot to handle changes of the Number spin box.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 @param val value of the spin box
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 @type int
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 self.__updateOK()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 @pyqtSlot(str)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 def on_idEdit_textChanged(self, txt):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 Private slot to handle changes of the ID edit.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
123 @param txt text of the edit
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
124 @type str
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 self.__updateOK()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 @pyqtSlot(str)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 def on_tagCombo_editTextChanged(self, txt):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 Private slot to handle changes of the Tag combo.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
133 @param txt text of the combo
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
134 @type str
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 self.__updateOK()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 @pyqtSlot(str)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 def on_branchCombo_editTextChanged(self, txt):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 Private slot to handle changes of the Branch combo.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
143 @param txt text of the combo
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
144 @type str
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 self.__updateOK()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 def __getRevision(self):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 Private method to generate the revision.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151
5270
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
152 @return revision
7758f0c7d9f6 Added support for the strip and fetch extensions to the log browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
153 @rtype str
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 if self.numberButton.isChecked():
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 return "rev({0})".format(self.numberSpinBox.value())
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 elif self.idButton.isChecked():
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 return "id({0})".format(self.idEdit.text())
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 elif self.tagButton.isChecked():
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 return self.tagCombo.currentText()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 elif self.branchButton.isChecked():
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 return self.branchCombo.currentText()
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 else:
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 # should not happen
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 return ""
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 def getData(self):
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 Public method to retrieve the data for the strip action.
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 @return tuple with the revision, a bookmark name, a flag indicating
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 to enforce the strip action, a flag indicating to omit the creation
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 of backup bundles and a flag indicating to not modify the working
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 directory
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 @rtype tuple (str, str, bool, bool, bool)
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 """
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 return (
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 self.__getRevision(),
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 self.bookmarkCombo.currentText(),
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 self.forceCheckBox.isChecked(),
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 self.noBackupCheckBox.isChecked(),
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 self.keepCheckBox.isChecked(),
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 )

eric ide

mercurial