--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitMergeDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitMergeDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -19,11 +19,13 @@ """ Class implementing a dialog to enter the merge data. """ - def __init__(self, tagsList, branchesList, currentBranch, - remoteBranchesList, parent=None): + + def __init__( + self, tagsList, branchesList, currentBranch, remoteBranchesList, parent=None + ): """ Constructor - + @param tagsList list of tags (list of strings) @param branchesList list of branches (list of strings) @param currentBranch name of the current branch (string) @@ -32,27 +34,25 @@ """ super().__init__(parent) self.setupUi(self) - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(False) - + + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) + project = ericApp().getObject("Project") pwl, pel = project.getProjectDictionaries() language = project.getProjectSpellLanguage() - self.commitMessageEdit.setLanguageWithPWL( - language, pwl or None, pel or None) - + self.commitMessageEdit.setLanguageWithPWL(language, pwl or None, pel or None) + self.__currentBranch = currentBranch - + self.tagCombo.addItems(sorted(tagsList)) if currentBranch in branchesList: branchesList.remove(currentBranch) self.branchCombo.addItems(sorted(branchesList)) self.remoteBranchCombo.addItems(sorted(remoteBranchesList)) - + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - + def __updateOK(self): """ Private slot to update the OK button. @@ -66,13 +66,14 @@ enabled = self.branchCombo.currentText() != "" elif self.remoteBranchButton.isChecked(): enabled = self.remoteBranchCombo.currentText() != "" - - enabled &= (self.commitGroupBox.isChecked() and - self.commitMessageEdit.toPlainText() != "") - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) - + + enabled &= ( + self.commitGroupBox.isChecked() + and self.commitMessageEdit.toPlainText() != "" + ) + + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) + def __generateDefaultCommitMessage(self): """ Private slot to generate a default commit message based on the @@ -81,132 +82,136 @@ if self.commitGroupBox.isChecked(): if self.idButton.isChecked(): msg = "Merged commit {0} into {1}.".format( - self.idEdit.text(), self.__currentBranch) + self.idEdit.text(), self.__currentBranch + ) elif self.tagButton.isChecked(): msg = "Merged tag {0} into {1}.".format( - self.tagCombo.currentText(), self.__currentBranch) + self.tagCombo.currentText(), self.__currentBranch + ) elif self.branchButton.isChecked(): msg = "Merged branch {0} into {1}.".format( - self.branchCombo.currentText(), self.__currentBranch) + self.branchCombo.currentText(), self.__currentBranch + ) elif self.remoteBranchButton.isChecked(): msg = "Merged remote branch {0} into {1}.".format( - self.remoteBranchCombo.currentText(), self.__currentBranch) + self.remoteBranchCombo.currentText(), self.__currentBranch + ) else: msg = "Merged into {0}.".format(self.__currentBranch) self.commitMessageEdit.setPlainText(msg) else: self.commitMessageEdit.clear() - + @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.__generateDefaultCommitMessage() 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.__generateDefaultCommitMessage() 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.__generateDefaultCommitMessage() self.__updateOK() - + @pyqtSlot(bool) def on_remoteBranchButton_toggled(self, checked): """ Private slot to handle changes of the Remote Branch select button. - + @param checked state of the button (boolean) """ self.__generateDefaultCommitMessage() self.__updateOK() - + @pyqtSlot(bool) def on_noneButton_toggled(self, checked): """ Private slot to handle changes of the None select button. - + @param checked state of the button (boolean) """ self.__generateDefaultCommitMessage() - + @pyqtSlot(str) def on_idEdit_textChanged(self, txt): """ Private slot to handle changes of the Commit edit. - + @param txt text of the edit (string) """ self.__generateDefaultCommitMessage() 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.__generateDefaultCommitMessage() 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.__generateDefaultCommitMessage() self.__updateOK() - + @pyqtSlot(str) def on_remoteBranchCombo_editTextChanged(self, txt): """ Private slot to handle changes of the Remote Branch combo. - + @param txt text of the combo (string) """ self.__generateDefaultCommitMessage() self.__updateOK() - + @pyqtSlot(bool) def on_commitGroupBox_toggled(self, checked): """ Private slot to handle changes of the Commit select group. - + @param checked state of the group (boolean) """ self.__generateDefaultCommitMessage() self.__updateOK() - + @pyqtSlot() def on_commitMessageEdit_textChanged(self): """ Private slot to handle changes of the commit message edit. """ self.__updateOK() - + def getParameters(self): """ Public method to retrieve the merge data. - + @return tuple naming the revision, a flag indicating that the merge shall be committed, the commit message, a flag indicating that a log summary shall be appended and a flag indicating to show diff @@ -223,7 +228,7 @@ rev = self.remoteBranchCombo.currentText() else: rev = "" - + return ( rev, self.commitGroupBox.isChecked(),