eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesDefineGuardsDialog.py

changeset 7370
5fb53279f2df
parent 7360
9190402e4505
child 7533
88261c96484b
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesDefineGuardsDialog.py	Wed Jan 08 19:13:57 2020 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesDefineGuardsDialog.py	Mon Jan 13 19:23:08 2020 +0100
@@ -7,10 +7,9 @@
 Module implementing a dialog to define guards for patches.
 """
 
-
 import os
 
-from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QCoreApplication
+from PyQt5.QtCore import pyqtSlot, Qt, QCoreApplication
 from PyQt5.QtWidgets import (
     QDialog, QDialogButtonBox, QAbstractButton, QListWidgetItem
 )
@@ -61,9 +60,8 @@
         
         @param e close event (QCloseEvent)
         """
-        if self.__hgClient:
-            if self.__hgClient.isExecuting():
-                self.__hgClient.cancel()
+        if self.__hgClient.isExecuting():
+            self.__hgClient.cancel()
         
         if self.__dirtyList:
             res = E5MessageBox.question(
@@ -135,19 +133,7 @@
         if patch:
             args.append(patch)
         
-        output = ""
-        if self.__hgClient:
-            output = self.__hgClient.runcommand(args)[0]
-        else:
-            process = QProcess()
-            process.setWorkingDirectory(self.__repodir)
-            process.start('hg', args)
-            procStarted = process.waitForStarted(5000)
-            if procStarted:
-                finished = process.waitForFinished(30000)
-                if finished and process.exitCode() == 0:
-                    output = str(process.readAllStandardOutput(),
-                                 self.vcs.getEncoding(), 'replace').strip()
+        output = self.__hgClient.runcommand(args)[0]
         
         if output:
             patchName, guards = output.split(":", 1)
@@ -275,27 +261,7 @@
             else:
                 args.append("--none")
             
-            error = ""
-            if self.__hgClient:
-                error = self.__hgClient.runcommand(args)[1]
-            else:
-                process = QProcess()
-                process.setWorkingDirectory(self.__repodir)
-                process.start('hg', args)
-                procStarted = process.waitForStarted(5000)
-                if procStarted:
-                    finished = process.waitForFinished(30000)
-                    if finished:
-                        if process.exitCode() != 0:
-                            error = str(process.readAllStandardError(),
-                                        self.vcs.getEncoding(), 'replace')
-                    else:
-                        E5MessageBox.warning(
-                            self,
-                            self.tr("Apply Guard Definitions"),
-                            self.tr(
-                                """The Mercurial process did not finish"""
-                                """ in time."""))
+            error = self.__hgClient.runcommand(args)[1]
             
             if error:
                 E5MessageBox.warning(

eric ide

mercurial