Plugins/VcsPlugins/vcsSubversion/subversion.py

changeset 2406
975af671146d
parent 2352
21971ebfaaef
child 2451
4d80de2f9122
equal deleted inserted replaced
2405:d4b5f3bd4720 2406:975af671146d
21 from E5Gui import E5MessageBox 21 from E5Gui import E5MessageBox
22 22
23 from VCS.VersionControl import VersionControl 23 from VCS.VersionControl import VersionControl
24 24
25 from .SvnDialog import SvnDialog 25 from .SvnDialog import SvnDialog
26 from .SvnCommitDialog import SvnCommitDialog
27 from .SvnLogDialog import SvnLogDialog
28 from .SvnLogBrowserDialog import SvnLogBrowserDialog
29 from .SvnDiffDialog import SvnDiffDialog
30 from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog
31 from .SvnStatusDialog import SvnStatusDialog
32 from .SvnTagDialog import SvnTagDialog
33 from .SvnTagBranchListDialog import SvnTagBranchListDialog
34 from .SvnCopyDialog import SvnCopyDialog
35 from .SvnCommandDialog import SvnCommandDialog
36 from .SvnSwitchDialog import SvnSwitchDialog
37 from .SvnMergeDialog import SvnMergeDialog
38 from .SvnPropListDialog import SvnPropListDialog
39 from .SvnPropSetDialog import SvnPropSetDialog
40 from .SvnOptionsDialog import SvnOptionsDialog
41 from .SvnNewProjectOptionsDialog import SvnNewProjectOptionsDialog
42 from .SvnBlameDialog import SvnBlameDialog
43 from .SvnRelocateDialog import SvnRelocateDialog
44 from .SvnUrlSelectionDialog import SvnUrlSelectionDialog
45 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog
46 from .SvnChangeListsDialog import SvnChangeListsDialog
47 from .SvnStatusMonitorThread import SvnStatusMonitorThread
48 from .SvnUtilities import getConfigPath, amendConfig, createDefaultConfig 26 from .SvnUtilities import getConfigPath, amendConfig, createDefaultConfig
49
50 from .ProjectBrowserHelper import SvnProjectBrowserHelper
51
52 from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
53 27
54 import Preferences 28 import Preferences
55 import Utilities 29 import Utilities
56 30
57 31
444 msg = message 418 msg = message
445 419
446 if not noDialog and not msg: 420 if not noDialog and not msg:
447 # call CommitDialog and get message from there 421 # call CommitDialog and get message from there
448 if self.__commitDialog is None: 422 if self.__commitDialog is None:
423 from .SvnCommitDialog import SvnCommitDialog
449 self.__commitDialog = SvnCommitDialog(self, self.__ui) 424 self.__commitDialog = SvnCommitDialog(self, self.__ui)
450 self.__commitDialog.accepted.connect(self.__vcsCommit_Step2) 425 self.__commitDialog.accepted.connect(self.__vcsCommit_Step2)
451 self.__commitDialog.show() 426 self.__commitDialog.show()
452 self.__commitDialog.raise_() 427 self.__commitDialog.raise_()
453 self.__commitDialog.activateWindow() 428 self.__commitDialog.activateWindow()
803 if target is None: 778 if target is None:
804 return False 779 return False
805 force = True 780 force = True
806 accepted = True 781 accepted = True
807 else: 782 else:
783 from .SvnCopyDialog import SvnCopyDialog
808 dlg = SvnCopyDialog(name, None, True, force) 784 dlg = SvnCopyDialog(name, None, True, force)
809 accepted = (dlg.exec_() == QDialog.Accepted) 785 accepted = (dlg.exec_() == QDialog.Accepted)
810 if accepted: 786 if accepted:
811 target, force = dlg.getData() 787 target, force = dlg.getData()
812 788
861 None, 837 None,
862 self.trUtf8("Subversion Log"), 838 self.trUtf8("Subversion Log"),
863 self.trUtf8("Select number of entries to show."), 839 self.trUtf8("Select number of entries to show."),
864 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1) 840 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1)
865 if ok: 841 if ok:
842 from .SvnLogDialog import SvnLogDialog
866 self.log = SvnLogDialog(self) 843 self.log = SvnLogDialog(self)
867 self.log.show() 844 self.log.show()
868 self.log.start(name, noEntries) 845 self.log.start(name, noEntries)
869 846
870 def vcsDiff(self, name): 847 def vcsDiff(self, name):
889 return 866 return
890 else: 867 else:
891 project = e5App().getObject("Project") 868 project = e5App().getObject("Project")
892 if nam == project.ppath and not project.saveAllScripts(): 869 if nam == project.ppath and not project.saveAllScripts():
893 return 870 return
871 from .SvnDiffDialog import SvnDiffDialog
894 self.diff = SvnDiffDialog(self) 872 self.diff = SvnDiffDialog(self)
895 self.diff.show() 873 self.diff.show()
896 QApplication.processEvents() 874 QApplication.processEvents()
897 self.diff.start(name) 875 self.diff.start(name)
898 876
902 Subversion repository. 880 Subversion repository.
903 881
904 @param name file/directory name(s) to show the status of 882 @param name file/directory name(s) to show the status of
905 (string or list of strings) 883 (string or list of strings)
906 """ 884 """
885 from .SvnStatusDialog import SvnStatusDialog
907 self.status = SvnStatusDialog(self) 886 self.status = SvnStatusDialog(self)
908 self.status.show() 887 self.status.show()
909 self.status.start(name) 888 self.status.start(name)
910 889
911 def vcsTag(self, name): 890 def vcsTag(self, name):
928 907
929 if self.otherData["standardLayout"]: 908 if self.otherData["standardLayout"]:
930 url = None 909 url = None
931 else: 910 else:
932 url = self.svnNormalizeURL(reposURL) 911 url = self.svnNormalizeURL(reposURL)
912 from .SvnTagDialog import SvnTagDialog
933 dlg = SvnTagDialog(self.allTagsBranchesList, url, 913 dlg = SvnTagDialog(self.allTagsBranchesList, url,
934 self.otherData["standardLayout"]) 914 self.otherData["standardLayout"])
935 if dlg.exec_() == QDialog.Accepted: 915 if dlg.exec_() == QDialog.Accepted:
936 tag, tagOp = dlg.getParameters() 916 tag, tagOp = dlg.getParameters()
937 if tag in self.allTagsBranchesList: 917 if tag in self.allTagsBranchesList:
1000 names = [name] 980 names = [name]
1001 981
1002 project = e5App().getObject("Project") 982 project = e5App().getObject("Project")
1003 names = [project.getRelativePath(nam) for nam in names] 983 names = [project.getRelativePath(nam) for nam in names]
1004 if names[0]: 984 if names[0]:
985 from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
1005 dlg = DeleteFilesConfirmationDialog(self.parent(), 986 dlg = DeleteFilesConfirmationDialog(self.parent(),
1006 self.trUtf8("Revert changes"), 987 self.trUtf8("Revert changes"),
1007 self.trUtf8("Do you really want to revert all changes to these files" 988 self.trUtf8("Do you really want to revert all changes to these files"
1008 " or directories?"), 989 " or directories?"),
1009 names) 990 names)
1039 1020
1040 if self.otherData["standardLayout"]: 1021 if self.otherData["standardLayout"]:
1041 url = None 1022 url = None
1042 else: 1023 else:
1043 url = self.svnNormalizeURL(reposURL) 1024 url = self.svnNormalizeURL(reposURL)
1025 from .SvnSwitchDialog import SvnSwitchDialog
1044 dlg = SvnSwitchDialog(self.allTagsBranchesList, url, 1026 dlg = SvnSwitchDialog(self.allTagsBranchesList, url,
1045 self.otherData["standardLayout"]) 1027 self.otherData["standardLayout"])
1046 if dlg.exec_() == QDialog.Accepted: 1028 if dlg.exec_() == QDialog.Accepted:
1047 tag, tagType = dlg.getParameters() 1029 tag, tagType = dlg.getParameters()
1048 if tag in self.allTagsBranchesList: 1030 if tag in self.allTagsBranchesList:
1102 opts = self.options['global'][:] 1084 opts = self.options['global'][:]
1103 force = '--force' in opts 1085 force = '--force' in opts
1104 if force: 1086 if force:
1105 del opts[opts.index('--force')] 1087 del opts[opts.index('--force')]
1106 1088
1089 from .SvnMergeDialog import SvnMergeDialog
1107 dlg = SvnMergeDialog(self.mergeList[0], self.mergeList[1], self.mergeList[2], 1090 dlg = SvnMergeDialog(self.mergeList[0], self.mergeList[1], self.mergeList[2],
1108 force) 1091 force)
1109 if dlg.exec_() == QDialog.Accepted: 1092 if dlg.exec_() == QDialog.Accepted:
1110 urlrev1, urlrev2, target, force = dlg.getParameters() 1093 urlrev1, urlrev2, target, force = dlg.getParameters()
1111 else: 1094 else:
1419 """ 1402 """
1420 Public method used to execute arbitrary subversion commands. 1403 Public method used to execute arbitrary subversion commands.
1421 1404
1422 @param name directory name of the working directory (string) 1405 @param name directory name of the working directory (string)
1423 """ 1406 """
1407 from .SvnCommandDialog import SvnCommandDialog
1424 dlg = SvnCommandDialog(self.commandHistory, self.wdHistory, name) 1408 dlg = SvnCommandDialog(self.commandHistory, self.wdHistory, name)
1425 if dlg.exec_() == QDialog.Accepted: 1409 if dlg.exec_() == QDialog.Accepted:
1426 command, wd = dlg.getData() 1410 command, wd = dlg.getData()
1427 commandList = Utilities.parseOptionString(command) 1411 commandList = Utilities.parseOptionString(command)
1428 1412
1450 @param project reference to the project object 1434 @param project reference to the project object
1451 @param archive name of the project in the repository (string) 1435 @param archive name of the project in the repository (string)
1452 @param editable flag indicating that the project name is editable (boolean) 1436 @param editable flag indicating that the project name is editable (boolean)
1453 @param parent parent widget (QWidget) 1437 @param parent parent widget (QWidget)
1454 """ 1438 """
1439 from .SvnOptionsDialog import SvnOptionsDialog
1455 return SvnOptionsDialog(self, project, parent) 1440 return SvnOptionsDialog(self, project, parent)
1456 1441
1457 def vcsNewProjectOptionsDialog(self, parent=None): 1442 def vcsNewProjectOptionsDialog(self, parent=None):
1458 """ 1443 """
1459 Public method to get a dialog to enter repository info for getting a new project. 1444 Public method to get a dialog to enter repository info for getting a new project.
1460 1445
1461 @param parent parent widget (QWidget) 1446 @param parent parent widget (QWidget)
1462 """ 1447 """
1448 from .SvnNewProjectOptionsDialog import SvnNewProjectOptionsDialog
1463 return SvnNewProjectOptionsDialog(self, parent) 1449 return SvnNewProjectOptionsDialog(self, parent)
1464 1450
1465 def vcsRepositoryInfos(self, ppath): 1451 def vcsRepositoryInfos(self, ppath):
1466 """ 1452 """
1467 Public method to retrieve information about the repository. 1453 Public method to retrieve information about the repository.
1608 1594
1609 @param name file/directory name to be copied (string) 1595 @param name file/directory name to be copied (string)
1610 @param project reference to the project object 1596 @param project reference to the project object
1611 @return flag indicating successfull operation (boolean) 1597 @return flag indicating successfull operation (boolean)
1612 """ 1598 """
1599 from .SvnCopyDialog import SvnCopyDialog
1613 rx_prot = QRegExp('(file:|svn:|svn+ssh:|http:|https:).+') 1600 rx_prot = QRegExp('(file:|svn:|svn+ssh:|http:|https:).+')
1614 dlg = SvnCopyDialog(name) 1601 dlg = SvnCopyDialog(name)
1615 res = False 1602 res = False
1616 if dlg.exec_() == QDialog.Accepted: 1603 if dlg.exec_() == QDialog.Accepted:
1617 target, force = dlg.getData() 1604 target, force = dlg.getData()
1646 Public method used to list the properties of a file/directory. 1633 Public method used to list the properties of a file/directory.
1647 1634
1648 @param name file/directory name (string or list of strings) 1635 @param name file/directory name (string or list of strings)
1649 @param recursive flag indicating a recursive list is requested 1636 @param recursive flag indicating a recursive list is requested
1650 """ 1637 """
1638 from .SvnPropListDialog import SvnPropListDialog
1651 self.propList = SvnPropListDialog(self) 1639 self.propList = SvnPropListDialog(self)
1652 self.propList.show() 1640 self.propList.show()
1653 self.propList.start(name, recursive) 1641 self.propList.start(name, recursive)
1654 1642
1655 def svnSetProp(self, name, recursive=False): 1643 def svnSetProp(self, name, recursive=False):
1657 Public method used to add a property to a file/directory. 1645 Public method used to add a property to a file/directory.
1658 1646
1659 @param name file/directory name (string or list of strings) 1647 @param name file/directory name (string or list of strings)
1660 @param recursive flag indicating a recursive list is requested 1648 @param recursive flag indicating a recursive list is requested
1661 """ 1649 """
1650 from .SvnPropSetDialog import SvnPropSetDialog
1662 dlg = SvnPropSetDialog() 1651 dlg = SvnPropSetDialog()
1663 if dlg.exec_() == QDialog.Accepted: 1652 if dlg.exec_() == QDialog.Accepted:
1664 propName, fileFlag, propValue = dlg.getData() 1653 propName, fileFlag, propValue = dlg.getData()
1665 if not propName: 1654 if not propName:
1666 E5MessageBox.critical(self.__ui, 1655 E5MessageBox.critical(self.__ui,
1735 1724
1736 @param path directory name of the project (string) 1725 @param path directory name of the project (string)
1737 @param tags flag indicating listing of branches or tags 1726 @param tags flag indicating listing of branches or tags
1738 (False = branches, True = tags) 1727 (False = branches, True = tags)
1739 """ 1728 """
1729 from .SvnTagBranchListDialog import SvnTagBranchListDialog
1740 self.tagbranchList = SvnTagBranchListDialog(self) 1730 self.tagbranchList = SvnTagBranchListDialog(self)
1741 self.tagbranchList.show() 1731 self.tagbranchList.show()
1742 if tags: 1732 if tags:
1743 if not self.showedTags: 1733 if not self.showedTags:
1744 self.showedTags = True 1734 self.showedTags = True
1762 """ 1752 """
1763 Public method to show the output of the svn blame command. 1753 Public method to show the output of the svn blame command.
1764 1754
1765 @param name file name to show the blame for (string) 1755 @param name file name to show the blame for (string)
1766 """ 1756 """
1757 from .SvnBlameDialog import SvnBlameDialog
1767 self.blame = SvnBlameDialog(self) 1758 self.blame = SvnBlameDialog(self)
1768 self.blame.show() 1759 self.blame.show()
1769 self.blame.start(name) 1760 self.blame.start(name)
1770 1761
1771 def svnExtendedDiff(self, name): 1762 def svnExtendedDiff(self, name):
1792 return 1783 return
1793 else: 1784 else:
1794 project = e5App().getObject("Project") 1785 project = e5App().getObject("Project")
1795 if nam == project.ppath and not project.saveAllScripts(): 1786 if nam == project.ppath and not project.saveAllScripts():
1796 return 1787 return
1788 from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog
1797 dlg = SvnRevisionSelectionDialog() 1789 dlg = SvnRevisionSelectionDialog()
1798 if dlg.exec_() == QDialog.Accepted: 1790 if dlg.exec_() == QDialog.Accepted:
1799 revisions = dlg.getRevisions() 1791 revisions = dlg.getRevisions()
1792 from .SvnDiffDialog import SvnDiffDialog
1800 self.diff = SvnDiffDialog(self) 1793 self.diff = SvnDiffDialog(self)
1801 self.diff.show() 1794 self.diff.show()
1802 self.diff.start(name, revisions) 1795 self.diff.start(name, revisions)
1803 1796
1804 def svnUrlDiff(self, name): 1797 def svnUrlDiff(self, name):
1828 if nam == project.ppath and not project.saveAllScripts(): 1821 if nam == project.ppath and not project.saveAllScripts():
1829 return 1822 return
1830 1823
1831 dname = self.splitPath(names[0])[0] 1824 dname = self.splitPath(names[0])[0]
1832 1825
1826 from .SvnUrlSelectionDialog import SvnUrlSelectionDialog
1833 dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, dname) 1827 dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, dname)
1834 if dlg.exec_() == QDialog.Accepted: 1828 if dlg.exec_() == QDialog.Accepted:
1835 urls, summary = dlg.getURLs() 1829 urls, summary = dlg.getURLs()
1830 from .SvnDiffDialog import SvnDiffDialog
1836 self.diff = SvnDiffDialog(self) 1831 self.diff = SvnDiffDialog(self)
1837 self.diff.show() 1832 self.diff.show()
1838 QApplication.processEvents() 1833 QApplication.processEvents()
1839 self.diff.start(name, urls=urls, summary=summary) 1834 self.diff.start(name, urls=urls, summary=summary)
1840 1835
1843 Public method used to browse the log of a file/directory from the 1838 Public method used to browse the log of a file/directory from the
1844 Subversion repository. 1839 Subversion repository.
1845 1840
1846 @param path file/directory name to show the log of (string) 1841 @param path file/directory name to show the log of (string)
1847 """ 1842 """
1843 from .SvnLogBrowserDialog import SvnLogBrowserDialog
1848 self.logBrowser = SvnLogBrowserDialog(self) 1844 self.logBrowser = SvnLogBrowserDialog(self)
1849 self.logBrowser.show() 1845 self.logBrowser.show()
1850 self.logBrowser.start(path) 1846 self.logBrowser.start(path)
1851 1847
1852 def svnLock(self, name, stealIt=False, parent=None): 1848 def svnLock(self, name, stealIt=False, parent=None):
1903 """ 1899 """
1904 Public method to relocate the working copy to a new repository URL. 1900 Public method to relocate the working copy to a new repository URL.
1905 1901
1906 @param projectPath path name of the project (string) 1902 @param projectPath path name of the project (string)
1907 """ 1903 """
1904 from .SvnRelocateDialog import SvnRelocateDialog
1908 currUrl = self.svnGetReposName(projectPath) 1905 currUrl = self.svnGetReposName(projectPath)
1909 dlg = SvnRelocateDialog(currUrl) 1906 dlg = SvnRelocateDialog(currUrl)
1910 if dlg.exec_() == QDialog.Accepted: 1907 if dlg.exec_() == QDialog.Accepted:
1911 newUrl, inside = dlg.getData() 1908 newUrl, inside = dlg.getData()
1912 args = [] 1909 args = []
1940 self.trUtf8("Enter the repository URL."), 1937 self.trUtf8("Enter the repository URL."),
1941 QLineEdit.Normal) 1938 QLineEdit.Normal)
1942 if not ok or not url: 1939 if not ok or not url:
1943 return 1940 return
1944 1941
1942 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog
1945 self.repoBrowser = SvnRepoBrowserDialog(self) 1943 self.repoBrowser = SvnRepoBrowserDialog(self)
1946 self.repoBrowser.show() 1944 self.repoBrowser.show()
1947 self.repoBrowser.start(url) 1945 self.repoBrowser.start(url)
1948 1946
1949 def svnRemoveFromChangelist(self, names): 1947 def svnRemoveFromChangelist(self, names):
2011 """ 2009 """
2012 Public method used to inspect the change lists defined for the project. 2010 Public method used to inspect the change lists defined for the project.
2013 2011
2014 @param path directory name to show change lists for (string) 2012 @param path directory name to show change lists for (string)
2015 """ 2013 """
2014 from .SvnChangeListsDialog import SvnChangeListsDialog
2016 self.changeLists = SvnChangeListsDialog(self) 2015 self.changeLists = SvnChangeListsDialog(self)
2017 self.changeLists.show() 2016 self.changeLists.show()
2018 QApplication.processEvents() 2017 QApplication.processEvents()
2019 self.changeLists.start(path) 2018 self.changeLists.start(path)
2020 2019
2117 @param project reference to the project object 2116 @param project reference to the project object
2118 @param isTranslationsBrowser flag indicating, the helper is requested for the 2117 @param isTranslationsBrowser flag indicating, the helper is requested for the
2119 translations browser (this needs some special treatment) 2118 translations browser (this needs some special treatment)
2120 @return the project browser helper object 2119 @return the project browser helper object
2121 """ 2120 """
2121 from .ProjectBrowserHelper import SvnProjectBrowserHelper
2122 return SvnProjectBrowserHelper(self, browser, project, isTranslationsBrowser) 2122 return SvnProjectBrowserHelper(self, browser, project, isTranslationsBrowser)
2123 2123
2124 def vcsGetProjectHelper(self, project): 2124 def vcsGetProjectHelper(self, project):
2125 """ 2125 """
2126 Public method to instanciate a helper object for the project. 2126 Public method to instanciate a helper object for the project.
2145 2145
2146 @param project reference to the project object 2146 @param project reference to the project object
2147 @param interval check interval for the monitor thread in seconds (integer) 2147 @param interval check interval for the monitor thread in seconds (integer)
2148 @return reference to the monitor thread (QThread) 2148 @return reference to the monitor thread (QThread)
2149 """ 2149 """
2150 from .SvnStatusMonitorThread import SvnStatusMonitorThread
2150 return SvnStatusMonitorThread(interval, project, self) 2151 return SvnStatusMonitorThread(interval, project, self)

eric ide

mercurial