Wed, 13 Apr 2022 19:49:25 +0200
Mercurial Interface
- added capability to enter a revset expression when defining a revision to operate on
--- a/docs/changelog Wed Apr 13 18:16:23 2022 +0200 +++ b/docs/changelog Wed Apr 13 19:49:25 2022 +0200 @@ -2,6 +2,9 @@ ---------- Version 22.5: - bug fixes +- Mercurial Interface + -- added capability to enter a revset expression when defining a revision + to operate on - pip Interface -- added the capability to save the licenses overview as a CSV file
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignDialog.py Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignDialog.py Wed Apr 13 19:49:25 2022 +0200 @@ -24,10 +24,14 @@ """ Constructor - @param tagsList list of tags (list of strings) - @param branchesList list of branches (list of strings) - @param bookmarksList list of bookmarks (list of strings) - @param parent reference to the parent widget (QWidget) + @param tagsList list of tags + @type list of str + @param branchesList list of branches + @type list of str + @param bookmarksList list of bookmarks + @type list of str + @param parent parent widget + @type QWidget """ super().__init__(parent) self.setupUi(self) @@ -48,7 +52,22 @@ else: self.bookmarkButton.setHidden(True) self.bookmarkCombo.setHidden(True) + + # connect various radio buttons and input fields + self.idButton.toggled.connect(self.__updateOK) + self.tagButton.toggled.connect(self.__updateOK) + self.branchButton.toggled.connect(self.__updateOK) + self.bookmarkButton.toggled.connect(self.__updateOK) + self.expressionButton.toggled.connect(self.__updateOK) + + self.idEdit.textChanged.connect(self.__updateOK) + self.expressionEdit.textChanged.connect(self.__updateOK) + + self.tagCombo.editTextChanged.connect(self.__updateOK) + self.branchCombo.editTextChanged.connect(self.__updateOK) + self.bookmarkCombo.editTextChanged.connect(self.__updateOK) + @pyqtSlot() def __updateOK(self): """ Private slot to update the OK button. @@ -62,82 +81,12 @@ enabled = enabled and self.branchCombo.currentText() != "" elif self.bookmarkButton.isChecked(): enabled = enabled and self.bookmarkCombo.currentText() != "" + elif self.expressionButton.isChecked(): + enabled = enabled and bool(self.expressionEdit.text()) self.buttonBox.button( QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) - @pyqtSlot(bool) - def on_idButton_toggled(self, checked): - """ - Private slot to handle changes of the ID select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tagButton_toggled(self, checked): - """ - Private slot to handle changes of the Tag select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branchButton_toggled(self, checked): - """ - Private slot to handle changes of the Branch select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_bookmarkButton_toggled(self, checked): - """ - Private slot to handle changes of the Bookmark select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_idEdit_textChanged(self, txt): - """ - Private slot to handle changes of the ID edit. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tagCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branchCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_bookmarkCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Bookmark combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - def getData(self): """ Public method to retrieve the entered data. @@ -145,7 +94,8 @@ @return tuple giving the revision, a flag indicating not to commit the signature, a commit message, an ID of the key to be used, a flag indicating a local signature and a flag indicating a forced - signature (string, boolean, string, string, boolean, boolean) + signature + @rtype tuple of (str, bool, str, str, bool, bool) """ if self.numberButton.isChecked(): rev = str(self.numberSpinBox.value()) @@ -157,6 +107,8 @@ rev = self.branchCombo.currentText() elif self.bookmarkButton.isChecked(): rev = self.bookmarkCombo.currentText() + elif self.expressionButton.isChecked(): + rev = self.expressionEdit.text() else: rev = ""
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignDialog.ui Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignDialog.ui Wed Apr 13 19:49:25 2022 +0200 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>400</width> - <height>518</height> + <height>600</height> </rect> </property> <property name="windowTitle"> @@ -169,7 +169,27 @@ </property> </widget> </item> - <item row="5" column="0" colspan="3"> + <item row="5" column="0"> + <widget class="QRadioButton" name="expressionButton"> + <property name="text"> + <string>Expression:</string> + </property> + </widget> + </item> + <item row="5" column="1" colspan="2"> + <widget class="QLineEdit" name="expressionEdit"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Enter a revision set expression</string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="6" column="0" colspan="3"> <widget class="QRadioButton" name="tipButton"> <property name="toolTip"> <string>Select tip revision of repository</string> @@ -282,13 +302,17 @@ <tabstop>branchCombo</tabstop> <tabstop>bookmarkButton</tabstop> <tabstop>bookmarkCombo</tabstop> + <tabstop>expressionButton</tabstop> + <tabstop>expressionEdit</tabstop> <tabstop>tipButton</tabstop> <tabstop>nocommitCheckBox</tabstop> <tabstop>messageEdit</tabstop> <tabstop>keyEdit</tabstop> <tabstop>localCheckBox</tabstop> <tabstop>forceCheckBox</tabstop> - <tabstop>buttonBox</tabstop> + <tabstop>keyEdit_2</tabstop> + <tabstop>localCheckBox_2</tabstop> + <tabstop>forceCheckBox_2</tabstop> </tabstops> <resources/> <connections> @@ -299,8 +323,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>252</x> - <y>271</y> + <x>261</x> + <y>590</y> </hint> <hint type="destinationlabel"> <x>157</x> @@ -315,8 +339,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>316</x> - <y>260</y> + <x>325</x> + <y>590</y> </hint> <hint type="destinationlabel"> <x>286</x> @@ -331,12 +355,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>48</x> - <y>89</y> + <x>69</x> + <y>66</y> </hint> <hint type="destinationlabel"> - <x>118</x> - <y>87</y> + <x>215</x> + <y>68</y> </hint> </hints> </connection> @@ -347,12 +371,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>47</x> - <y>131</y> + <x>68</x> + <y>99</y> </hint> <hint type="destinationlabel"> - <x>105</x> - <y>116</y> + <x>227</x> + <y>100</y> </hint> </hints> </connection> @@ -363,12 +387,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>43</x> - <y>142</y> + <x>64</x> + <y>131</y> </hint> <hint type="destinationlabel"> - <x>102</x> - <y>141</y> + <x>224</x> + <y>132</y> </hint> </hints> </connection> @@ -379,12 +403,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>42</x> - <y>170</y> + <x>63</x> + <y>163</y> </hint> <hint type="destinationlabel"> - <x>115</x> - <y>171</y> + <x>237</x> + <y>164</y> </hint> </hints> </connection> @@ -395,12 +419,28 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>51</x> + <x>72</x> + <y>195</y> + </hint> + <hint type="destinationlabel"> + <x>230</x> <y>196</y> </hint> + </hints> + </connection> + <connection> + <sender>expressionButton</sender> + <signal>toggled(bool)</signal> + <receiver>expressionEdit</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>67</x> + <y>221</y> + </hint> <hint type="destinationlabel"> - <x>108</x> - <y>201</y> + <x>153</x> + <y>217</y> </hint> </hints> </connection>
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py Wed Apr 13 19:49:25 2022 +0200 @@ -54,9 +54,11 @@ dlg = HgRevisionSelectionDialog( self.vcs.hgGetTagsList(), self.vcs.hgGetBranchesList(), - self.vcs.hgGetBookmarksList()) + bookmarksList=self.vcs.hgGetBookmarksList(), + revset=False + ) if dlg.exec() == QDialog.DialogCode.Accepted: - rev = dlg.getRevision(revset=False) + rev = dlg.getRevision() if rev is not None: if rev == "":
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgBackoutDialog.py Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgBackoutDialog.py Wed Apr 13 19:49:25 2022 +0200 @@ -24,10 +24,14 @@ """ Constructor - @param tagsList list of tags (list of strings) - @param branchesList list of branches (list of strings) - @param bookmarksList list of bookmarks (list of strings) - @param parent parent widget (QWidget) + @param tagsList list of tags + @type list of str + @param branchesList list of branches + @type list of str + @param bookmarksList list of bookmarks + @type list of str + @param parent parent widget + @type QWidget """ super().__init__(parent) self.setupUi(self) @@ -49,9 +53,25 @@ self.bookmarkButton.setHidden(True) self.bookmarkCombo.setHidden(True) + # connect various radio buttons and input fields + self.idButton.toggled.connect(self.__updateOK) + self.tagButton.toggled.connect(self.__updateOK) + self.branchButton.toggled.connect(self.__updateOK) + self.bookmarkButton.toggled.connect(self.__updateOK) + self.expressionButton.toggled.connect(self.__updateOK) + self.noneButton.toggled.connect(self.__updateOK) + + self.idEdit.textChanged.connect(self.__updateOK) + self.expressionEdit.textChanged.connect(self.__updateOK) + + self.tagCombo.editTextChanged.connect(self.__updateOK) + self.branchCombo.editTextChanged.connect(self.__updateOK) + self.bookmarkCombo.editTextChanged.connect(self.__updateOK) + self.__initDateTime = QDateTime.currentDateTime() self.dateEdit.setDateTime(self.__initDateTime) + @pyqtSlot() def __updateOK(self): """ Private slot to update the OK button. @@ -60,105 +80,26 @@ if self.noneButton.isChecked(): enabled = False elif self.idButton.isChecked(): - enabled = self.idEdit.text() != "" + enabled = bool(self.idEdit.text()) elif self.tagButton.isChecked(): - enabled = self.tagCombo.currentText() != "" + enabled = bool(self.tagCombo.currentText()) elif self.branchButton.isChecked(): - enabled = self.branchCombo.currentText() != "" + enabled = bool(self.branchCombo.currentText()) elif self.bookmarkButton.isChecked(): - enabled = self.bookmarkCombo.currentText() != "" + enabled = bool(self.bookmarkCombo.currentText()) + elif self.expressionButton.isChecked(): + enabled = enabled and bool(self.expressionEdit.text()) self.buttonBox.button( QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) - @pyqtSlot(bool) - def on_idButton_toggled(self, checked): - """ - Private slot to handle changes of the ID select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tagButton_toggled(self, checked): - """ - Private slot to handle changes of the Tag select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branchButton_toggled(self, checked): - """ - Private slot to handle changes of the Branch select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_bookmarkButton_toggled(self, checked): - """ - Private slot to handle changes of the Bookmark select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_noneButton_toggled(self, checked): - """ - Private slot to handle the toggling of the None revision button. - - @param checked flag indicating the checked state (boolean) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_idEdit_textChanged(self, txt): - """ - Private slot to handle changes of the ID edit. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tagCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branchCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_bookmarkCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Bookmark combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - def getParameters(self): """ Public method to retrieve the backout data. @return tuple naming the revision, a flag indicating a merge, the commit date, the commit user and a commit message - (string, boolean, string, string, string) + @rtype tuple of (str, bool, str, str, str) """ if self.numberButton.isChecked(): rev = "rev({0})".format(self.numberSpinBox.value()) @@ -170,6 +111,8 @@ rev = self.branchCombo.currentText() elif self.bookmarkButton.isChecked(): rev = self.bookmarkCombo.currentText() + elif self.expressionButton.isChecked(): + rev = self.expressionEdit.text() else: rev = ""
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgBackoutDialog.ui Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgBackoutDialog.ui Wed Apr 13 19:49:25 2022 +0200 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>372</width> - <height>515</height> + <width>400</width> + <height>600</height> </rect> </property> <property name="windowTitle"> @@ -169,7 +169,27 @@ </property> </widget> </item> - <item row="5" column="0" colspan="2"> + <item row="5" column="0"> + <widget class="QRadioButton" name="expressionButton"> + <property name="text"> + <string>Expression:</string> + </property> + </widget> + </item> + <item row="5" column="1" colspan="2"> + <widget class="QLineEdit" name="expressionEdit"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Enter a revision set expression</string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="6" column="0" colspan="3"> <widget class="QRadioButton" name="noneButton"> <property name="toolTip"> <string>Select to not specify a specific revision</string> @@ -289,12 +309,13 @@ <tabstop>branchCombo</tabstop> <tabstop>bookmarkButton</tabstop> <tabstop>bookmarkCombo</tabstop> + <tabstop>expressionButton</tabstop> + <tabstop>expressionEdit</tabstop> <tabstop>noneButton</tabstop> <tabstop>messageEdit</tabstop> <tabstop>dateEdit</tabstop> <tabstop>userEdit</tabstop> <tabstop>mergeCheckBox</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections> @@ -305,8 +326,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>261</x> - <y>450</y> + <x>270</x> + <y>590</y> </hint> <hint type="destinationlabel"> <x>157</x> @@ -321,8 +342,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>329</x> - <y>450</y> + <x>338</x> + <y>590</y> </hint> <hint type="destinationlabel"> <x>286</x> @@ -337,12 +358,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>48</x> - <y>42</y> + <x>69</x> + <y>66</y> </hint> <hint type="destinationlabel"> - <x>113</x> - <y>43</y> + <x>215</x> + <y>68</y> </hint> </hints> </connection> @@ -369,12 +390,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>52</x> - <y>104</y> + <x>73</x> + <y>131</y> </hint> <hint type="destinationlabel"> - <x>124</x> - <y>99</y> + <x>246</x> + <y>132</y> </hint> </hints> </connection> @@ -385,12 +406,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>71</x> - <y>127</y> + <x>92</x> + <y>163</y> </hint> <hint type="destinationlabel"> - <x>123</x> - <y>130</y> + <x>245</x> + <y>164</y> </hint> </hints> </connection> @@ -401,12 +422,28 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>57</x> - <y>147</y> + <x>78</x> + <y>195</y> </hint> <hint type="destinationlabel"> - <x>116</x> - <y>147</y> + <x>238</x> + <y>196</y> + </hint> + </hints> + </connection> + <connection> + <sender>expressionButton</sender> + <signal>toggled(bool)</signal> + <receiver>expressionEdit</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>67</x> + <y>219</y> + </hint> + <hint type="destinationlabel"> + <x>198</x> + <y>213</y> </hint> </hints> </connection>
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgBookmarkDialog.py Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgBookmarkDialog.py Wed Apr 13 19:49:25 2022 +0200 @@ -25,11 +25,16 @@ """ Constructor - @param mode of the dialog (integer) - @param tagsList list of tags (list of strings) - @param branchesList list of branches (list of strings) - @param bookmarksList list of bookmarks (list of strings) - @param parent reference to the parent widget (QWidget) + @param mode of the dialog + @type int + @param tagsList list of tags + @type list of str + @param branchesList list of branches + @type list of str + @param bookmarksList list of bookmarks + @type list of str + @param parent parent widget + @type QWidget """ super().__init__(parent) self.setupUi(self) @@ -52,26 +57,48 @@ self.branchCombo.addItems(["default"] + sorted(branchesList)) self.bookmarkCombo.addItems(sorted(bookmarksList)) + # connect various radio buttons and input fields + self.idButton.toggled.connect(self.__updateOK) + self.tagButton.toggled.connect(self.__updateOK) + self.branchButton.toggled.connect(self.__updateOK) + self.bookmarkButton.toggled.connect(self.__updateOK) + self.expressionButton.toggled.connect(self.__updateOK) + + self.nameCombo.activated.connect(self.__updateOK) + self.nameCombo.activated.connect(self.__updateBookmarksCombo) + + self.nameEdit.textChanged.connect(self.__updateOK) + self.idEdit.textChanged.connect(self.__updateOK) + self.expressionEdit.textChanged.connect(self.__updateOK) + + self.tagCombo.editTextChanged.connect(self.__updateOK) + self.branchCombo.editTextChanged.connect(self.__updateOK) + self.bookmarkCombo.editTextChanged.connect(self.__updateOK) + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) + @pyqtSlot() def __updateOK(self): """ Private slot to update the OK button. """ enabled = ( - self.nameCombo.currentText() != "" + bool(self.nameCombo.currentText()) if self.__mode == self.MOVE_MODE else - self.nameEdit.text() != "" + bool(self.nameEdit.text()) ) + if self.idButton.isChecked(): - enabled = enabled and self.idEdit.text() != "" + enabled = bool(self.idEdit.text()) elif self.tagButton.isChecked(): - enabled = enabled and self.tagCombo.currentText() != "" + enabled = bool(self.tagCombo.currentText()) elif self.branchButton.isChecked(): - enabled = enabled and self.branchCombo.currentText() != "" + enabled = bool(self.branchCombo.currentText()) elif self.bookmarkButton.isChecked(): - enabled = enabled and self.bookmarkCombo.currentText() != "" + enabled = bool(self.bookmarkCombo.currentText()) + elif self.expressionButton.isChecked(): + enabled = enabled and bool(self.expressionEdit.text()) self.buttonBox.button( QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @@ -94,104 +121,12 @@ if index > -1: self.bookmarkCombo.setCurrentIndex(index) - @pyqtSlot(int) - def on_nameCombo_activated(self, index): - """ - Private slot to handle changes of the selected bookmark name. - - @param index index of the selected entry - @type int - """ - self.__updateOK() - self.__updateBookmarksCombo() - - @pyqtSlot(str) - def on_nameEdit_textChanged(self, txt): - """ - Private slot to handle changes of the bookmark name. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_idButton_toggled(self, checked): - """ - Private slot to handle changes of the ID select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tagButton_toggled(self, checked): - """ - Private slot to handle changes of the Tag select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branchButton_toggled(self, checked): - """ - Private slot to handle changes of the Branch select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_bookmarkButton_toggled(self, checked): - """ - Private slot to handle changes of the Bookmark select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_idEdit_textChanged(self, txt): - """ - Private slot to handle changes of the ID edit. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tagCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branchCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_bookmarkCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Bookmark combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - def getData(self): """ Public method to retrieve the entered data. @return tuple naming the revision and the bookmark name - (string, string) + @rtype tuple of (str, str) """ if self.numberButton.isChecked(): rev = "rev({0})".format(self.numberSpinBox.value()) @@ -203,6 +138,8 @@ rev = self.branchCombo.currentText() elif self.bookmarkButton.isChecked(): rev = self.bookmarkCombo.currentText() + elif self.expressionButton.isChecked(): + rev = self.expressionEdit.text() else: rev = ""
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgBookmarkDialog.ui Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgBookmarkDialog.ui Wed Apr 13 19:49:25 2022 +0200 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>400</width> - <height>255</height> + <height>346</height> </rect> </property> <property name="windowTitle"> @@ -200,7 +200,27 @@ </property> </widget> </item> - <item row="5" column="0" colspan="3"> + <item row="5" column="0"> + <widget class="QRadioButton" name="expressionButton"> + <property name="text"> + <string>Expression:</string> + </property> + </widget> + </item> + <item row="5" column="1" colspan="2"> + <widget class="QLineEdit" name="expressionEdit"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Enter a revision set expression</string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="6" column="0" colspan="3"> <widget class="QRadioButton" name="tipButton"> <property name="toolTip"> <string>Select tip revision of repository</string> @@ -241,8 +261,9 @@ <tabstop>branchCombo</tabstop> <tabstop>bookmarkButton</tabstop> <tabstop>bookmarkCombo</tabstop> + <tabstop>expressionButton</tabstop> + <tabstop>expressionEdit</tabstop> <tabstop>tipButton</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections> @@ -253,8 +274,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>248</x> - <y>274</y> + <x>257</x> + <y>336</y> </hint> <hint type="destinationlabel"> <x>157</x> @@ -269,8 +290,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>316</x> - <y>260</y> + <x>325</x> + <y>336</y> </hint> <hint type="destinationlabel"> <x>286</x> @@ -289,8 +310,8 @@ <y>89</y> </hint> <hint type="destinationlabel"> - <x>118</x> - <y>87</y> + <x>215</x> + <y>102</y> </hint> </hints> </connection> @@ -301,12 +322,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>36</x> - <y>109</y> + <x>57</x> + <y>133</y> </hint> <hint type="destinationlabel"> - <x>105</x> - <y>116</y> + <x>227</x> + <y>134</y> </hint> </hints> </connection> @@ -321,8 +342,8 @@ <y>142</y> </hint> <hint type="destinationlabel"> - <x>102</x> - <y>141</y> + <x>224</x> + <y>166</y> </hint> </hints> </connection> @@ -333,12 +354,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>42</x> - <y>170</y> + <x>63</x> + <y>197</y> </hint> <hint type="destinationlabel"> - <x>115</x> - <y>171</y> + <x>237</x> + <y>198</y> </hint> </hints> </connection> @@ -349,12 +370,28 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>51</x> - <y>196</y> + <x>72</x> + <y>229</y> </hint> <hint type="destinationlabel"> - <x>108</x> - <y>201</y> + <x>230</x> + <y>230</y> + </hint> + </hints> + </connection> + <connection> + <sender>expressionButton</sender> + <signal>toggled(bool)</signal> + <receiver>expressionEdit</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>76</x> + <y>248</y> + </hint> + <hint type="destinationlabel"> + <x>154</x> + <y>249</y> </hint> </hints> </connection>
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgMergeDialog.py Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgMergeDialog.py Wed Apr 13 19:49:25 2022 +0200 @@ -22,10 +22,14 @@ """ Constructor - @param tagsList list of tags (list of strings) - @param branchesList list of branches (list of strings) - @param bookmarksList list of bookmarks (list of strings) - @param parent parent widget (QWidget) + @param tagsList list of tags + @type list of str + @param branchesList list of branches + @type list of str + @param bookmarksList list of bookmarks + @type list of str + @param parent parent widget + @type QWidget """ super().__init__(parent) self.setupUi(self) @@ -41,9 +45,24 @@ self.bookmarkButton.setHidden(True) self.bookmarkCombo.setHidden(True) + # connect various radio buttons and input fields + self.idButton.toggled.connect(self.__updateOK) + self.tagButton.toggled.connect(self.__updateOK) + self.branchButton.toggled.connect(self.__updateOK) + self.bookmarkButton.toggled.connect(self.__updateOK) + self.expressionButton.toggled.connect(self.__updateOK) + + self.idEdit.textChanged.connect(self.__updateOK) + self.expressionEdit.textChanged.connect(self.__updateOK) + + self.tagCombo.editTextChanged.connect(self.__updateOK) + self.branchCombo.editTextChanged.connect(self.__updateOK) + self.bookmarkCombo.editTextChanged.connect(self.__updateOK) + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) + @pyqtSlot() def __updateOK(self): """ Private slot to update the OK button. @@ -57,88 +76,19 @@ enabled = self.branchCombo.currentText() != "" elif self.bookmarkButton.isChecked(): enabled = self.bookmarkCombo.currentText() != "" + elif self.expressionButton.isChecked(): + enabled = enabled and bool(self.expressionEdit.text()) self.buttonBox.button( QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) - @pyqtSlot(bool) - def on_idButton_toggled(self, checked): - """ - Private slot to handle changes of the ID select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tagButton_toggled(self, checked): - """ - Private slot to handle changes of the Tag select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branchButton_toggled(self, checked): - """ - Private slot to handle changes of the Branch select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_bookmarkButton_toggled(self, checked): - """ - Private slot to handle changes of the Bookmark select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_idEdit_textChanged(self, txt): - """ - Private slot to handle changes of the ID edit. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tagCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branchCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_bookmarkCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Bookmark combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - def getParameters(self): """ Public method to retrieve the merge data. @return tuple naming the revision and a flag indicating a - forced merge (string, boolean) + forced merge + @rtype tuple of (str, bool) """ if self.numberButton.isChecked(): rev = "rev({0})".format(self.numberSpinBox.value()) @@ -150,6 +100,8 @@ rev = self.branchCombo.currentText() elif self.bookmarkButton.isChecked(): rev = self.bookmarkCombo.currentText() + elif self.expressionButton.isChecked(): + rev = self.expressionEdit.text() else: rev = ""
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgMergeDialog.ui Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgMergeDialog.ui Wed Apr 13 19:49:25 2022 +0200 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>372</width> - <height>305</height> + <width>400</width> + <height>342</height> </rect> </property> <property name="windowTitle"> @@ -157,7 +157,27 @@ </property> </widget> </item> - <item row="5" column="0" colspan="3"> + <item row="5" column="0"> + <widget class="QRadioButton" name="expressionButton"> + <property name="text"> + <string>Expression:</string> + </property> + </widget> + </item> + <item row="5" column="1" colspan="2"> + <widget class="QLineEdit" name="expressionEdit"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Enter a revision set expression</string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="6" column="0" colspan="3"> <widget class="QRadioButton" name="noneButton"> <property name="toolTip"> <string>Select to not specify a specific revision</string> @@ -206,9 +226,10 @@ <tabstop>branchCombo</tabstop> <tabstop>bookmarkButton</tabstop> <tabstop>bookmarkCombo</tabstop> + <tabstop>expressionButton</tabstop> + <tabstop>expressionEdit</tabstop> <tabstop>noneButton</tabstop> <tabstop>forceCheckBox</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections> @@ -219,8 +240,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>261</x> - <y>244</y> + <x>270</x> + <y>332</y> </hint> <hint type="destinationlabel"> <x>157</x> @@ -235,8 +256,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>329</x> - <y>244</y> + <x>338</x> + <y>332</y> </hint> <hint type="destinationlabel"> <x>286</x> @@ -251,12 +272,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>48</x> - <y>42</y> + <x>69</x> + <y>66</y> </hint> <hint type="destinationlabel"> - <x>113</x> - <y>43</y> + <x>215</x> + <y>68</y> </hint> </hints> </connection> @@ -283,12 +304,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>52</x> - <y>104</y> + <x>73</x> + <y>131</y> </hint> <hint type="destinationlabel"> - <x>124</x> - <y>99</y> + <x>246</x> + <y>132</y> </hint> </hints> </connection> @@ -299,12 +320,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>71</x> - <y>127</y> + <x>92</x> + <y>163</y> </hint> <hint type="destinationlabel"> - <x>123</x> - <y>130</y> + <x>245</x> + <y>164</y> </hint> </hints> </connection> @@ -315,12 +336,28 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>71</x> - <y>145</y> + <x>92</x> + <y>195</y> </hint> <hint type="destinationlabel"> - <x>121</x> - <y>149</y> + <x>243</x> + <y>196</y> + </hint> + </hints> + </connection> + <connection> + <sender>expressionButton</sender> + <signal>toggled(bool)</signal> + <receiver>expressionEdit</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>59</x> + <y>216</y> + </hint> + <hint type="destinationlabel"> + <x>195</x> + <y>216</y> </hint> </hints> </connection>
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgRevisionSelectionDialog.py Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgRevisionSelectionDialog.py Wed Apr 13 19:49:25 2022 +0200 @@ -18,15 +18,23 @@ Class implementing a dialog to select a revision. """ def __init__(self, tagsList, branchesList, bookmarksList=None, - noneLabel="", parent=None): + noneLabel="", revset=True, parent=None): """ Constructor - @param tagsList list of tags (list of strings) - @param branchesList list of branches (list of strings) - @param bookmarksList list of bookmarks (list of strings) - @param noneLabel labeltext for "no revision selected" (string) - @param parent parent widget (QWidget) + @param tagsList list of tags + @type list of str + @param branchesList list of branches + @type list of str + @param bookmarksList list of bookmarks + @type list of str + @param noneLabel labeltext for "no revision selected" + @type str + @param revset flag indicating to allow the revision or ID given as a + revset + @type bool + @param parent parent widget + @type QWidget """ super().__init__(parent) self.setupUi(self) @@ -45,115 +53,60 @@ if noneLabel: self.noneButton.setText(noneLabel) + self.__revset = revset + self.expressionButton.setEnabled(revset) + + # connect various radio buttons and input fields + self.idButton.toggled.connect(self.__updateOK) + self.tagButton.toggled.connect(self.__updateOK) + self.branchButton.toggled.connect(self.__updateOK) + self.bookmarkButton.toggled.connect(self.__updateOK) + self.expressionButton.toggled.connect(self.__updateOK) + + self.idEdit.textChanged.connect(self.__updateOK) + self.expressionEdit.textChanged.connect(self.__updateOK) + + self.tagCombo.editTextChanged.connect(self.__updateOK) + self.branchCombo.editTextChanged.connect(self.__updateOK) + self.bookmarkCombo.editTextChanged.connect(self.__updateOK) + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) + @pyqtSlot() def __updateOK(self): """ Private slot to update the OK button. """ enabled = True if self.idButton.isChecked(): - enabled = self.idEdit.text() != "" + enabled = bool(self.idEdit.text()) elif self.tagButton.isChecked(): - enabled = self.tagCombo.currentText() != "" + enabled = bool(self.tagCombo.currentText()) elif self.branchButton.isChecked(): - enabled = self.branchCombo.currentText() != "" + enabled = bool(self.branchCombo.currentText()) elif self.bookmarkButton.isChecked(): - enabled = self.bookmarkCombo.currentText() != "" + enabled = bool(self.bookmarkCombo.currentText()) + elif self.expressionButton.isChecked(): + enabled = enabled and bool(self.expressionEdit.text()) self.buttonBox.button( QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) - @pyqtSlot(bool) - def on_idButton_toggled(self, checked): - """ - Private slot to handle changes of the ID select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tagButton_toggled(self, checked): - """ - Private slot to handle changes of the Tag select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branchButton_toggled(self, checked): - """ - Private slot to handle changes of the Branch select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_bookmarkButton_toggled(self, checked): - """ - Private slot to handle changes of the Bookmark select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_idEdit_textChanged(self, txt): - """ - Private slot to handle changes of the ID edit. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tagCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branchCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_bookmarkCombo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Bookmark combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - def getRevision(self, revset=True): + def getRevision(self): """ Public method to retrieve the selected revision. - @param revset flag indicating to get the revision or ID as a - revset - @type bool @return selected revision @rtype str """ if self.numberButton.isChecked(): - if revset: + if self.__revset: rev = "rev({0})".format(self.numberSpinBox.value()) else: rev = str(self.numberSpinBox.value()) elif self.idButton.isChecked(): - if revset: + if self.__revset: rev = "id({0})".format(self.idEdit.text()) else: rev = self.idEdit.text() @@ -163,6 +116,8 @@ rev = self.branchCombo.currentText() elif self.bookmarkButton.isChecked(): rev = self.bookmarkCombo.currentText() + elif self.expressionButton.isChecked(): + rev = self.expressionEdit.text() elif self.tipButton.isChecked(): rev = "tip" else:
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgRevisionSelectionDialog.ui Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgRevisionSelectionDialog.ui Wed Apr 13 19:49:25 2022 +0200 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>372</width> - <height>250</height> + <width>400</width> + <height>342</height> </rect> </property> <property name="windowTitle"> @@ -80,6 +80,9 @@ <property name="toolTip"> <string>Enter a changeset id</string> </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> </widget> </item> <item row="2" column="0"> @@ -169,7 +172,27 @@ </property> </widget> </item> - <item row="5" column="0" colspan="3"> + <item row="5" column="0"> + <widget class="QRadioButton" name="expressionButton"> + <property name="text"> + <string>Expression:</string> + </property> + </widget> + </item> + <item row="5" column="1" colspan="2"> + <widget class="QLineEdit" name="expressionEdit"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Enter a revision set expression</string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="6" column="0" colspan="3"> <widget class="QRadioButton" name="tipButton"> <property name="toolTip"> <string>Select tip revision of repository</string> @@ -179,7 +202,7 @@ </property> </widget> </item> - <item row="6" column="0" colspan="3"> + <item row="7" column="0" colspan="3"> <widget class="QRadioButton" name="noneButton"> <property name="text"> <string>No revision selected</string> @@ -215,9 +238,10 @@ <tabstop>branchCombo</tabstop> <tabstop>bookmarkButton</tabstop> <tabstop>bookmarkCombo</tabstop> + <tabstop>expressionButton</tabstop> + <tabstop>expressionEdit</tabstop> <tabstop>tipButton</tabstop> <tabstop>noneButton</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections> @@ -228,8 +252,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>257</x> - <y>215</y> + <x>266</x> + <y>332</y> </hint> <hint type="destinationlabel"> <x>157</x> @@ -244,8 +268,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>325</x> - <y>215</y> + <x>334</x> + <y>332</y> </hint> <hint type="destinationlabel"> <x>286</x> @@ -276,12 +300,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>41</x> - <y>69</y> + <x>62</x> + <y>99</y> </hint> <hint type="destinationlabel"> - <x>121</x> - <y>68</y> + <x>243</x> + <y>100</y> </hint> </hints> </connection> @@ -292,12 +316,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>69</x> - <y>94</y> + <x>90</x> + <y>131</y> </hint> <hint type="destinationlabel"> - <x>132</x> - <y>98</y> + <x>254</x> + <y>132</y> </hint> </hints> </connection> @@ -308,12 +332,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>60</x> - <y>120</y> + <x>81</x> + <y>163</y> </hint> <hint type="destinationlabel"> - <x>117</x> - <y>122</y> + <x>239</x> + <y>164</y> </hint> </hints> </connection> @@ -324,12 +348,28 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>25</x> - <y>146</y> + <x>46</x> + <y>195</y> </hint> <hint type="destinationlabel"> - <x>130</x> - <y>149</y> + <x>252</x> + <y>196</y> + </hint> + </hints> + </connection> + <connection> + <sender>expressionButton</sender> + <signal>toggled(bool)</signal> + <receiver>expressionEdit</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>65</x> + <y>215</y> + </hint> + <hint type="destinationlabel"> + <x>181</x> + <y>215</y> </hint> </hints> </connection>
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgRevisionsSelectionDialog.py Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgRevisionsSelectionDialog.py Wed Apr 13 19:49:25 2022 +0200 @@ -22,10 +22,14 @@ """ Constructor - @param tagsList list of tags (list of strings) - @param branchesList list of branches (list of strings) - @param bookmarksList list of bookmarks (list of strings) - @param parent parent widget of the dialog (QWidget) + @param tagsList list of tags + @type list of str + @param branchesList list of branches + @type list of str + @param bookmarksList list of bookmarks + @type list of str + @param parent parent widget of the dialog + @type QWidget """ super().__init__(parent) self.setupUi(self) @@ -46,185 +50,72 @@ self.bookmark2Button.setHidden(True) self.bookmark2Combo.setHidden(True) + # connect various radio buttons and input fields + self.id1Button.toggled.connect(self.__updateOK) + self.id2Button.toggled.connect(self.__updateOK) + self.tag1Button.toggled.connect(self.__updateOK) + self.tag2Button.toggled.connect(self.__updateOK) + self.branch1Button.toggled.connect(self.__updateOK) + self.branch2Button.toggled.connect(self.__updateOK) + self.bookmark1Button.toggled.connect(self.__updateOK) + self.bookmark2Button.toggled.connect(self.__updateOK) + self.expression1Button.toggled.connect(self.__updateOK) + self.expression2Button.toggled.connect(self.__updateOK) + + self.id1Edit.textChanged.connect(self.__updateOK) + self.id2Edit.textChanged.connect(self.__updateOK) + self.expression1Edit.textChanged.connect(self.__updateOK) + self.expression2Edit.textChanged.connect(self.__updateOK) + + self.tag1Combo.editTextChanged.connect(self.__updateOK) + self.tag2Combo.editTextChanged.connect(self.__updateOK) + self.branch1Combo.editTextChanged.connect(self.__updateOK) + self.branch2Combo.editTextChanged.connect(self.__updateOK) + self.bookmark1Combo.editTextChanged.connect(self.__updateOK) + self.bookmark2Combo.editTextChanged.connect(self.__updateOK) + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) + @pyqtSlot() def __updateOK(self): """ Private slot to update the OK button. """ enabled = True if self.id1Button.isChecked(): - enabled = enabled and self.id1Edit.text() != "" + enabled = enabled and bool(self.id1Edit.text()) elif self.tag1Button.isChecked(): - enabled = enabled and self.tag1Combo.currentText() != "" + enabled = enabled and bool(self.tag1Combo.currentText()) elif self.branch1Button.isChecked(): - enabled = enabled and self.branch1Combo.currentText() != "" + enabled = enabled and bool(self.branch1Combo.currentText()) elif self.bookmark1Button.isChecked(): - enabled = enabled and self.bookmark1Combo.currentText() != "" + enabled = enabled and bool(self.bookmark1Combo.currentText()) + elif self.expression1Button.isChecked(): + enabled = enabled and bool(self.expression1Edit.text()) if self.id2Button.isChecked(): - enabled = enabled and self.id2Edit.text() != "" + enabled = enabled and bool(self.id2Edit.text()) elif self.tag2Button.isChecked(): - enabled = enabled and self.tag2Combo.currentText() != "" + enabled = enabled and bool(self.tag2Combo.currentText()) elif self.branch2Button.isChecked(): - enabled = enabled and self.branch2Combo.currentText() != "" + enabled = enabled and bool(self.branch2Combo.currentText()) elif self.bookmark2Button.isChecked(): - enabled = enabled and self.bookmark2Combo.currentText() != "" + enabled = enabled and bool(self.bookmark2Combo.currentText()) + elif self.expression2Button.isChecked(): + enabled = enabled and bool(self.expression2Edit.text()) self.buttonBox.button( QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) - @pyqtSlot(bool) - def on_id1Button_toggled(self, checked): - """ - Private slot to handle changes of the ID1 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_id2Button_toggled(self, checked): - """ - Private slot to handle changes of the ID2 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tag1Button_toggled(self, checked): - """ - Private slot to handle changes of the Tag1 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_tag2Button_toggled(self, checked): - """ - Private slot to handle changes of the Tag2 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branch1Button_toggled(self, checked): - """ - Private slot to handle changes of the Branch1 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_branch2Button_toggled(self, checked): - """ - Private slot to handle changes of the Branch2 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_bookmark1Button_toggled(self, checked): - """ - Private slot to handle changes of the Bookmark1 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(bool) - def on_bookmark2Button_toggled(self, checked): - """ - Private slot to handle changes of the Bookmark2 select button. - - @param checked state of the button (boolean) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_id1Edit_textChanged(self, txt): - """ - Private slot to handle changes of the ID1 edit. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_id2Edit_textChanged(self, txt): - """ - Private slot to handle changes of the ID2 edit. - - @param txt text of the edit (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tag1Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag1 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_tag2Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Tag2 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branch1Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch1 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_branch2Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Branch2 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_bookmark1Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Bookmark1 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - - @pyqtSlot(str) - def on_bookmark2Combo_editTextChanged(self, txt): - """ - Private slot to handle changes of the Bookmark2 combo. - - @param txt text of the combo (string) - """ - self.__updateOK() - def __getRevision(self, no): """ Private method to generate the revision. @param no revision number to generate (1 or 2) - @return revision (string) + @type int + @return revision + @rtype str """ if no == 1: numberButton = self.number1Button @@ -237,6 +128,8 @@ branchCombo = self.branch1Combo bookmarkButton = self.bookmark1Button bookmarkCombo = self.bookmark1Combo + expressionButton = self.expression1Button + expressionEdit = self.expression1Edit tipButton = self.tip1Button prevButton = self.prev1Button noneButton = self.none1Button @@ -251,6 +144,8 @@ branchCombo = self.branch2Combo bookmarkButton = self.bookmark2Button bookmarkCombo = self.bookmark2Combo + expressionButton = self.expression2Button + expressionEdit = self.expression2Edit tipButton = self.tip2Button prevButton = self.prev2Button noneButton = self.none2Button @@ -265,6 +160,8 @@ return branchCombo.currentText() elif bookmarkButton.isChecked(): return bookmarkCombo.currentText() + elif expressionButton.isChecked(): + return expressionEdit.text() elif tipButton.isChecked(): return "tip" elif prevButton.isChecked(): @@ -278,7 +175,8 @@ """ Public method to get the revisions. - @return list two strings + @return list of two revisions + @rtype list of [str, str] """ rev1 = self.__getRevision(1) rev2 = self.__getRevision(2)
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgRevisionsSelectionDialog.ui Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgRevisionsSelectionDialog.ui Wed Apr 13 19:49:25 2022 +0200 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>371</width> - <height>505</height> + <width>400</width> + <height>700</height> </rect> </property> <property name="windowTitle"> @@ -160,7 +160,27 @@ </property> </widget> </item> - <item row="5" column="0" colspan="3"> + <item row="5" column="0"> + <widget class="QRadioButton" name="expression1Button"> + <property name="text"> + <string>Expression:</string> + </property> + </widget> + </item> + <item row="5" column="1" colspan="2"> + <widget class="QLineEdit" name="expression1Edit"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Enter a revision set expression</string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="6" column="0" colspan="3"> <widget class="QRadioButton" name="tip1Button"> <property name="toolTip"> <string>Select tip revision of repository</string> @@ -173,7 +193,7 @@ </property> </widget> </item> - <item row="6" column="0" colspan="3"> + <item row="7" column="0" colspan="3"> <widget class="QRadioButton" name="prev1Button"> <property name="toolTip"> <string>Select revision before last commit</string> @@ -186,7 +206,7 @@ </property> </widget> </item> - <item row="7" column="0" colspan="3"> + <item row="8" column="0" colspan="3"> <widget class="QRadioButton" name="none1Button"> <property name="text"> <string>No revision selected</string> @@ -336,7 +356,27 @@ </property> </widget> </item> - <item row="5" column="0" colspan="3"> + <item row="5" column="0"> + <widget class="QRadioButton" name="expression2Button"> + <property name="text"> + <string>Expression:</string> + </property> + </widget> + </item> + <item row="5" column="1" colspan="2"> + <widget class="QLineEdit" name="expression2Edit"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Enter a revision set expression</string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="6" column="0" colspan="3"> <widget class="QRadioButton" name="tip2Button"> <property name="toolTip"> <string>Select tip revision of repository</string> @@ -349,7 +389,7 @@ </property> </widget> </item> - <item row="6" column="0" colspan="3"> + <item row="7" column="0" colspan="3"> <widget class="QRadioButton" name="prev2Button"> <property name="toolTip"> <string>Select revision before last commit</string> @@ -359,7 +399,7 @@ </property> </widget> </item> - <item row="7" column="0" colspan="3"> + <item row="8" column="0" colspan="3"> <widget class="QRadioButton" name="none2Button"> <property name="text"> <string>No revision selected</string> @@ -393,6 +433,8 @@ <tabstop>branch1Combo</tabstop> <tabstop>bookmark1Button</tabstop> <tabstop>bookmark1Combo</tabstop> + <tabstop>expression1Button</tabstop> + <tabstop>expression1Edit</tabstop> <tabstop>tip1Button</tabstop> <tabstop>prev1Button</tabstop> <tabstop>none1Button</tabstop> @@ -406,10 +448,11 @@ <tabstop>branch2Combo</tabstop> <tabstop>bookmark2Button</tabstop> <tabstop>bookmark2Combo</tabstop> + <tabstop>expression2Button</tabstop> + <tabstop>expression2Edit</tabstop> <tabstop>tip2Button</tabstop> <tabstop>prev2Button</tabstop> <tabstop>none2Button</tabstop> - <tabstop>buttonBox</tabstop> </tabstops> <resources/> <connections> @@ -420,8 +463,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>54</x> - <y>440</y> + <x>63</x> + <y>688</y> </hint> <hint type="destinationlabel"> <x>21</x> @@ -436,8 +479,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>106</x> - <y>440</y> + <x>115</x> + <y>688</y> </hint> <hint type="destinationlabel"> <x>73</x> @@ -468,12 +511,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>72</x> - <y>258</y> + <x>114</x> + <y>394</y> </hint> <hint type="destinationlabel"> - <x>183</x> - <y>258</y> + <x>215</x> + <y>396</y> </hint> </hints> </connection> @@ -484,12 +527,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>32</x> - <y>71</y> + <x>53</x> + <y>99</y> </hint> <hint type="destinationlabel"> - <x>147</x> - <y>72</y> + <x>266</x> + <y>100</y> </hint> </hints> </connection> @@ -500,12 +543,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>68</x> - <y>286</y> + <x>110</x> + <y>427</y> </hint> <hint type="destinationlabel"> - <x>230</x> - <y>286</y> + <x>378</x> + <y>428</y> </hint> </hints> </connection> @@ -516,12 +559,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>59</x> - <y>105</y> + <x>80</x> + <y>131</y> </hint> <hint type="destinationlabel"> - <x>129</x> - <y>101</y> + <x>248</x> + <y>132</y> </hint> </hints> </connection> @@ -532,12 +575,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>50</x> - <y>124</y> + <x>71</x> + <y>163</y> </hint> <hint type="destinationlabel"> - <x>117</x> - <y>128</y> + <x>236</x> + <y>164</y> </hint> </hints> </connection> @@ -548,12 +591,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>36</x> - <y>306</y> + <x>78</x> + <y>459</y> </hint> <hint type="destinationlabel"> - <x>149</x> - <y>306</y> + <x>378</x> + <y>460</y> </hint> </hints> </connection> @@ -564,12 +607,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>73</x> - <y>331</y> + <x>115</x> + <y>491</y> </hint> <hint type="destinationlabel"> - <x>140</x> - <y>331</y> + <x>378</x> + <y>492</y> </hint> </hints> </connection> @@ -580,12 +623,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>24</x> - <y>152</y> + <x>45</x> + <y>195</y> </hint> <hint type="destinationlabel"> - <x>135</x> - <y>148</y> + <x>254</x> + <y>196</y> </hint> </hints> </connection> @@ -596,12 +639,44 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>21</x> - <y>363</y> + <x>63</x> + <y>523</y> </hint> <hint type="destinationlabel"> - <x>145</x> - <y>361</y> + <x>378</x> + <y>524</y> + </hint> + </hints> + </connection> + <connection> + <sender>expression1Button</sender> + <signal>toggled(bool)</signal> + <receiver>expression1Edit</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>54</x> + <y>216</y> + </hint> + <hint type="destinationlabel"> + <x>160</x> + <y>218</y> + </hint> + </hints> + </connection> + <connection> + <sender>expression2Button</sender> + <signal>toggled(bool)</signal> + <receiver>expression2Edit</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>37</x> + <y>542</y> + </hint> + <hint type="destinationlabel"> + <x>152</x> + <y>543</y> </hint> </hints> </connection>
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Wed Apr 13 18:16:23 2022 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Wed Apr 13 19:49:25 2022 +0200 @@ -1031,10 +1031,12 @@ or delete (boolean) """ from .HgRevisionSelectionDialog import HgRevisionSelectionDialog - dlg = HgRevisionSelectionDialog(self.hgGetTagsList(), - self.hgGetBranchesList(), - self.hgGetBookmarksList(), - self.tr("Current branch tip")) + dlg = HgRevisionSelectionDialog( + self.hgGetTagsList(), + self.hgGetBranchesList(), + bookmarksList=self.hgGetBookmarksList(), + noneLabel=self.tr("Current branch tip") + ) if dlg.exec() == QDialog.DialogCode.Accepted: rev = dlg.getRevision() return self.vcsUpdate(name, revision=rev) @@ -1503,9 +1505,11 @@ return from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog - dlg = HgRevisionsSelectionDialog(self.hgGetTagsList(), - self.hgGetBranchesList(), - self.hgGetBookmarksList()) + dlg = HgRevisionsSelectionDialog( + self.hgGetTagsList(), + self.hgGetBranchesList(), + bookmarksList=self.hgGetBookmarksList() + ) if dlg.exec() == QDialog.DialogCode.Accepted: revisions = dlg.getRevisions() if self.diff is None: @@ -1550,9 +1554,11 @@ if extended: from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog - dlg = HgRevisionsSelectionDialog(self.hgGetTagsList(), - self.hgGetBranchesList(), - self.hgGetBookmarksList()) + dlg = HgRevisionsSelectionDialog( + self.hgGetTagsList(), + self.hgGetBranchesList(), + bookmarksList=self.hgGetBookmarksList() + ) if dlg.exec() == QDialog.DialogCode.Accepted: rev1, rev2 = dlg.getRevisions() else: @@ -2247,9 +2253,11 @@ rev = "" if subcommand in ("good", "bad", "skip"): from .HgRevisionSelectionDialog import HgRevisionSelectionDialog - dlg = HgRevisionSelectionDialog(self.hgGetTagsList(), - self.hgGetBranchesList(), - self.hgGetBookmarksList()) + dlg = HgRevisionSelectionDialog( + self.hgGetTagsList(), + self.hgGetBranchesList(), + bookmarksList=self.hgGetBookmarksList() + ) if dlg.exec() == QDialog.DialogCode.Accepted: rev = dlg.getRevision() else: