diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditCommitEditor.py --- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditCommitEditor.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditCommitEditor.py Wed Jul 13 14:55:47 2022 +0200 @@ -21,10 +21,11 @@ """ Class implementing a dialog to edit the commit message of a revision. """ + def __init__(self, fileName, parent=None): """ Constructor - + @param fileName name of the file containing the commit message to be edited @type str @@ -33,16 +34,17 @@ """ super().__init__(parent) self.setupUi(self) - + self.__fileName = fileName self.__readFile() - + self.recentCommitMessages = Preferences.toList( - Preferences.getSettings().value('Mercurial/Commits')) + Preferences.getSettings().value("Mercurial/Commits") + ) self.recentComboBox.clear() self.recentComboBox.addItem("") self.recentComboBox.addItems(self.recentCommitMessages) - + def __readFile(self): """ Private method to read the file containing the commit message and @@ -55,12 +57,14 @@ EricMessageBox.critical( self, self.tr("Edit Commit Message"), - self.tr("""<p>The file <b>{0}</b> could not be read.</p>""" - """<p>Reason: {1}</p>""").format( - self.__fileName, str(err))) + self.tr( + """<p>The file <b>{0}</b> could not be read.</p>""" + """<p>Reason: {1}</p>""" + ).format(self.__fileName, str(err)), + ) self.on_buttonBox_rejected() return - + msgLines = [] infoLines = [] for line in txt.splitlines(): @@ -70,17 +74,17 @@ infoLines.append(line[3:].lstrip()) else: msgLines.append(line) - + # remove empty lines at end of message for row in range(len(msgLines) - 1, -1, -1): if msgLines[row] == "": del msgLines[row] else: break - + self.messageEdit.setPlainText("\n".join(msgLines)) self.infoEdit.setPlainText("\n".join(infoLines)) - + @pyqtSlot() def on_buttonBox_accepted(self): """ @@ -94,15 +98,17 @@ EricMessageBox.critical( self, self.tr("Edit Commit Message"), - self.tr("""<p>The file <b>{0}</b> could not be read.</p>""" - """<p>Reason: {1}</p>""").format( - self.__fileName, str(err))) + self.tr( + """<p>The file <b>{0}</b> could not be read.</p>""" + """<p>Reason: {1}</p>""" + ).format(self.__fileName, str(err)), + ) self.on_buttonBox_rejected() return - + self.close() QCoreApplication.exit(0) - + @pyqtSlot() def on_buttonBox_rejected(self): """ @@ -110,12 +116,12 @@ """ self.close() QCoreApplication.exit(1) - + @pyqtSlot(int) def on_recentComboBox_activated(self, index): """ Private slot to select a commit message from recent ones. - + @param index index of the selected entry @type int """