eric7/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8354
12ebd3934fef
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
16 from PyQt6.QtWidgets import ( 16 from PyQt6.QtWidgets import (
17 QWidget, QHeaderView, QApplication, QMenu, QDialogButtonBox, 17 QWidget, QHeaderView, QApplication, QMenu, QDialogButtonBox,
18 QTreeWidgetItem 18 QTreeWidgetItem
19 ) 19 )
20 20
21 from E5Gui.E5Application import e5App 21 from E5Gui.EricApplication import ericApp
22 from E5Gui import E5MessageBox 22 from E5Gui import EricMessageBox
23 from E5Gui.E5OverrideCursor import E5OverrideCursor 23 from E5Gui.EricOverrideCursor import EricOverrideCursor
24 24
25 from EricUtilities.EricMutexLocker import EricMutexLocker 25 from EricUtilities.EricMutexLocker import EricMutexLocker
26 26
27 from .SvnConst import svnStatusMap 27 from .SvnConst import svnStatusMap
28 from .SvnDialogMixin import SvnDialogMixin 28 from .SvnDialogMixin import SvnDialogMixin
317 hideLockColumns = True 317 hideLockColumns = True
318 hideUpToDateColumn = True 318 hideUpToDateColumn = True
319 hideHistoryColumn = True 319 hideHistoryColumn = True
320 hideSwitchedColumn = True 320 hideSwitchedColumn = True
321 321
322 with E5OverrideCursor(): 322 with EricOverrideCursor():
323 cwd = os.getcwd() 323 cwd = os.getcwd()
324 os.chdir(self.dname) 324 os.chdir(self.dname)
325 try: 325 try:
326 with EricMutexLocker(self.vcs.vcsExecutionMutex): 326 with EricMutexLocker(self.vcs.vcsExecutionMutex):
327 for name in fnames: 327 for name in fnames:
643 Private slot to handle the Commit context menu entry. 643 Private slot to handle the Commit context menu entry.
644 """ 644 """
645 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 645 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
646 for itm in self.__getCommitableItems()] 646 for itm in self.__getCommitableItems()]
647 if not names: 647 if not names:
648 E5MessageBox.information( 648 EricMessageBox.information(
649 self, 649 self,
650 self.tr("Commit"), 650 self.tr("Commit"),
651 self.tr("""There are no entries selected to be""" 651 self.tr("""There are no entries selected to be"""
652 """ committed.""")) 652 """ committed."""))
653 return 653 return
654 654
655 if Preferences.getVCS("AutoSaveFiles"): 655 if Preferences.getVCS("AutoSaveFiles"):
656 vm = e5App().getObject("ViewManager") 656 vm = ericApp().getObject("ViewManager")
657 for name in names: 657 for name in names:
658 vm.saveEditor(name) 658 vm.saveEditor(name)
659 self.vcs.vcsCommit(names, '') 659 self.vcs.vcsCommit(names, '')
660 660
661 def __committed(self): 661 def __committed(self):
683 Private slot to handle the Add context menu entry. 683 Private slot to handle the Add context menu entry.
684 """ 684 """
685 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 685 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
686 for itm in self.__getUnversionedItems()] 686 for itm in self.__getUnversionedItems()]
687 if not names: 687 if not names:
688 E5MessageBox.information( 688 EricMessageBox.information(
689 self, 689 self,
690 self.tr("Add"), 690 self.tr("Add"),
691 self.tr("""There are no unversioned entries""" 691 self.tr("""There are no unversioned entries"""
692 """ available/selected.""")) 692 """ available/selected."""))
693 return 693 return
694 694
695 self.vcs.vcsAdd(names) 695 self.vcs.vcsAdd(names)
696 self.on_refreshButton_clicked() 696 self.on_refreshButton_clicked()
697 697
698 project = e5App().getObject("Project") 698 project = ericApp().getObject("Project")
699 for name in names: 699 for name in names:
700 project.getModel().updateVCSStatus(name) 700 project.getModel().updateVCSStatus(name)
701 self.vcs.checkVCSStatus() 701 self.vcs.checkVCSStatus()
702 702
703 def __revert(self): 703 def __revert(self):
705 Private slot to handle the Revert context menu entry. 705 Private slot to handle the Revert context menu entry.
706 """ 706 """
707 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 707 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
708 for itm in self.__getModifiedItems()] 708 for itm in self.__getModifiedItems()]
709 if not names: 709 if not names:
710 E5MessageBox.information( 710 EricMessageBox.information(
711 self, 711 self,
712 self.tr("Revert"), 712 self.tr("Revert"),
713 self.tr("""There are no uncommitted changes""" 713 self.tr("""There are no uncommitted changes"""
714 """ available/selected.""")) 714 """ available/selected."""))
715 return 715 return
717 self.vcs.vcsRevert(names) 717 self.vcs.vcsRevert(names)
718 self.raise_() 718 self.raise_()
719 self.activateWindow() 719 self.activateWindow()
720 self.on_refreshButton_clicked() 720 self.on_refreshButton_clicked()
721 721
722 project = e5App().getObject("Project") 722 project = ericApp().getObject("Project")
723 for name in names: 723 for name in names:
724 project.getModel().updateVCSStatus(name) 724 project.getModel().updateVCSStatus(name)
725 self.vcs.checkVCSStatus() 725 self.vcs.checkVCSStatus()
726 726
727 def __restoreMissing(self): 727 def __restoreMissing(self):
729 Private slot to handle the Restore Missing context menu entry. 729 Private slot to handle the Restore Missing context menu entry.
730 """ 730 """
731 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 731 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
732 for itm in self.__getMissingItems()] 732 for itm in self.__getMissingItems()]
733 if not names: 733 if not names:
734 E5MessageBox.information( 734 EricMessageBox.information(
735 self, 735 self,
736 self.tr("Revert"), 736 self.tr("Revert"),
737 self.tr("""There are no missing entries""" 737 self.tr("""There are no missing entries"""
738 """ available/selected.""")) 738 """ available/selected."""))
739 return 739 return
747 Private slot to handle the Diff context menu entry. 747 Private slot to handle the Diff context menu entry.
748 """ 748 """
749 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 749 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
750 for itm in self.__getModifiedItems()] 750 for itm in self.__getModifiedItems()]
751 if not names: 751 if not names:
752 E5MessageBox.information( 752 EricMessageBox.information(
753 self, 753 self,
754 self.tr("Differences"), 754 self.tr("Differences"),
755 self.tr("""There are no uncommitted changes""" 755 self.tr("""There are no uncommitted changes"""
756 """ available/selected.""")) 756 """ available/selected."""))
757 return 757 return
768 Private slot to handle the Side-by-Side Diff context menu entry. 768 Private slot to handle the Side-by-Side Diff context menu entry.
769 """ 769 """
770 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 770 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
771 for itm in self.__getModifiedItems()] 771 for itm in self.__getModifiedItems()]
772 if not names: 772 if not names:
773 E5MessageBox.information( 773 EricMessageBox.information(
774 self, 774 self,
775 self.tr("Side-by-Side Diff"), 775 self.tr("Side-by-Side Diff"),
776 self.tr("""There are no uncommitted changes""" 776 self.tr("""There are no uncommitted changes"""
777 """ available/selected.""")) 777 """ available/selected."""))
778 return 778 return
779 elif len(names) > 1: 779 elif len(names) > 1:
780 E5MessageBox.information( 780 EricMessageBox.information(
781 self, 781 self,
782 self.tr("Side-by-Side Diff"), 782 self.tr("Side-by-Side Diff"),
783 self.tr("""Only one file with uncommitted changes""" 783 self.tr("""Only one file with uncommitted changes"""
784 """ must be selected.""")) 784 """ must be selected."""))
785 return 785 return
791 Private slot to handle the Lock context menu entry. 791 Private slot to handle the Lock context menu entry.
792 """ 792 """
793 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 793 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
794 for itm in self.__getLockActionItems(self.unlockedIndicators)] 794 for itm in self.__getLockActionItems(self.unlockedIndicators)]
795 if not names: 795 if not names:
796 E5MessageBox.information( 796 EricMessageBox.information(
797 self, 797 self,
798 self.tr("Lock"), 798 self.tr("Lock"),
799 self.tr("""There are no unlocked files""" 799 self.tr("""There are no unlocked files"""
800 """ available/selected.""")) 800 """ available/selected."""))
801 return 801 return
808 Private slot to handle the Unlock context menu entry. 808 Private slot to handle the Unlock context menu entry.
809 """ 809 """
810 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 810 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
811 for itm in self.__getLockActionItems(self.lockedIndicators)] 811 for itm in self.__getLockActionItems(self.lockedIndicators)]
812 if not names: 812 if not names:
813 E5MessageBox.information( 813 EricMessageBox.information(
814 self, 814 self,
815 self.tr("Unlock"), 815 self.tr("Unlock"),
816 self.tr("""There are no locked files""" 816 self.tr("""There are no locked files"""
817 """ available/selected.""")) 817 """ available/selected."""))
818 return 818 return
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.__getLockActionItems( 828 for itm in self.__getLockActionItems(
829 self.stealBreakLockIndicators)] 829 self.stealBreakLockIndicators)]
830 if not names: 830 if not names:
831 E5MessageBox.information( 831 EricMessageBox.information(
832 self, 832 self,
833 self.tr("Break Lock"), 833 self.tr("Break Lock"),
834 self.tr("""There are no locked files""" 834 self.tr("""There are no locked files"""
835 """ available/selected.""")) 835 """ available/selected."""))
836 return 836 return
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.__getLockActionItems( 846 for itm in self.__getLockActionItems(
847 self.stealBreakLockIndicators)] 847 self.stealBreakLockIndicators)]
848 if not names: 848 if not names:
849 E5MessageBox.information( 849 EricMessageBox.information(
850 self, 850 self,
851 self.tr("Steal Lock"), 851 self.tr("Steal Lock"),
852 self.tr("""There are no locked files""" 852 self.tr("""There are no locked files"""
853 """ available/selected.""")) 853 """ available/selected."""))
854 return 854 return
861 Private slot to add entries to a changelist. 861 Private slot to add entries to a changelist.
862 """ 862 """
863 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 863 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
864 for itm in self.__getNonChangelistItems()] 864 for itm in self.__getNonChangelistItems()]
865 if not names: 865 if not names:
866 E5MessageBox.information( 866 EricMessageBox.information(
867 self, 867 self,
868 self.tr("Remove from Changelist"), 868 self.tr("Remove from Changelist"),
869 self.tr( 869 self.tr(
870 """There are no files available/selected not """ 870 """There are no files available/selected not """
871 """belonging to a changelist.""" 871 """belonging to a changelist."""
880 Private slot to remove entries from their changelists. 880 Private slot to remove entries from their changelists.
881 """ 881 """
882 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) 882 names = [os.path.join(self.dname, itm.text(self.__pathColumn))
883 for itm in self.__getChangelistItems()] 883 for itm in self.__getChangelistItems()]
884 if not names: 884 if not names:
885 E5MessageBox.information( 885 EricMessageBox.information(
886 self, 886 self,
887 self.tr("Remove from Changelist"), 887 self.tr("Remove from Changelist"),
888 self.tr( 888 self.tr(
889 """There are no files available/selected belonging""" 889 """There are no files available/selected belonging"""
890 """ to a changelist.""" 890 """ to a changelist."""

eric ide

mercurial