461 |
461 |
462 def _vcsUpdate(self): |
462 def _vcsUpdate(self): |
463 """ |
463 """ |
464 Protected slot used to update the local project from the repository. |
464 Protected slot used to update the local project from the repository. |
465 """ |
465 """ |
|
466 if self.vcs is None: |
|
467 # just in case |
|
468 return |
|
469 |
466 shouldReopen = self.vcs.vcsUpdate(self.project.ppath) |
470 shouldReopen = self.vcs.vcsUpdate(self.project.ppath) |
467 if shouldReopen: |
471 if shouldReopen: |
468 res = E5MessageBox.yesNo( |
472 res = E5MessageBox.yesNo( |
469 self.parent(), |
473 self.parent(), |
470 QCoreApplication.translate("VcsProjectHelper", "Update"), |
474 QCoreApplication.translate("VcsProjectHelper", "Update"), |
478 def _vcsCommit(self): |
482 def _vcsCommit(self): |
479 """ |
483 """ |
480 Protected slot used to commit changes to the local project to the |
484 Protected slot used to commit changes to the local project to the |
481 repository. |
485 repository. |
482 """ |
486 """ |
|
487 if self.vcs is None: |
|
488 # just in case |
|
489 return |
|
490 |
483 if Preferences.getVCS("AutoSaveProject"): |
491 if Preferences.getVCS("AutoSaveProject"): |
484 self.project.saveProject() |
492 self.project.saveProject() |
485 if Preferences.getVCS("AutoSaveFiles"): |
493 if Preferences.getVCS("AutoSaveFiles"): |
486 self.project.saveAllScripts() |
494 self.project.saveAllScripts() |
487 self.vcs.vcsCommit(self.project.ppath, '') |
495 self.vcs.vcsCommit(self.project.ppath, '') |
491 Protected slot used to remove the local project from the repository. |
499 Protected slot used to remove the local project from the repository. |
492 |
500 |
493 Depending on the parameters set in the vcs object the project |
501 Depending on the parameters set in the vcs object the project |
494 may be removed from the local disk as well. |
502 may be removed from the local disk as well. |
495 """ |
503 """ |
|
504 if self.vcs is None: |
|
505 # just in case |
|
506 return |
|
507 |
496 res = E5MessageBox.yesNo( |
508 res = E5MessageBox.yesNo( |
497 self.parent(), |
509 self.parent(), |
498 QCoreApplication.translate( |
510 QCoreApplication.translate( |
499 "VcsProjectHelper", |
511 "VcsProjectHelper", |
500 "Remove project from repository"), |
512 "Remove project from repository"), |
513 |
525 |
514 def _vcsCommandOptions(self): |
526 def _vcsCommandOptions(self): |
515 """ |
527 """ |
516 Protected slot to edit the VCS command options. |
528 Protected slot to edit the VCS command options. |
517 """ |
529 """ |
|
530 if self.vcs is None: |
|
531 # just in case |
|
532 return |
|
533 |
518 if self.vcs.vcsSupportCommandOptions(): |
534 if self.vcs.vcsSupportCommandOptions(): |
519 from .CommandOptionsDialog import VcsCommandOptionsDialog |
535 from .CommandOptionsDialog import VcsCommandOptionsDialog |
520 codlg = VcsCommandOptionsDialog(self.vcs) |
536 codlg = VcsCommandOptionsDialog(self.vcs) |
521 if codlg.exec() == QDialog.Accepted: |
537 if codlg.exec() == QDialog.Accepted: |
522 self.vcs.vcsSetOptions(codlg.getOptions()) |
538 self.vcs.vcsSetOptions(codlg.getOptions()) |
532 def _vcsLogBrowser(self): |
548 def _vcsLogBrowser(self): |
533 """ |
549 """ |
534 Protected slot used to show the log of the local project with a |
550 Protected slot used to show the log of the local project with a |
535 log browser dialog. |
551 log browser dialog. |
536 """ |
552 """ |
|
553 if self.vcs is None: |
|
554 # just in case |
|
555 return |
|
556 |
537 self.vcs.vcsLogBrowser(self.project.ppath) |
557 self.vcs.vcsLogBrowser(self.project.ppath) |
538 |
558 |
539 def _vcsDiff(self): |
559 def _vcsDiff(self): |
540 """ |
560 """ |
541 Protected slot used to show the difference of the local project to |
561 Protected slot used to show the difference of the local project to |
542 the repository. |
562 the repository. |
543 """ |
563 """ |
|
564 if self.vcs is None: |
|
565 # just in case |
|
566 return |
|
567 |
544 self.vcs.vcsDiff(self.project.ppath) |
568 self.vcs.vcsDiff(self.project.ppath) |
545 |
569 |
546 def _vcsStatus(self): |
570 def _vcsStatus(self): |
547 """ |
571 """ |
548 Protected slot used to show the status of the local project. |
572 Protected slot used to show the status of the local project. |
549 """ |
573 """ |
|
574 if self.vcs is None: |
|
575 # just in case |
|
576 return |
|
577 |
550 self.vcs.vcsStatus(self.project.ppath) |
578 self.vcs.vcsStatus(self.project.ppath) |
551 |
579 |
552 def _vcsTag(self): |
580 def _vcsTag(self): |
553 """ |
581 """ |
554 Protected slot used to tag the local project in the repository. |
582 Protected slot used to tag the local project in the repository. |
555 """ |
583 """ |
|
584 if self.vcs is None: |
|
585 # just in case |
|
586 return |
|
587 |
556 self.vcs.vcsTag(self.project.ppath) |
588 self.vcs.vcsTag(self.project.ppath) |
557 |
589 |
558 def _vcsRevert(self): |
590 def _vcsRevert(self): |
559 """ |
591 """ |
560 Protected slot used to revert changes made to the local project. |
592 Protected slot used to revert changes made to the local project. |
561 """ |
593 """ |
|
594 if self.vcs is None: |
|
595 # just in case |
|
596 return |
|
597 |
562 self.vcs.vcsRevert(self.project.ppath) |
598 self.vcs.vcsRevert(self.project.ppath) |
563 |
599 |
564 def _vcsSwitch(self): |
600 def _vcsSwitch(self): |
565 """ |
601 """ |
566 Protected slot used to switch the local project to another tag/branch. |
602 Protected slot used to switch the local project to another tag/branch. |
567 """ |
603 """ |
|
604 if self.vcs is None: |
|
605 # just in case |
|
606 return |
|
607 |
568 shouldReopen = self.vcs.vcsSwitch(self.project.ppath) |
608 shouldReopen = self.vcs.vcsSwitch(self.project.ppath) |
569 if shouldReopen: |
609 if shouldReopen: |
570 res = E5MessageBox.yesNo( |
610 res = E5MessageBox.yesNo( |
571 self.parent(), |
611 self.parent(), |
572 QCoreApplication.translate("VcsProjectHelper", "Switch"), |
612 QCoreApplication.translate("VcsProjectHelper", "Switch"), |
580 def _vcsMerge(self): |
620 def _vcsMerge(self): |
581 """ |
621 """ |
582 Protected slot used to merge changes of a tag/revision into the local |
622 Protected slot used to merge changes of a tag/revision into the local |
583 project. |
623 project. |
584 """ |
624 """ |
|
625 if self.vcs is None: |
|
626 # just in case |
|
627 return |
|
628 |
585 self.vcs.vcsMerge(self.project.ppath) |
629 self.vcs.vcsMerge(self.project.ppath) |
586 |
630 |
587 def _vcsCleanup(self): |
631 def _vcsCleanup(self): |
588 """ |
632 """ |
589 Protected slot used to cleanup the local project. |
633 Protected slot used to cleanup the local project. |
590 """ |
634 """ |
|
635 if self.vcs is None: |
|
636 # just in case |
|
637 return |
|
638 |
591 self.vcs.vcsCleanup(self.project.ppath) |
639 self.vcs.vcsCleanup(self.project.ppath) |
592 |
640 |
593 def _vcsCommand(self): |
641 def _vcsCommand(self): |
594 """ |
642 """ |
595 Protected slot used to execute an arbitrary vcs command. |
643 Protected slot used to execute an arbitrary vcs command. |
596 """ |
644 """ |
|
645 if self.vcs is None: |
|
646 # just in case |
|
647 return |
|
648 |
597 self.vcs.vcsCommandLine(self.project.ppath) |
649 self.vcs.vcsCommandLine(self.project.ppath) |
598 |
650 |
599 def _vcsInfoDisplay(self): |
651 def _vcsInfoDisplay(self): |
600 """ |
652 """ |
601 Protected slot called to show some vcs information. |
653 Protected slot called to show some vcs information. |
602 """ |
654 """ |
|
655 if self.vcs is None: |
|
656 # just in case |
|
657 return |
|
658 |
603 from .RepositoryInfoDialog import VcsRepositoryInfoDialog |
659 from .RepositoryInfoDialog import VcsRepositoryInfoDialog |
604 info = self.vcs.vcsRepositoryInfos(self.project.ppath) |
660 info = self.vcs.vcsRepositoryInfos(self.project.ppath) |
605 dlg = VcsRepositoryInfoDialog(None, info) |
661 dlg = VcsRepositoryInfoDialog(None, info) |
606 dlg.exec() |
662 dlg.exec() |