375 args.append("-r") |
378 args.append("-r") |
376 args.append(rev) |
379 args.append(rev) |
377 if not self.projectMode: |
380 if not self.projectMode: |
378 args.append(self.filename) |
381 args.append(self.filename) |
379 |
382 |
380 process.setWorkingDirectory(self.repodir) |
383 output = "" |
381 process.start('hg', args) |
384 if self.__hgClient: |
382 procStarted = process.waitForStarted() |
385 output, errMsg = self.__hgClient.runcommand(args) |
383 if procStarted: |
386 else: |
384 finished = process.waitForFinished(30000) |
387 process = QProcess() |
385 if finished and process.exitCode() == 0: |
388 process.setWorkingDirectory(self.repodir) |
386 output = \ |
389 process.start('hg', args) |
387 str(process.readAllStandardOutput(), |
390 procStarted = process.waitForStarted() |
388 Preferences.getSystem("IOEncoding"), |
391 if procStarted: |
389 'replace') |
392 finished = process.waitForFinished(30000) |
390 parents = [int(p) for p in output.strip().splitlines()] |
393 if finished and process.exitCode() == 0: |
|
394 output = \ |
|
395 str(process.readAllStandardOutput(), |
|
396 Preferences.getSystem("IOEncoding"), |
|
397 'replace') |
|
398 else: |
|
399 if not finished: |
|
400 errMsg = self.trUtf8( |
|
401 "The hg process did not finish within 30s.") |
391 else: |
402 else: |
392 if not finished: |
403 errMsg = self.trUtf8("Could not start the hg executable.") |
393 errMsg = self.trUtf8( |
|
394 "The hg process did not finish within 30s.") |
|
395 else: |
|
396 errMsg = self.trUtf8("Could not start the hg executable.") |
|
397 |
404 |
398 if errMsg: |
405 if errMsg: |
399 E5MessageBox.critical(self, |
406 E5MessageBox.critical(self, |
400 self.trUtf8("Mercurial Error"), |
407 self.trUtf8("Mercurial Error"), |
401 errMsg) |
408 errMsg) |
402 |
409 |
|
410 if output: |
|
411 parents = [int(p) for p in output.strip().splitlines()] |
|
412 |
403 return parents |
413 return parents |
404 |
414 |
405 def __identifyProject(self): |
415 def __identifyProject(self): |
406 """ |
416 """ |
407 Private method to determine the revision of the project directory. |
417 Private method to determine the revision of the project directory. |
408 """ |
418 """ |
409 errMsg = "" |
419 errMsg = "" |
410 |
420 |
411 process = QProcess() |
|
412 args = [] |
421 args = [] |
413 args.append("identify") |
422 args.append("identify") |
414 args.append("-n") |
423 args.append("-n") |
415 |
424 |
416 process.setWorkingDirectory(self.repodir) |
425 output = "" |
417 process.start('hg', args) |
426 if self.__hgClient: |
418 procStarted = process.waitForStarted() |
427 output, errMsg = self.__hgClient.runcommand(args) |
419 if procStarted: |
428 else: |
420 finished = process.waitForFinished(30000) |
429 process = QProcess() |
421 if finished and process.exitCode() == 0: |
430 process.setWorkingDirectory(self.repodir) |
422 output = \ |
431 process.start('hg', args) |
423 str(process.readAllStandardOutput(), |
432 procStarted = process.waitForStarted() |
424 Preferences.getSystem("IOEncoding"), |
433 if procStarted: |
425 'replace') |
434 finished = process.waitForFinished(30000) |
426 self.__projectRevision = output.strip() |
435 if finished and process.exitCode() == 0: |
427 if self.__projectRevision.endswith("+"): |
436 output = \ |
428 self.__projectRevision = self.__projectRevision[:-1] |
437 str(process.readAllStandardOutput(), |
|
438 Preferences.getSystem("IOEncoding"), |
|
439 'replace') |
|
440 else: |
|
441 if not finished: |
|
442 errMsg = self.trUtf8( |
|
443 "The hg process did not finish within 30s.") |
429 else: |
444 else: |
430 if not finished: |
445 errMsg = self.trUtf8("Could not start the hg executable.") |
431 errMsg = self.trUtf8( |
|
432 "The hg process did not finish within 30s.") |
|
433 else: |
|
434 errMsg = self.trUtf8("Could not start the hg executable.") |
|
435 |
446 |
436 if errMsg: |
447 if errMsg: |
437 E5MessageBox.critical(self, |
448 E5MessageBox.critical(self, |
438 self.trUtf8("Mercurial Error"), |
449 self.trUtf8("Mercurial Error"), |
439 errMsg) |
450 errMsg) |
|
451 |
|
452 if output: |
|
453 self.__projectRevision = output.strip() |
|
454 if self.__projectRevision.endswith("+"): |
|
455 self.__projectRevision = self.__projectRevision[:-1] |
440 |
456 |
441 def __getClosedBranches(self): |
457 def __getClosedBranches(self): |
442 """ |
458 """ |
443 Private method to get the list of closed branches. |
459 Private method to get the list of closed branches. |
444 """ |
460 """ |
445 self.__closedBranchesRevs = [] |
461 self.__closedBranchesRevs = [] |
446 errMsg = "" |
462 errMsg = "" |
447 |
463 |
448 process = QProcess() |
|
449 args = [] |
464 args = [] |
450 args.append("branches") |
465 args.append("branches") |
451 args.append("--closed") |
466 args.append("--closed") |
452 |
467 |
453 process.setWorkingDirectory(self.repodir) |
468 output = "" |
454 process.start('hg', args) |
469 if self.__hgClient: |
455 procStarted = process.waitForStarted() |
470 output, errMsg = self.__hgClient.runcommand(args) |
456 if procStarted: |
471 else: |
457 finished = process.waitForFinished(30000) |
472 process = QProcess() |
458 if finished and process.exitCode() == 0: |
473 process.setWorkingDirectory(self.repodir) |
459 output = \ |
474 process.start('hg', args) |
460 str(process.readAllStandardOutput(), |
475 procStarted = process.waitForStarted() |
461 Preferences.getSystem("IOEncoding"), |
476 if procStarted: |
462 'replace') |
477 finished = process.waitForFinished(30000) |
463 for line in output.splitlines(): |
478 if finished and process.exitCode() == 0: |
464 if line.strip().endswith("(closed)"): |
479 output = \ |
465 parts = line.split() |
480 str(process.readAllStandardOutput(), |
466 self.__closedBranchesRevs.append( |
481 Preferences.getSystem("IOEncoding"), |
467 parts[-2].split(":", 1)[0]) |
482 'replace') |
|
483 else: |
|
484 if not finished: |
|
485 errMsg = self.trUtf8( |
|
486 "The hg process did not finish within 30s.") |
468 else: |
487 else: |
469 if not finished: |
488 errMsg = self.trUtf8("Could not start the hg executable.") |
470 errMsg = self.trUtf8( |
|
471 "The hg process did not finish within 30s.") |
|
472 else: |
|
473 errMsg = self.trUtf8("Could not start the hg executable.") |
|
474 |
489 |
475 if errMsg: |
490 if errMsg: |
476 E5MessageBox.critical(self, |
491 E5MessageBox.critical(self, |
477 self.trUtf8("Mercurial Error"), |
492 self.trUtf8("Mercurial Error"), |
478 errMsg) |
493 errMsg) |
|
494 |
|
495 if output: |
|
496 for line in output.splitlines(): |
|
497 if line.strip().endswith("(closed)"): |
|
498 parts = line.split() |
|
499 self.__closedBranchesRevs.append( |
|
500 parts[-2].split(":", 1)[0]) |
479 |
501 |
480 def __generateLogItem(self, author, date, message, revision, changedPaths, |
502 def __generateLogItem(self, author, date, message, revision, changedPaths, |
481 parents, branches, tags, bookmarks=None): |
503 parents, branches, tags, bookmarks=None): |
482 """ |
504 """ |
483 Private method to generate a log tree entry. |
505 Private method to generate a log tree entry. |
631 args.append('--bundle') |
647 args.append('--bundle') |
632 args.append(self.vcs.bundleFile) |
648 args.append(self.vcs.bundleFile) |
633 if not self.projectMode: |
649 if not self.projectMode: |
634 args.append(self.filename) |
650 args.append(self.filename) |
635 |
651 |
636 self.process.setWorkingDirectory(self.repodir) |
652 if self.__hgClient: |
637 |
653 out, err = self.__hgClient.runcommand(args) |
638 self.process.start('hg', args) |
654 self.buf = out.splitlines(True) |
639 procStarted = self.process.waitForStarted() |
655 if err: |
640 if not procStarted: |
656 self.__showError(err) |
641 self.inputGroup.setEnabled(False) |
657 self.__processBuffer() |
642 E5MessageBox.critical(self, |
658 self.__finish() |
643 self.trUtf8('Process Generation Error'), |
659 else: |
644 self.trUtf8( |
660 self.intercept = False |
645 'The process {0} could not be started. ' |
661 self.process.kill() |
646 'Ensure, that it is in the search path.' |
662 |
647 ).format('hg')) |
663 self.process.setWorkingDirectory(self.repodir) |
|
664 |
|
665 self.inputGroup.setEnabled(True) |
|
666 self.inputGroup.show() |
|
667 |
|
668 self.process.start('hg', args) |
|
669 procStarted = self.process.waitForStarted() |
|
670 if not procStarted: |
|
671 self.inputGroup.setEnabled(False) |
|
672 E5MessageBox.critical(self, |
|
673 self.trUtf8('Process Generation Error'), |
|
674 self.trUtf8( |
|
675 'The process {0} could not be started. ' |
|
676 'Ensure, that it is in the search path.' |
|
677 ).format('hg')) |
648 |
678 |
649 def start(self, fn): |
679 def start(self, fn): |
650 """ |
680 """ |
651 Public slot to start the hg log command. |
681 Public slot to start the hg log command. |
652 |
682 |