diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/histedit.py --- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/histedit.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/histedit.py Wed Jul 13 14:55:47 2022 +0200 @@ -21,42 +21,44 @@ """ Class implementing the histedit extension interface. """ + def __init__(self, vcs): """ Constructor - + @param vcs reference to the Mercurial vcs object @type Hg """ super().__init__(vcs) - + def hgHisteditStart(self, rev=""): """ Public method to start a histedit session. - + @param rev revision to start histedit at @type str @return flag indicating that the project should be reread @rtype bool """ from .HgHisteditConfigDialog import HgHisteditConfigDialog + res = False - dlg = HgHisteditConfigDialog(self.vcs.hgGetTagsList(), - self.vcs.hgGetBranchesList(), - self.vcs.hgGetBookmarksList(), - rev) + dlg = HgHisteditConfigDialog( + self.vcs.hgGetTagsList(), + self.vcs.hgGetBranchesList(), + self.vcs.hgGetBookmarksList(), + rev, + ) if dlg.exec() == QDialog.DialogCode.Accepted: rev, force, keep = dlg.getData() - - editor = os.path.join( - os.path.dirname(__file__), "HgHisteditEditor.py") - + + editor = os.path.join(os.path.dirname(__file__), "HgHisteditEditor.py") + args = self.vcs.initCommand("histedit") args.append("-v") - args.extend([ - "--config", - f"ui.editor={Globals.getPythonExecutable()} {editor}" - ]) + args.extend( + ["--config", f"ui.editor={Globals.getPythonExecutable()} {editor}"] + ) if keep: args.append("--keep") if rev: @@ -66,56 +68,48 @@ else: args.append("--rev") args.append(rev) - + env = { - "HGEDITOR": "{0} {1}".format( - Globals.getPythonExecutable(), editor), - "EDITOR": "{0} {1}".format( - Globals.getPythonExecutable(), editor), + "HGEDITOR": "{0} {1}".format(Globals.getPythonExecutable(), editor), + "EDITOR": "{0} {1}".format(Globals.getPythonExecutable(), editor), } - + dia = HgDialog( - self.tr("Starting histedit session"), - self.vcs, - useClient=False) + self.tr("Starting histedit session"), self.vcs, useClient=False + ) res = dia.startProcess(args, environment=env) if res: dia.exec() res = dia.hasAddOrDelete() self.vcs.checkVCSStatus() return res - + def hgHisteditContinue(self): """ Public method to continue an interrupted histedit session. - + @return flag indicating that the project should be reread @rtype bool """ args = self.vcs.initCommand("histedit") args.append("--continue") args.append("-v") - - editor = os.path.join( - os.path.dirname(__file__), "HgHisteditEditor.py") - env = {"HGEDITOR": "{0} {1}".format( - Globals.getPythonExecutable(), editor)} - - dia = HgDialog( - self.tr("Continue histedit session"), - self.vcs, - useClient=False) + + editor = os.path.join(os.path.dirname(__file__), "HgHisteditEditor.py") + env = {"HGEDITOR": "{0} {1}".format(Globals.getPythonExecutable(), editor)} + + dia = HgDialog(self.tr("Continue histedit session"), self.vcs, useClient=False) res = dia.startProcess(args, environment=env) if res: dia.exec() res = dia.hasAddOrDelete() self.vcs.checkVCSStatus() return res - + def hgHisteditAbort(self, name): """ Public method to abort an interrupted histedit session. - + @param name file/directory name @type str @return flag indicating that the project should be reread @@ -124,44 +118,34 @@ args = self.vcs.initCommand("histedit") args.append("--abort") args.append("-v") - - editor = os.path.join( - os.path.dirname(__file__), "HgHisteditEditor.py") - env = {"HGEDITOR": "{0} {1}".format( - Globals.getPythonExecutable(), editor)} - - dia = HgDialog( - self.tr("Abort histedit session"), - self.vcs, - useClient=False) + + editor = os.path.join(os.path.dirname(__file__), "HgHisteditEditor.py") + env = {"HGEDITOR": "{0} {1}".format(Globals.getPythonExecutable(), editor)} + + dia = HgDialog(self.tr("Abort histedit session"), self.vcs, useClient=False) res = dia.startProcess(args, environment=env) if res: dia.exec() res = dia.hasAddOrDelete() self.vcs.checkVCSStatus() return res - + def hgHisteditEditPlan(self): """ Public method to edit the remaining actions list of an interrupted histedit session. - + @return flag indicating that the project should be reread @rtype bool """ args = self.vcs.initCommand("histedit") args.append("--edit-plan") args.append("-v") - - editor = os.path.join( - os.path.dirname(__file__), "HgHisteditEditor.py") - env = {"HGEDITOR": "{0} {1}".format( - Globals.getPythonExecutable(), editor)} - - dia = HgDialog( - self.tr("Edit Plan"), - self.vcs, - useClient=False) + + editor = os.path.join(os.path.dirname(__file__), "HgHisteditEditor.py") + env = {"HGEDITOR": "{0} {1}".format(Globals.getPythonExecutable(), editor)} + + dia = HgDialog(self.tr("Edit Plan"), self.vcs, useClient=False) res = dia.startProcess(args, environment=env) if res: dia.exec()