17 from E5Gui import E5MessageBox |
17 from E5Gui import E5MessageBox |
18 |
18 |
19 from .Ui_HgLogDialog import Ui_HgLogDialog |
19 from .Ui_HgLogDialog import Ui_HgLogDialog |
20 |
20 |
21 import Utilities |
21 import Utilities |
22 import Preferences |
|
23 |
22 |
24 |
23 |
25 class HgLogDialog(QWidget, Ui_HgLogDialog): |
24 class HgLogDialog(QWidget, Ui_HgLogDialog): |
26 """ |
25 """ |
27 Class implementing a dialog to show the output of the hg log command |
26 Class implementing a dialog to show the output of the hg log command |
123 |
122 |
124 self.activateWindow() |
123 self.activateWindow() |
125 self.raise_() |
124 self.raise_() |
126 |
125 |
127 preargs = [] |
126 preargs = [] |
128 args = [] |
127 args = self.vcs.initCommand(self.mode) |
129 args.append(self.mode) |
|
130 self.vcs.addArguments(args, self.vcs.options['global']) |
|
131 self.vcs.addArguments(args, self.vcs.options['log']) |
|
132 if noEntries and self.mode == "log": |
128 if noEntries and self.mode == "log": |
133 args.append('--limit') |
129 args.append('--limit') |
134 args.append(str(noEntries)) |
130 args.append(str(noEntries)) |
135 if self.mode in ("incoming", "outgoing"): |
131 if self.mode in ("incoming", "outgoing"): |
136 args.append("--newest-first") |
132 args.append("--newest-first") |
232 """ |
228 """ |
233 errMsg = "" |
229 errMsg = "" |
234 parents = [] |
230 parents = [] |
235 |
231 |
236 if int(rev) > 0: |
232 if int(rev) > 0: |
237 args = [] |
233 args = self.vcs.initCommand("parents") |
238 args.append("parents") |
|
239 if self.mode == "incoming": |
234 if self.mode == "incoming": |
240 if self.bundle: |
235 if self.bundle: |
241 args.append("--repository") |
236 args.append("--repository") |
242 args.append(self.bundle) |
237 args.append(self.bundle) |
243 elif self.vcs.bundleFile and \ |
238 elif self.vcs.bundleFile and \ |
260 process.start('hg', args) |
255 process.start('hg', args) |
261 procStarted = process.waitForStarted(5000) |
256 procStarted = process.waitForStarted(5000) |
262 if procStarted: |
257 if procStarted: |
263 finished = process.waitForFinished(30000) |
258 finished = process.waitForFinished(30000) |
264 if finished and process.exitCode() == 0: |
259 if finished and process.exitCode() == 0: |
265 output = \ |
260 output = str(process.readAllStandardOutput(), |
266 str(process.readAllStandardOutput(), |
261 self.vcs.getEncoding(), 'replace') |
267 Preferences.getSystem("IOEncoding"), |
|
268 'replace') |
|
269 else: |
262 else: |
270 if not finished: |
263 if not finished: |
271 errMsg = self.tr( |
264 errMsg = self.tr( |
272 "The hg process did not finish within 30s.") |
265 "The hg process did not finish within 30s.") |
273 else: |
266 else: |
411 It reads the output of the process and inserts it into a buffer. |
404 It reads the output of the process and inserts it into a buffer. |
412 """ |
405 """ |
413 self.process.setReadChannel(QProcess.StandardOutput) |
406 self.process.setReadChannel(QProcess.StandardOutput) |
414 |
407 |
415 while self.process.canReadLine(): |
408 while self.process.canReadLine(): |
416 s = str(self.process.readLine(), |
409 s = str(self.process.readLine(), self.vcs.getEncoding(), 'replace') |
417 Preferences.getSystem("IOEncoding"), |
|
418 'replace') |
|
419 self.__processOutputLine(s) |
410 self.__processOutputLine(s) |
420 |
411 |
421 def __processOutputLine(self, line): |
412 def __processOutputLine(self, line): |
422 """ |
413 """ |
423 Private method to process the lines of output. |
414 Private method to process the lines of output. |
460 It reads the error output of the process and inserts it into the |
451 It reads the error output of the process and inserts it into the |
461 error pane. |
452 error pane. |
462 """ |
453 """ |
463 if self.process is not None: |
454 if self.process is not None: |
464 s = str(self.process.readAllStandardError(), |
455 s = str(self.process.readAllStandardError(), |
465 Preferences.getSystem("IOEncoding"), |
456 self.vcs.getEncoding(), 'replace') |
466 'replace') |
|
467 self.__showError(s) |
457 self.__showError(s) |
468 |
458 |
469 def __showError(self, out): |
459 def __showError(self, out): |
470 """ |
460 """ |
471 Private slot to show some error. |
461 Private slot to show some error. |