12 from PyQt4.QtCore import QProcess, QCoreApplication |
12 from PyQt4.QtCore import QProcess, QCoreApplication |
13 from PyQt4.QtGui import QDialog, QTreeWidgetItem |
13 from PyQt4.QtGui import QDialog, QTreeWidgetItem |
14 |
14 |
15 from .Ui_HgQueuesListAllGuardsDialog import Ui_HgQueuesListAllGuardsDialog |
15 from .Ui_HgQueuesListAllGuardsDialog import Ui_HgQueuesListAllGuardsDialog |
16 |
16 |
17 import Preferences |
|
18 import UI.PixmapCache |
17 import UI.PixmapCache |
19 |
18 |
20 |
19 |
21 class HgQueuesListAllGuardsDialog(QDialog, Ui_HgQueuesListAllGuardsDialog): |
20 class HgQueuesListAllGuardsDialog(QDialog, Ui_HgQueuesListAllGuardsDialog): |
22 """ |
21 """ |
51 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
50 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
52 repodir = os.path.dirname(repodir) |
51 repodir = os.path.dirname(repodir) |
53 if os.path.splitdrive(repodir)[1] == os.sep: |
52 if os.path.splitdrive(repodir)[1] == os.sep: |
54 return |
53 return |
55 |
54 |
56 args = [] |
55 args = self.vcs.initCommand("qguard") |
57 args.append("qguard") |
|
58 args.append("--list") |
56 args.append("--list") |
59 |
57 |
60 output = "" |
58 output = "" |
61 if self.__hgClient: |
59 if self.__hgClient: |
62 output = self.__hgClient.runcommand(args)[0] |
60 output = self.__hgClient.runcommand(args)[0] |
63 else: |
61 else: |
64 ioEncoding = Preferences.getSystem("IOEncoding") |
|
65 process = QProcess() |
62 process = QProcess() |
66 process.setWorkingDirectory(repodir) |
63 process.setWorkingDirectory(repodir) |
67 process.start('hg', args) |
64 process.start('hg', args) |
68 procStarted = process.waitForStarted(5000) |
65 procStarted = process.waitForStarted(5000) |
69 if procStarted: |
66 if procStarted: |
70 finished = process.waitForFinished(30000) |
67 finished = process.waitForFinished(30000) |
71 if finished and process.exitCode() == 0: |
68 if finished and process.exitCode() == 0: |
72 output = str( |
69 output = str(process.readAllStandardOutput(), |
73 process.readAllStandardOutput(), ioEncoding, 'replace') |
70 self.vcs.getEncoding(), 'replace') |
74 |
71 |
75 if output: |
72 if output: |
76 guardsDict = {} |
73 guardsDict = {} |
77 for line in output.splitlines(): |
74 for line in output.splitlines(): |
78 if line: |
75 if line: |