--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/CloseheadExtension/HgCloseHeadSelectionDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/CloseheadExtension/HgCloseHeadSelectionDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -19,10 +19,11 @@ """ Class implementing a dialog to select the heads to be closed. """ + def __init__(self, vcs, parent=None): """ Constructor - + @param vcs reference to the VCS object @type Hg @param parent reference to the parent widget @@ -30,25 +31,23 @@ """ super().__init__(parent) self.setupUi(self) - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Cancel).setDefault(True) - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(False) - + + self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) + project = ericApp().getObject("Project") pwl, pel = project.getProjectDictionaries() language = project.getProjectSpellLanguage() self.logEdit.setLanguageWithPWL(language, pwl or None, pel or None) - + heads = self.__getHeads(vcs) for revision, branch in heads: QTreeWidgetItem(self.headsList, [revision, branch]) - + def __getHeads(self, vcs): """ Private method to get the open heads. - + @param vcs reference to the VCS object @type Hg @return list of tuples containing the revision and the corresponding @@ -56,13 +55,13 @@ @rtype list of tuples of (str, str) """ args = vcs.initCommand("heads") - args.append('--template') - args.append('{node|short}@@@{branches}\n') - + args.append("--template") + args.append("{node|short}@@@{branches}\n") + output = "" client = vcs.getClient() output, error = client.runcommand(args) - + heads = [] if output: for line in output.splitlines(): @@ -70,9 +69,9 @@ if line: revision, branch = line.split("@@@") heads.append((revision, branch)) - + return heads - + @pyqtSlot() def on_headsList_itemSelectionChanged(self): """ @@ -81,16 +80,16 @@ self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( len(self.headsList.selectedItems()) > 0 ) - + def getData(self): """ Public method to retrieve the entered data. - + @return tuple containing a list of selected revisions and the commit message @rtype tuple of (list of str, str) """ revisions = [itm.text(0) for itm in self.headsList.selectedItems()] message = self.logEdit.toPlainText().strip() - + return revisions, message