18 from E5Gui.E5Application import e5App |
18 from E5Gui.E5Application import e5App |
19 from E5Gui import E5MessageBox |
19 from E5Gui import E5MessageBox |
20 |
20 |
21 from .Ui_HgLogBrowserDialog import Ui_HgLogBrowserDialog |
21 from .Ui_HgLogBrowserDialog import Ui_HgLogBrowserDialog |
22 |
22 |
23 import Preferences |
|
24 import UI.PixmapCache |
23 import UI.PixmapCache |
25 |
24 |
26 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple", |
25 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple", |
27 "cyan", "olive", "magenta", "darkred", "darkmagenta", |
26 "cyan", "olive", "magenta", "darkred", "darkmagenta", |
28 "darkcyan", "gray", "yellow"] |
27 "darkcyan", "gray", "yellow"] |
435 """ |
434 """ |
436 errMsg = "" |
435 errMsg = "" |
437 parents = [-1] |
436 parents = [-1] |
438 |
437 |
439 if int(rev) > 0: |
438 if int(rev) > 0: |
440 args = [] |
439 args = self.vcs.initCommand("parents") |
441 args.append("parents") |
|
442 if self.commandMode == "incoming": |
440 if self.commandMode == "incoming": |
443 if self.__bundle: |
441 if self.__bundle: |
444 args.append("--repository") |
442 args.append("--repository") |
445 args.append(self.__bundle) |
443 args.append(self.__bundle) |
446 elif self.vcs.bundleFile and \ |
444 elif self.vcs.bundleFile and \ |
463 process.start('hg', args) |
461 process.start('hg', args) |
464 procStarted = process.waitForStarted(5000) |
462 procStarted = process.waitForStarted(5000) |
465 if procStarted: |
463 if procStarted: |
466 finished = process.waitForFinished(30000) |
464 finished = process.waitForFinished(30000) |
467 if finished and process.exitCode() == 0: |
465 if finished and process.exitCode() == 0: |
468 output = \ |
466 output = str(process.readAllStandardOutput(), |
469 str(process.readAllStandardOutput(), |
467 self.vcs.getEncoding(), 'replace') |
470 Preferences.getSystem("IOEncoding"), |
|
471 'replace') |
|
472 else: |
468 else: |
473 if not finished: |
469 if not finished: |
474 errMsg = self.tr( |
470 errMsg = self.tr( |
475 "The hg process did not finish within 30s.") |
471 "The hg process did not finish within 30s.") |
476 else: |
472 else: |
506 process.start('hg', args) |
501 process.start('hg', args) |
507 procStarted = process.waitForStarted(5000) |
502 procStarted = process.waitForStarted(5000) |
508 if procStarted: |
503 if procStarted: |
509 finished = process.waitForFinished(30000) |
504 finished = process.waitForFinished(30000) |
510 if finished and process.exitCode() == 0: |
505 if finished and process.exitCode() == 0: |
511 output = \ |
506 output = str(process.readAllStandardOutput(), |
512 str(process.readAllStandardOutput(), |
507 self.vcs.getEncoding(), 'replace') |
513 Preferences.getSystem("IOEncoding"), |
|
514 'replace') |
|
515 else: |
508 else: |
516 if not finished: |
509 if not finished: |
517 errMsg = self.tr( |
510 errMsg = self.tr( |
518 "The hg process did not finish within 30s.") |
511 "The hg process did not finish within 30s.") |
519 else: |
512 else: |
538 Private method to get the list of closed branches. |
531 Private method to get the list of closed branches. |
539 """ |
532 """ |
540 self.__closedBranchesRevs = [] |
533 self.__closedBranchesRevs = [] |
541 errMsg = "" |
534 errMsg = "" |
542 |
535 |
543 args = [] |
536 args = self.vcs.initCommand("branches") |
544 args.append("branches") |
|
545 args.append("--closed") |
537 args.append("--closed") |
546 |
538 |
547 output = "" |
539 output = "" |
548 if self.__hgClient: |
540 if self.__hgClient: |
549 output, errMsg = self.__hgClient.runcommand(args) |
541 output, errMsg = self.__hgClient.runcommand(args) |
553 process.start('hg', args) |
545 process.start('hg', args) |
554 procStarted = process.waitForStarted(5000) |
546 procStarted = process.waitForStarted(5000) |
555 if procStarted: |
547 if procStarted: |
556 finished = process.waitForFinished(30000) |
548 finished = process.waitForFinished(30000) |
557 if finished and process.exitCode() == 0: |
549 if finished and process.exitCode() == 0: |
558 output = \ |
550 output = str(process.readAllStandardOutput(), |
559 str(process.readAllStandardOutput(), |
551 self.vcs.getEncoding(), 'replace') |
560 Preferences.getSystem("IOEncoding"), |
|
561 'replace') |
|
562 else: |
552 else: |
563 if not finished: |
553 if not finished: |
564 errMsg = self.tr( |
554 errMsg = self.tr( |
565 "The hg process did not finish within 30s.") |
555 "The hg process did not finish within 30s.") |
566 else: |
556 else: |
696 self.cancelled = False |
686 self.cancelled = False |
697 self.errors.clear() |
687 self.errors.clear() |
698 self.intercept = False |
688 self.intercept = False |
699 |
689 |
700 preargs = [] |
690 preargs = [] |
701 args = [] |
691 args = self.vcs.initCommand(self.commandMode) |
702 args.append(self.commandMode) |
|
703 self.vcs.addArguments(args, self.vcs.options['global']) |
|
704 self.vcs.addArguments(args, self.vcs.options['log']) |
|
705 args.append('--verbose') |
692 args.append('--verbose') |
706 if self.commandMode not in ("incoming", "outgoing"): |
693 if self.commandMode not in ("incoming", "outgoing"): |
707 args.append('--limit') |
694 args.append('--limit') |
708 args.append(str(self.limitSpinBox.value())) |
695 args.append(str(self.limitSpinBox.value())) |
709 if self.commandMode in ("incoming", "outgoing"): |
696 if self.commandMode in ("incoming", "outgoing"): |
1024 It reads the output of the process and inserts it into a buffer. |
1011 It reads the output of the process and inserts it into a buffer. |
1025 """ |
1012 """ |
1026 self.process.setReadChannel(QProcess.StandardOutput) |
1013 self.process.setReadChannel(QProcess.StandardOutput) |
1027 |
1014 |
1028 while self.process.canReadLine(): |
1015 while self.process.canReadLine(): |
1029 line = str(self.process.readLine(), |
1016 line = str(self.process.readLine(), self.vcs.getEncoding(), |
1030 Preferences.getSystem("IOEncoding"), |
|
1031 'replace') |
1017 'replace') |
1032 self.buf.append(line) |
1018 self.buf.append(line) |
1033 |
1019 |
1034 def __readStderr(self): |
1020 def __readStderr(self): |
1035 """ |
1021 """ |
1038 It reads the error output of the process and inserts it into the |
1024 It reads the error output of the process and inserts it into the |
1039 error pane. |
1025 error pane. |
1040 """ |
1026 """ |
1041 if self.process is not None: |
1027 if self.process is not None: |
1042 s = str(self.process.readAllStandardError(), |
1028 s = str(self.process.readAllStandardError(), |
1043 Preferences.getSystem("IOEncoding"), |
1029 self.vcs.getEncoding(), 'replace') |
1044 'replace') |
|
1045 self.__showError(s) |
1030 self.__showError(s) |
1046 |
1031 |
1047 def __showError(self, out): |
1032 def __showError(self, out): |
1048 """ |
1033 """ |
1049 Private slot to show some error. |
1034 Private slot to show some error. |