Plugins/VcsPlugins/vcsMercurial/HgDialog.py

changeset 5283
06423d65a2b8
parent 5268
748e4c50523b
child 5389
9b1c800daff3
equal deleted inserted replaced
5282:898b0dda21e1 5283:06423d65a2b8
13 except NameError: 13 except NameError:
14 pass 14 pass
15 15
16 import os 16 import os
17 17
18 from PyQt5.QtCore import QProcess, QTimer, pyqtSlot, Qt, QCoreApplication 18 from PyQt5.QtCore import QProcess, QTimer, pyqtSlot, Qt, QCoreApplication, \
19 QProcessEnvironment
19 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QLineEdit 20 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QLineEdit
20 21
21 from E5Gui import E5MessageBox 22 from E5Gui import E5MessageBox
22 23
23 from .Ui_HgDialog import Ui_HgDialog 24 from .Ui_HgDialog import Ui_HgDialog
114 @param exitStatus exit status of the process (QProcess.ExitStatus) 115 @param exitStatus exit status of the process (QProcess.ExitStatus)
115 """ 116 """
116 self.normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0) 117 self.normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0)
117 self.__finish() 118 self.__finish()
118 119
119 def startProcess(self, args, workingDir=None, showArgs=True): 120 def startProcess(self, args, workingDir=None, showArgs=True,
121 environment={}):
120 """ 122 """
121 Public slot used to start the process. 123 Public slot used to start the process.
122 124
123 @param args list of arguments for the process (list of strings) 125 @param args list of arguments for the process (list of strings)
124 @keyparam workingDir working directory for the process (string) 126 @keyparam workingDir working directory for the process (string)
125 @keyparam showArgs flag indicating to show the arguments (boolean) 127 @keyparam showArgs flag indicating to show the arguments (boolean)
128 @keyparam environment dictionary of environment settings to add
129 or change for the git process (dict of string and string)
126 @return flag indicating a successful start of the process 130 @return flag indicating a successful start of the process
127 """ 131 """
128 self.errorGroup.hide() 132 self.errorGroup.hide()
129 self.normal = False 133 self.normal = False
130 self.intercept = False 134 self.intercept = False
131 135
132 self.__hasAddOrDelete = False 136 self.__hasAddOrDelete = False
133 if args[0] in ["fetch", "qpush", "qpop", "qgoto", "rebase", 137 if args[0] in ["fetch", "qpush", "qpop", "qgoto", "rebase",
134 "update", "import", "revert", "graft", "shelve", 138 "update", "import", "revert", "graft", "shelve",
135 "unshelve", "strip"] or \ 139 "unshelve", "strip", "histedit"] or \
136 (args[0] in ["pull", "unbundle"] and 140 (args[0] in ["pull", "unbundle"] and
137 ("--update" in args[1:] or "--rebase" in args[1:])): 141 ("--update" in args[1:] or "--rebase" in args[1:])):
138 self.__updateCommand = True 142 self.__updateCommand = True
139 else: 143 else:
140 self.__updateCommand = False 144 self.__updateCommand = False
143 self.resultbox.append(' '.join(args)) 147 self.resultbox.append(' '.join(args))
144 self.resultbox.append('') 148 self.resultbox.append('')
145 149
146 if self.__hgClient is None: 150 if self.__hgClient is None:
147 self.proc = QProcess() 151 self.proc = QProcess()
152 if environment:
153 env = QProcessEnvironment.systemEnvironment()
154 for key, value in environment.items():
155 env.insert(key, value)
156 self.proc.setProcessEnvironment(env)
148 157
149 self.proc.finished.connect(self.__procFinished) 158 self.proc.finished.connect(self.__procFinished)
150 self.proc.readyReadStandardOutput.connect(self.__readStdout) 159 self.proc.readyReadStandardOutput.connect(self.__readStdout)
151 self.proc.readyReadStandardError.connect(self.__readStderr) 160 self.proc.readyReadStandardError.connect(self.__readStderr)
152 161

eric ide

mercurial