9 |
9 |
10 |
10 |
11 import os |
11 import os |
12 |
12 |
13 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QRegExp, QTimer |
13 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QRegExp, QTimer |
14 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QListWidgetItem, \ |
14 from PyQt5.QtWidgets import ( |
15 QLineEdit |
15 QDialog, QDialogButtonBox, QListWidgetItem, QLineEdit |
|
16 ) |
16 |
17 |
17 from E5Gui import E5MessageBox |
18 from E5Gui import E5MessageBox |
18 |
19 |
19 from .Ui_SvnChangeListsDialog import Ui_SvnChangeListsDialog |
20 from .Ui_SvnChangeListsDialog import Ui_SvnChangeListsDialog |
20 |
21 |
48 self.process.readyReadStandardError.connect(self.__readStderr) |
49 self.process.readyReadStandardError.connect(self.__readStderr) |
49 |
50 |
50 self.rx_status = QRegExp( |
51 self.rx_status = QRegExp( |
51 '(.{8,9})\\s+([0-9-]+)\\s+([0-9?]+)\\s+(\\S+)\\s+(.+)\\s*') |
52 '(.{8,9})\\s+([0-9-]+)\\s+([0-9?]+)\\s+(\\S+)\\s+(.+)\\s*') |
52 # flags (8 or 9 anything), revision, changed rev, author, path |
53 # flags (8 or 9 anything), revision, changed rev, author, path |
53 self.rx_status2 = \ |
54 self.rx_status2 = QRegExp('(.{8,9})\\s+(.+)\\s*') |
54 QRegExp('(.{8,9})\\s+(.+)\\s*') |
|
55 # flags (8 or 9 anything), path |
55 # flags (8 or 9 anything), path |
56 self.rx_changelist = \ |
56 self.rx_changelist = QRegExp('--- \\S+ .([\\w\\s]+).:\\s+') |
57 QRegExp('--- \\S+ .([\\w\\s]+).:\\s+') |
|
58 # three dashes, Changelist (translated), quote, |
57 # three dashes, Changelist (translated), quote, |
59 # changelist name, quote, : |
58 # changelist name, quote, : |
60 |
59 |
61 @pyqtSlot(QListWidgetItem, QListWidgetItem) |
60 @pyqtSlot(QListWidgetItem, QListWidgetItem) |
62 def on_changeLists_currentItemChanged(self, current, previous): |
61 def on_changeLists_currentItemChanged(self, current, previous): |
92 |
91 |
93 args = [] |
92 args = [] |
94 args.append('status') |
93 args.append('status') |
95 self.vcs.addArguments(args, self.vcs.options['global']) |
94 self.vcs.addArguments(args, self.vcs.options['global']) |
96 self.vcs.addArguments(args, self.vcs.options['status']) |
95 self.vcs.addArguments(args, self.vcs.options['status']) |
97 if '--verbose' not in self.vcs.options['global'] and \ |
96 if ( |
98 '--verbose' not in self.vcs.options['status']: |
97 '--verbose' not in self.vcs.options['global'] and |
|
98 '--verbose' not in self.vcs.options['status'] |
|
99 ): |
99 args.append('--verbose') |
100 args.append('--verbose') |
100 if isinstance(path, list): |
101 if isinstance(path, list): |
101 self.dname, fnames = self.vcs.splitPathList(path) |
102 self.dname, fnames = self.vcs.splitPathList(path) |
102 self.vcs.addArguments(args, fnames) |
103 self.vcs.addArguments(args, fnames) |
103 else: |
104 else: |
125 def __finish(self): |
126 def __finish(self): |
126 """ |
127 """ |
127 Private slot called when the process finished or the user pressed |
128 Private slot called when the process finished or the user pressed |
128 the button. |
129 the button. |
129 """ |
130 """ |
130 if self.process is not None and \ |
131 if ( |
131 self.process.state() != QProcess.NotRunning: |
132 self.process is not None and |
|
133 self.process.state() != QProcess.NotRunning |
|
134 ): |
132 self.process.terminate() |
135 self.process.terminate() |
133 QTimer.singleShot(2000, self.process.kill) |
136 QTimer.singleShot(2000, self.process.kill) |
134 self.process.waitForFinished(3000) |
137 self.process.waitForFinished(3000) |
135 |
138 |
136 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
139 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
181 |
184 |
182 while self.process.canReadLine(): |
185 while self.process.canReadLine(): |
183 s = str(self.process.readLine(), |
186 s = str(self.process.readLine(), |
184 Preferences.getSystem("IOEncoding"), |
187 Preferences.getSystem("IOEncoding"), |
185 'replace') |
188 'replace') |
186 if self.currentChangelist != "" and \ |
189 if ( |
187 self.rx_status.exactMatch(s): |
190 self.currentChangelist != "" and |
|
191 self.rx_status.exactMatch(s) |
|
192 ): |
188 file = self.rx_status.cap(5).strip() |
193 file = self.rx_status.cap(5).strip() |
189 filename = file.replace(self.path + os.sep, "") |
194 filename = file.replace(self.path + os.sep, "") |
190 if filename not in \ |
195 if filename not in self.changeListsDict[ |
191 self.changeListsDict[self.currentChangelist]: |
196 self.currentChangelist |
|
197 ]: |
192 self.changeListsDict[self.currentChangelist].append( |
198 self.changeListsDict[self.currentChangelist].append( |
193 filename) |
199 filename) |
194 elif self.currentChangelist != "" and \ |
200 elif ( |
195 self.rx_status2.exactMatch(s): |
201 self.currentChangelist != "" and |
|
202 self.rx_status2.exactMatch(s) |
|
203 ): |
196 file = self.rx_status2.cap(2).strip() |
204 file = self.rx_status2.cap(2).strip() |
197 filename = file.replace(self.path + os.sep, "") |
205 filename = file.replace(self.path + os.sep, "") |
198 if filename not in \ |
206 if filename not in self.changeListsDict[ |
199 self.changeListsDict[self.currentChangelist]: |
207 self.currentChangelist |
|
208 ]: |
200 self.changeListsDict[self.currentChangelist].append( |
209 self.changeListsDict[self.currentChangelist].append( |
201 filename) |
210 filename) |
202 elif self.rx_changelist.exactMatch(s): |
211 elif self.rx_changelist.exactMatch(s): |
203 self.currentChangelist = self.rx_changelist.cap(1) |
212 self.currentChangelist = self.rx_changelist.cap(1) |
204 if self.currentChangelist not in self.changeListsDict: |
213 if self.currentChangelist not in self.changeListsDict: |