5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to select the heads to be closed. |
7 Module implementing a dialog to select the heads to be closed. |
8 """ |
8 """ |
9 |
9 |
10 |
10 from PyQt5.QtCore import pyqtSlot |
11 import os |
|
12 |
|
13 from PyQt5.QtCore import pyqtSlot, QProcess |
|
14 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem |
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem |
15 |
12 |
16 from .Ui_HgCloseHeadSelectionDialog import Ui_HgCloseHeadSelectionDialog |
13 from .Ui_HgCloseHeadSelectionDialog import Ui_HgCloseHeadSelectionDialog |
17 |
14 |
18 |
15 |
57 args.append('--template') |
54 args.append('--template') |
58 args.append('{node|short}@@@{branches}\n') |
55 args.append('{node|short}@@@{branches}\n') |
59 |
56 |
60 output = "" |
57 output = "" |
61 client = vcs.getClient() |
58 client = vcs.getClient() |
62 if client is None: |
59 output, error = client.runcommand(args) |
63 # find the root of the repo |
|
64 repodir = self.splitPath(ppath)[0] |
|
65 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
66 repodir = os.path.dirname(repodir) |
|
67 if os.path.splitdrive(repodir)[1] == os.sep: |
|
68 return [] |
|
69 |
|
70 process = QProcess() |
|
71 process.setWorkingDirectory(repodir) |
|
72 process.start('hg', args) |
|
73 procStarted = process.waitForStarted(5000) |
|
74 if procStarted: |
|
75 finished = process.waitForFinished(30000) |
|
76 if finished and process.exitCode() == 0: |
|
77 output = str(process.readAllStandardOutput(), |
|
78 self.getEncoding(), 'replace') |
|
79 else: |
|
80 output, error = client.runcommand(args) |
|
81 |
60 |
82 heads = [] |
61 heads = [] |
83 if output: |
62 if output: |
84 for line in output.splitlines(): |
63 for line in output.splitlines(): |
85 line = line.strip() |
64 line = line.strip() |