Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListGuardsDialog.py

changeset 3302
e92f0dd51979
parent 3190
a9a94491c4fd
child 3484
645c12de6b0c
equal deleted inserted replaced
3300:734353e7d679 3302:e92f0dd51979
12 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, QCoreApplication 12 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, QCoreApplication
13 from PyQt4.QtGui import QDialog, QListWidgetItem 13 from PyQt4.QtGui import QDialog, QListWidgetItem
14 14
15 from .Ui_HgQueuesListGuardsDialog import Ui_HgQueuesListGuardsDialog 15 from .Ui_HgQueuesListGuardsDialog import Ui_HgQueuesListGuardsDialog
16 16
17 import Preferences
18 import UI.PixmapCache 17 import UI.PixmapCache
19 18
20 19
21 class HgQueuesListGuardsDialog(QDialog, Ui_HgQueuesListGuardsDialog): 20 class HgQueuesListGuardsDialog(QDialog, Ui_HgQueuesListGuardsDialog):
22 """ 21 """
86 @param patch selected patch name (empty for current patch) 85 @param patch selected patch name (empty for current patch)
87 """ 86 """
88 self.guardsList.clear() 87 self.guardsList.clear()
89 self.patchNameLabel.setText("") 88 self.patchNameLabel.setText("")
90 89
91 args = [] 90 args = self.vcs.initCommand("qguard")
92 args.append("qguard")
93 if patch: 91 if patch:
94 args.append(patch) 92 args.append(patch)
95 93
96 output = "" 94 output = ""
97 if self.__hgClient: 95 if self.__hgClient:
98 output = self.__hgClient.runcommand(args)[0].strip() 96 output = self.__hgClient.runcommand(args)[0].strip()
99 else: 97 else:
100 ioEncoding = Preferences.getSystem("IOEncoding")
101 process = QProcess() 98 process = QProcess()
102 process.setWorkingDirectory(self.__repodir) 99 process.setWorkingDirectory(self.__repodir)
103 process.start('hg', args) 100 process.start('hg', args)
104 procStarted = process.waitForStarted(5000) 101 procStarted = process.waitForStarted(5000)
105 if procStarted: 102 if procStarted:
106 finished = process.waitForFinished(30000) 103 finished = process.waitForFinished(30000)
107 if finished and process.exitCode() == 0: 104 if finished and process.exitCode() == 0:
108 output = \ 105 output = str(process.readAllStandardOutput(),
109 str(process.readAllStandardOutput(), 106 self.vcs.getEncoding(), 'replace').strip()
110 ioEncoding, 'replace').strip()
111 107
112 if output: 108 if output:
113 patchName, guards = output.split(":", 1) 109 patchName, guards = output.split(":", 1)
114 self.patchNameLabel.setText(patchName) 110 self.patchNameLabel.setText(patchName)
115 guardsList = guards.strip().split() 111 guardsList = guards.strip().split()

eric ide

mercurial