15 from PyQt6.QtWidgets import ( |
15 from PyQt6.QtWidgets import ( |
16 QWidget, QHeaderView, QLineEdit, QApplication, QMenu, QDialogButtonBox, |
16 QWidget, QHeaderView, QLineEdit, QApplication, QMenu, QDialogButtonBox, |
17 QTreeWidgetItem |
17 QTreeWidgetItem |
18 ) |
18 ) |
19 |
19 |
20 from E5Gui.E5Application import e5App |
20 from E5Gui.EricApplication import ericApp |
21 from E5Gui import E5MessageBox |
21 from E5Gui import EricMessageBox |
22 |
22 |
23 from .Ui_SvnStatusDialog import Ui_SvnStatusDialog |
23 from .Ui_SvnStatusDialog import Ui_SvnStatusDialog |
24 |
24 |
25 import Preferences |
25 import Preferences |
26 from Globals import strToQByteArray |
26 from Globals import strToQByteArray |
408 self.process.start('svn', args) |
408 self.process.start('svn', args) |
409 procStarted = self.process.waitForStarted(5000) |
409 procStarted = self.process.waitForStarted(5000) |
410 if not procStarted: |
410 if not procStarted: |
411 self.inputGroup.setEnabled(False) |
411 self.inputGroup.setEnabled(False) |
412 self.inputGroup.hide() |
412 self.inputGroup.hide() |
413 E5MessageBox.critical( |
413 EricMessageBox.critical( |
414 self, |
414 self, |
415 self.tr('Process Generation Error'), |
415 self.tr('Process Generation Error'), |
416 self.tr( |
416 self.tr( |
417 'The process {0} could not be started. ' |
417 'The process {0} could not be started. ' |
418 'Ensure, that it is in the search path.' |
418 'Ensure, that it is in the search path.' |
739 Private slot to handle the Commit context menu entry. |
739 Private slot to handle the Commit context menu entry. |
740 """ |
740 """ |
741 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
741 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
742 for itm in self.__getCommitableItems()] |
742 for itm in self.__getCommitableItems()] |
743 if not names: |
743 if not names: |
744 E5MessageBox.information( |
744 EricMessageBox.information( |
745 self, |
745 self, |
746 self.tr("Commit"), |
746 self.tr("Commit"), |
747 self.tr("""There are no entries selected to be""" |
747 self.tr("""There are no entries selected to be""" |
748 """ committed.""")) |
748 """ committed.""")) |
749 return |
749 return |
750 |
750 |
751 if Preferences.getVCS("AutoSaveFiles"): |
751 if Preferences.getVCS("AutoSaveFiles"): |
752 vm = e5App().getObject("ViewManager") |
752 vm = ericApp().getObject("ViewManager") |
753 for name in names: |
753 for name in names: |
754 vm.saveEditor(name) |
754 vm.saveEditor(name) |
755 self.vcs.vcsCommit(names, '') |
755 self.vcs.vcsCommit(names, '') |
756 |
756 |
757 def __committed(self): |
757 def __committed(self): |
779 Private slot to handle the Add context menu entry. |
779 Private slot to handle the Add context menu entry. |
780 """ |
780 """ |
781 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
781 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
782 for itm in self.__getUnversionedItems()] |
782 for itm in self.__getUnversionedItems()] |
783 if not names: |
783 if not names: |
784 E5MessageBox.information( |
784 EricMessageBox.information( |
785 self, |
785 self, |
786 self.tr("Add"), |
786 self.tr("Add"), |
787 self.tr("""There are no unversioned entries""" |
787 self.tr("""There are no unversioned entries""" |
788 """ available/selected.""")) |
788 """ available/selected.""")) |
789 return |
789 return |
790 |
790 |
791 self.vcs.vcsAdd(names) |
791 self.vcs.vcsAdd(names) |
792 self.on_refreshButton_clicked() |
792 self.on_refreshButton_clicked() |
793 |
793 |
794 project = e5App().getObject("Project") |
794 project = ericApp().getObject("Project") |
795 for name in names: |
795 for name in names: |
796 project.getModel().updateVCSStatus(name) |
796 project.getModel().updateVCSStatus(name) |
797 self.vcs.checkVCSStatus() |
797 self.vcs.checkVCSStatus() |
798 |
798 |
799 def __revert(self): |
799 def __revert(self): |
801 Private slot to handle the Revert context menu entry. |
801 Private slot to handle the Revert context menu entry. |
802 """ |
802 """ |
803 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
803 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
804 for itm in self.__getModifiedItems()] |
804 for itm in self.__getModifiedItems()] |
805 if not names: |
805 if not names: |
806 E5MessageBox.information( |
806 EricMessageBox.information( |
807 self, |
807 self, |
808 self.tr("Revert"), |
808 self.tr("Revert"), |
809 self.tr("""There are no uncommitted changes""" |
809 self.tr("""There are no uncommitted changes""" |
810 """ available/selected.""")) |
810 """ available/selected.""")) |
811 return |
811 return |
813 self.vcs.vcsRevert(names) |
813 self.vcs.vcsRevert(names) |
814 self.raise_() |
814 self.raise_() |
815 self.activateWindow() |
815 self.activateWindow() |
816 self.on_refreshButton_clicked() |
816 self.on_refreshButton_clicked() |
817 |
817 |
818 project = e5App().getObject("Project") |
818 project = ericApp().getObject("Project") |
819 for name in names: |
819 for name in names: |
820 project.getModel().updateVCSStatus(name) |
820 project.getModel().updateVCSStatus(name) |
821 self.vcs.checkVCSStatus() |
821 self.vcs.checkVCSStatus() |
822 |
822 |
823 def __restoreMissing(self): |
823 def __restoreMissing(self): |
825 Private slot to handle the Restore Missing context menu entry. |
825 Private slot to handle the Restore Missing context menu entry. |
826 """ |
826 """ |
827 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
827 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
828 for itm in self.__getMissingItems()] |
828 for itm in self.__getMissingItems()] |
829 if not names: |
829 if not names: |
830 E5MessageBox.information( |
830 EricMessageBox.information( |
831 self, |
831 self, |
832 self.tr("Revert"), |
832 self.tr("Revert"), |
833 self.tr("""There are no missing entries""" |
833 self.tr("""There are no missing entries""" |
834 """ available/selected.""")) |
834 """ available/selected.""")) |
835 return |
835 return |
843 Private slot to handle the Diff context menu entry. |
843 Private slot to handle the Diff context menu entry. |
844 """ |
844 """ |
845 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
845 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
846 for itm in self.__getModifiedItems()] |
846 for itm in self.__getModifiedItems()] |
847 if not names: |
847 if not names: |
848 E5MessageBox.information( |
848 EricMessageBox.information( |
849 self, |
849 self, |
850 self.tr("Differences"), |
850 self.tr("Differences"), |
851 self.tr("""There are no uncommitted changes""" |
851 self.tr("""There are no uncommitted changes""" |
852 """ available/selected.""")) |
852 """ available/selected.""")) |
853 return |
853 return |
864 Private slot to handle the Side-by-Side Diff context menu entry. |
864 Private slot to handle the Side-by-Side Diff context menu entry. |
865 """ |
865 """ |
866 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
866 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
867 for itm in self.__getModifiedItems()] |
867 for itm in self.__getModifiedItems()] |
868 if not names: |
868 if not names: |
869 E5MessageBox.information( |
869 EricMessageBox.information( |
870 self, |
870 self, |
871 self.tr("Side-by-Side Diff"), |
871 self.tr("Side-by-Side Diff"), |
872 self.tr("""There are no uncommitted changes""" |
872 self.tr("""There are no uncommitted changes""" |
873 """ available/selected.""")) |
873 """ available/selected.""")) |
874 return |
874 return |
875 elif len(names) > 1: |
875 elif len(names) > 1: |
876 E5MessageBox.information( |
876 EricMessageBox.information( |
877 self, |
877 self, |
878 self.tr("Side-by-Side Diff"), |
878 self.tr("Side-by-Side Diff"), |
879 self.tr("""Only one file with uncommitted changes""" |
879 self.tr("""Only one file with uncommitted changes""" |
880 """ must be selected.""")) |
880 """ must be selected.""")) |
881 return |
881 return |
887 Private slot to handle the Lock context menu entry. |
887 Private slot to handle the Lock context menu entry. |
888 """ |
888 """ |
889 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
889 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
890 for itm in self.__getLockActionItems(self.unlockedIndicators)] |
890 for itm in self.__getLockActionItems(self.unlockedIndicators)] |
891 if not names: |
891 if not names: |
892 E5MessageBox.information( |
892 EricMessageBox.information( |
893 self, |
893 self, |
894 self.tr("Lock"), |
894 self.tr("Lock"), |
895 self.tr("""There are no unlocked files""" |
895 self.tr("""There are no unlocked files""" |
896 """ available/selected.""")) |
896 """ available/selected.""")) |
897 return |
897 return |
904 Private slot to handle the Unlock context menu entry. |
904 Private slot to handle the Unlock context menu entry. |
905 """ |
905 """ |
906 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
906 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
907 for itm in self.__getLockActionItems(self.lockedIndicators)] |
907 for itm in self.__getLockActionItems(self.lockedIndicators)] |
908 if not names: |
908 if not names: |
909 E5MessageBox.information( |
909 EricMessageBox.information( |
910 self, |
910 self, |
911 self.tr("Unlock"), |
911 self.tr("Unlock"), |
912 self.tr("""There are no locked files""" |
912 self.tr("""There are no locked files""" |
913 """ available/selected.""")) |
913 """ available/selected.""")) |
914 return |
914 return |
922 """ |
922 """ |
923 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
923 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
924 for itm in self.__getLockActionItems( |
924 for itm in self.__getLockActionItems( |
925 self.stealBreakLockIndicators)] |
925 self.stealBreakLockIndicators)] |
926 if not names: |
926 if not names: |
927 E5MessageBox.information( |
927 EricMessageBox.information( |
928 self, |
928 self, |
929 self.tr("Break Lock"), |
929 self.tr("Break Lock"), |
930 self.tr("""There are no locked files""" |
930 self.tr("""There are no locked files""" |
931 """ available/selected.""")) |
931 """ available/selected.""")) |
932 return |
932 return |
940 """ |
940 """ |
941 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
941 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
942 for itm in self.__getLockActionItems( |
942 for itm in self.__getLockActionItems( |
943 self.stealBreakLockIndicators)] |
943 self.stealBreakLockIndicators)] |
944 if not names: |
944 if not names: |
945 E5MessageBox.information( |
945 EricMessageBox.information( |
946 self, |
946 self, |
947 self.tr("Steal Lock"), |
947 self.tr("Steal Lock"), |
948 self.tr("""There are no locked files""" |
948 self.tr("""There are no locked files""" |
949 """ available/selected.""")) |
949 """ available/selected.""")) |
950 return |
950 return |
957 Private slot to add entries to a changelist. |
957 Private slot to add entries to a changelist. |
958 """ |
958 """ |
959 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
959 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
960 for itm in self.__getNonChangelistItems()] |
960 for itm in self.__getNonChangelistItems()] |
961 if not names: |
961 if not names: |
962 E5MessageBox.information( |
962 EricMessageBox.information( |
963 self, |
963 self, |
964 self.tr("Remove from Changelist"), |
964 self.tr("Remove from Changelist"), |
965 self.tr( |
965 self.tr( |
966 """There are no files available/selected not """ |
966 """There are no files available/selected not """ |
967 """belonging to a changelist.""" |
967 """belonging to a changelist.""" |
976 Private slot to remove entries from their changelists. |
976 Private slot to remove entries from their changelists. |
977 """ |
977 """ |
978 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
978 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
979 for itm in self.__getChangelistItems()] |
979 for itm in self.__getChangelistItems()] |
980 if not names: |
980 if not names: |
981 E5MessageBox.information( |
981 EricMessageBox.information( |
982 self, |
982 self, |
983 self.tr("Remove from Changelist"), |
983 self.tr("Remove from Changelist"), |
984 self.tr( |
984 self.tr( |
985 """There are no files available/selected belonging""" |
985 """There are no files available/selected belonging""" |
986 """ to a changelist.""" |
986 """ to a changelist.""" |