Plugins/VcsPlugins/vcsPySvn/subversion.py

changeset 2406
975af671146d
parent 2352
21971ebfaaef
child 2451
4d80de2f9122
equal deleted inserted replaced
2405:d4b5f3bd4720 2406:975af671146d
23 from VCS.VersionControl import VersionControl 23 from VCS.VersionControl import VersionControl
24 24
25 import pysvn 25 import pysvn
26 26
27 from .SvnDialog import SvnDialog 27 from .SvnDialog import SvnDialog
28 from .SvnCommitDialog import SvnCommitDialog
29 from .SvnLogDialog import SvnLogDialog
30 from .SvnLogBrowserDialog import SvnLogBrowserDialog
31 from .SvnDiffDialog import SvnDiffDialog
32 from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog
33 from .SvnStatusDialog import SvnStatusDialog
34 from .SvnTagDialog import SvnTagDialog
35 from .SvnTagBranchListDialog import SvnTagBranchListDialog
36 from .SvnCopyDialog import SvnCopyDialog
37 from .SvnCommandDialog import SvnCommandDialog
38 from .SvnSwitchDialog import SvnSwitchDialog
39 from .SvnMergeDialog import SvnMergeDialog
40 from .SvnPropListDialog import SvnPropListDialog
41 from .SvnPropSetDialog import SvnPropSetDialog
42 from .SvnPropDelDialog import SvnPropDelDialog
43 from .SvnOptionsDialog import SvnOptionsDialog
44 from .SvnNewProjectOptionsDialog import SvnNewProjectOptionsDialog
45 from .SvnBlameDialog import SvnBlameDialog
46 from .SvnInfoDialog import SvnInfoDialog
47 from .SvnRelocateDialog import SvnRelocateDialog
48 from .SvnUrlSelectionDialog import SvnUrlSelectionDialog
49 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog
50 from .SvnChangeListsDialog import SvnChangeListsDialog
51 from .SvnStatusMonitorThread import SvnStatusMonitorThread
52 from .SvnUtilities import getConfigPath, amendConfig, createDefaultConfig 28 from .SvnUtilities import getConfigPath, amendConfig, createDefaultConfig
53
54 from .ProjectBrowserHelper import SvnProjectBrowserHelper
55
56 from Plugins.VcsPlugins.vcsSubversion.SvnDialog import SvnDialog as SvnProcessDialog
57
58 from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
59 29
60 import Utilities 30 import Utilities
61 31
62 32
63 class Subversion(VersionControl): 33 class Subversion(VersionControl):
474 @param noDialog flag indicating quiet operations 444 @param noDialog flag indicating quiet operations
475 """ 445 """
476 if not noDialog and not message: 446 if not noDialog and not message:
477 # call CommitDialog and get message from there 447 # call CommitDialog and get message from there
478 if self.__commitDialog is None: 448 if self.__commitDialog is None:
449 from .SvnCommitDialog import SvnCommitDialog
479 self.__commitDialog = SvnCommitDialog(self.svnGetChangelists(), self.__ui) 450 self.__commitDialog = SvnCommitDialog(self.svnGetChangelists(), self.__ui)
480 self.__commitDialog.accepted.connect(self.__vcsCommit_Step2) 451 self.__commitDialog.accepted.connect(self.__vcsCommit_Step2)
481 self.__commitDialog.show() 452 self.__commitDialog.show()
482 self.__commitDialog.raise_() 453 self.__commitDialog.raise_()
483 self.__commitDialog.activateWindow() 454 self.__commitDialog.activateWindow()
893 if target is None: 864 if target is None:
894 return False 865 return False
895 force = True 866 force = True
896 accepted = True 867 accepted = True
897 else: 868 else:
869 from .SvnCopyDialog import SvnCopyDialog
898 dlg = SvnCopyDialog(name, None, True, "--force" in opts) 870 dlg = SvnCopyDialog(name, None, True, "--force" in opts)
899 accepted = (dlg.exec_() == QDialog.Accepted) 871 accepted = (dlg.exec_() == QDialog.Accepted)
900 if accepted: 872 if accepted:
901 target, force = dlg.getData() 873 target, force = dlg.getData()
902 874
959 None, 931 None,
960 self.trUtf8("Subversion Log"), 932 self.trUtf8("Subversion Log"),
961 self.trUtf8("Select number of entries to show."), 933 self.trUtf8("Select number of entries to show."),
962 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1) 934 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1)
963 if ok: 935 if ok:
936 from .SvnLogDialog import SvnLogDialog
964 self.log = SvnLogDialog(self) 937 self.log = SvnLogDialog(self)
965 self.log.show() 938 self.log.show()
966 QApplication.processEvents() 939 QApplication.processEvents()
967 self.log.start(name, noEntries) 940 self.log.start(name, noEntries)
968 941
988 return 961 return
989 else: 962 else:
990 project = e5App().getObject("Project") 963 project = e5App().getObject("Project")
991 if nam == project.ppath and not project.saveAllScripts(): 964 if nam == project.ppath and not project.saveAllScripts():
992 return 965 return
966 from .SvnDiffDialog import SvnDiffDialog
993 self.diff = SvnDiffDialog(self) 967 self.diff = SvnDiffDialog(self)
994 self.diff.show() 968 self.diff.show()
995 QApplication.processEvents() 969 QApplication.processEvents()
996 self.diff.start(name) 970 self.diff.start(name)
997 971
1001 Subversion repository. 975 Subversion repository.
1002 976
1003 @param name file/directory name(s) to show the status of 977 @param name file/directory name(s) to show the status of
1004 (string or list of strings) 978 (string or list of strings)
1005 """ 979 """
980 from .SvnStatusDialog import SvnStatusDialog
1006 self.status = SvnStatusDialog(self) 981 self.status = SvnStatusDialog(self)
1007 self.status.show() 982 self.status.show()
1008 QApplication.processEvents() 983 QApplication.processEvents()
1009 self.status.start(name) 984 self.status.start(name)
1010 985
1028 1003
1029 if self.otherData["standardLayout"]: 1004 if self.otherData["standardLayout"]:
1030 url = None 1005 url = None
1031 else: 1006 else:
1032 url = self.svnNormalizeURL(reposURL) 1007 url = self.svnNormalizeURL(reposURL)
1008 from .SvnTagDialog import SvnTagDialog
1033 dlg = SvnTagDialog(self.allTagsBranchesList, url, 1009 dlg = SvnTagDialog(self.allTagsBranchesList, url,
1034 self.otherData["standardLayout"]) 1010 self.otherData["standardLayout"])
1035 if dlg.exec_() == QDialog.Accepted: 1011 if dlg.exec_() == QDialog.Accepted:
1036 tag, tagOp = dlg.getParameters() 1012 tag, tagOp = dlg.getParameters()
1037 if tag in self.allTagsBranchesList: 1013 if tag in self.allTagsBranchesList:
1107 recurse = True 1083 recurse = True
1108 1084
1109 project = e5App().getObject("Project") 1085 project = e5App().getObject("Project")
1110 names = [project.getRelativePath(nam) for nam in name] 1086 names = [project.getRelativePath(nam) for nam in name]
1111 if names[0]: 1087 if names[0]:
1088 from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
1112 dia = DeleteFilesConfirmationDialog(self.parent(), 1089 dia = DeleteFilesConfirmationDialog(self.parent(),
1113 self.trUtf8("Revert changes"), 1090 self.trUtf8("Revert changes"),
1114 self.trUtf8("Do you really want to revert all changes to these files" 1091 self.trUtf8("Do you really want to revert all changes to these files"
1115 " or directories?"), 1092 " or directories?"),
1116 name) 1093 name)
1159 1136
1160 if self.otherData["standardLayout"]: 1137 if self.otherData["standardLayout"]:
1161 url = None 1138 url = None
1162 else: 1139 else:
1163 url = self.svnNormalizeURL(reposURL) 1140 url = self.svnNormalizeURL(reposURL)
1141 from .SvnSwitchDialog import SvnSwitchDialog
1164 dlg = SvnSwitchDialog(self.allTagsBranchesList, url, 1142 dlg = SvnSwitchDialog(self.allTagsBranchesList, url,
1165 self.otherData["standardLayout"]) 1143 self.otherData["standardLayout"])
1166 if dlg.exec_() == QDialog.Accepted: 1144 if dlg.exec_() == QDialog.Accepted:
1167 tag, tagType = dlg.getParameters() 1145 tag, tagType = dlg.getParameters()
1168 if tag in self.allTagsBranchesList: 1146 if tag in self.allTagsBranchesList:
1220 @param name file/directory name to be merged (string) 1198 @param name file/directory name to be merged (string)
1221 """ 1199 """
1222 dname, fname = self.splitPath(name) 1200 dname, fname = self.splitPath(name)
1223 1201
1224 opts = self.options['global'] 1202 opts = self.options['global']
1203 from .SvnMergeDialog import SvnMergeDialog
1225 dlg = SvnMergeDialog(self.mergeList[0], self.mergeList[1], self.mergeList[2], 1204 dlg = SvnMergeDialog(self.mergeList[0], self.mergeList[1], self.mergeList[2],
1226 "--force" in opts) 1205 "--force" in opts)
1227 if dlg.exec_() == QDialog.Accepted: 1206 if dlg.exec_() == QDialog.Accepted:
1228 urlrev1, urlrev2, target, force = dlg.getParameters() 1207 urlrev1, urlrev2, target, force = dlg.getParameters()
1229 else: 1208 else:
1592 """ 1571 """
1593 Public method used to execute arbitrary subversion commands. 1572 Public method used to execute arbitrary subversion commands.
1594 1573
1595 @param name directory name of the working directory (string) 1574 @param name directory name of the working directory (string)
1596 """ 1575 """
1576 from .SvnCommandDialog import SvnCommandDialog
1597 dlg = SvnCommandDialog(self.commandHistory, self.wdHistory, name) 1577 dlg = SvnCommandDialog(self.commandHistory, self.wdHistory, name)
1598 if dlg.exec_() == QDialog.Accepted: 1578 if dlg.exec_() == QDialog.Accepted:
1599 command, wd = dlg.getData() 1579 command, wd = dlg.getData()
1600 commandList = Utilities.parseOptionString(command) 1580 commandList = Utilities.parseOptionString(command)
1601 1581
1609 self.wdHistory.insert(0, wd) 1589 self.wdHistory.insert(0, wd)
1610 1590
1611 args = [] 1591 args = []
1612 self.addArguments(args, commandList) 1592 self.addArguments(args, commandList)
1613 1593
1594 from Plugins.VcsPlugins.vcsSubversion.SvnDialog import \
1595 SvnDialog as SvnProcessDialog
1614 dia = SvnProcessDialog(self.trUtf8('Subversion command')) 1596 dia = SvnProcessDialog(self.trUtf8('Subversion command'))
1615 res = dia.startProcess(args, wd) 1597 res = dia.startProcess(args, wd)
1616 if res: 1598 if res:
1617 dia.exec_() 1599 dia.exec_()
1618 1600
1623 @param project reference to the project object 1605 @param project reference to the project object
1624 @param archive name of the project in the repository (string) 1606 @param archive name of the project in the repository (string)
1625 @param editable flag indicating that the project name is editable (boolean) 1607 @param editable flag indicating that the project name is editable (boolean)
1626 @param parent parent widget (QWidget) 1608 @param parent parent widget (QWidget)
1627 """ 1609 """
1610 from .SvnOptionsDialog import SvnOptionsDialog
1628 return SvnOptionsDialog(self, project, parent) 1611 return SvnOptionsDialog(self, project, parent)
1629 1612
1630 def vcsNewProjectOptionsDialog(self, parent=None): 1613 def vcsNewProjectOptionsDialog(self, parent=None):
1631 """ 1614 """
1632 Public method to get a dialog to enter repository info for getting a new project. 1615 Public method to get a dialog to enter repository info for getting a new project.
1633 1616
1634 @param parent parent widget (QWidget) 1617 @param parent parent widget (QWidget)
1635 """ 1618 """
1619 from .SvnNewProjectOptionsDialog import SvnNewProjectOptionsDialog
1636 return SvnNewProjectOptionsDialog(self, parent) 1620 return SvnNewProjectOptionsDialog(self, parent)
1637 1621
1638 def vcsRepositoryInfos(self, ppath): 1622 def vcsRepositoryInfos(self, ppath):
1639 """ 1623 """
1640 Public method to retrieve information about the repository. 1624 Public method to retrieve information about the repository.
1741 1725
1742 @param name file/directory name to be copied (string) 1726 @param name file/directory name to be copied (string)
1743 @param project reference to the project object 1727 @param project reference to the project object
1744 @return flag indicating successfull operation (boolean) 1728 @return flag indicating successfull operation (boolean)
1745 """ 1729 """
1730 from .SvnCopyDialog import SvnCopyDialog
1746 rx_prot = QRegExp('(file:|svn:|svn+ssh:|http:|https:).+') 1731 rx_prot = QRegExp('(file:|svn:|svn+ssh:|http:|https:).+')
1747 dlg = SvnCopyDialog(name) 1732 dlg = SvnCopyDialog(name)
1748 res = False 1733 res = False
1749 if dlg.exec_() == QDialog.Accepted: 1734 if dlg.exec_() == QDialog.Accepted:
1750 target, force = dlg.getData() 1735 target, force = dlg.getData()
1788 Public method used to list the properties of a file/directory. 1773 Public method used to list the properties of a file/directory.
1789 1774
1790 @param name file/directory name (string or list of strings) 1775 @param name file/directory name (string or list of strings)
1791 @param recursive flag indicating a recursive list is requested 1776 @param recursive flag indicating a recursive list is requested
1792 """ 1777 """
1778 from .SvnPropListDialog import SvnPropListDialog
1793 self.propList = SvnPropListDialog(self) 1779 self.propList = SvnPropListDialog(self)
1794 self.propList.show() 1780 self.propList.show()
1795 QApplication.processEvents() 1781 QApplication.processEvents()
1796 self.propList.start(name, recursive) 1782 self.propList.start(name, recursive)
1797 1783
1800 Public method used to add a property to a file/directory. 1786 Public method used to add a property to a file/directory.
1801 1787
1802 @param name file/directory name (string or list of strings) 1788 @param name file/directory name (string or list of strings)
1803 @param recursive flag indicating a recursive set is requested 1789 @param recursive flag indicating a recursive set is requested
1804 """ 1790 """
1791 from .SvnPropSetDialog import SvnPropSetDialog
1805 dlg = SvnPropSetDialog(recursive) 1792 dlg = SvnPropSetDialog(recursive)
1806 if dlg.exec_() == QDialog.Accepted: 1793 if dlg.exec_() == QDialog.Accepted:
1807 propName, propValue, recurse = dlg.getData() 1794 propName, propValue, recurse = dlg.getData()
1808 if not propName: 1795 if not propName:
1809 E5MessageBox.critical(self.__ui, 1796 E5MessageBox.critical(self.__ui,
1850 Public method used to delete a property of a file/directory. 1837 Public method used to delete a property of a file/directory.
1851 1838
1852 @param name file/directory name (string or list of strings) 1839 @param name file/directory name (string or list of strings)
1853 @param recursive flag indicating a recursive list is requested 1840 @param recursive flag indicating a recursive list is requested
1854 """ 1841 """
1842 from .SvnPropDelDialog import SvnPropDelDialog
1855 dlg = SvnPropDelDialog(recursive) 1843 dlg = SvnPropDelDialog(recursive)
1856 if dlg.exec_() == QDialog.Accepted: 1844 if dlg.exec_() == QDialog.Accepted:
1857 propName, recurse = dlg.getData() 1845 propName, recurse = dlg.getData()
1858 1846
1859 if not propName: 1847 if not propName:
1901 1889
1902 @param path directory name of the project (string) 1890 @param path directory name of the project (string)
1903 @param tags flag indicating listing of branches or tags 1891 @param tags flag indicating listing of branches or tags
1904 (False = branches, True = tags) 1892 (False = branches, True = tags)
1905 """ 1893 """
1894 from .SvnTagBranchListDialog import SvnTagBranchListDialog
1906 self.tagbranchList = SvnTagBranchListDialog(self) 1895 self.tagbranchList = SvnTagBranchListDialog(self)
1907 self.tagbranchList.show() 1896 self.tagbranchList.show()
1908 QApplication.processEvents() 1897 QApplication.processEvents()
1909 res = self.tagbranchList.start(path, tags) 1898 res = self.tagbranchList.start(path, tags)
1910 if res: 1899 if res:
1923 """ 1912 """
1924 Public method to show the output of the svn blame command. 1913 Public method to show the output of the svn blame command.
1925 1914
1926 @param name file name to show the blame for (string) 1915 @param name file name to show the blame for (string)
1927 """ 1916 """
1917 from .SvnBlameDialog import SvnBlameDialog
1928 self.blame = SvnBlameDialog(self) 1918 self.blame = SvnBlameDialog(self)
1929 self.blame.show() 1919 self.blame.show()
1930 QApplication.processEvents() 1920 QApplication.processEvents()
1931 self.blame.start(name) 1921 self.blame.start(name)
1932 1922
1954 return 1944 return
1955 else: 1945 else:
1956 project = e5App().getObject("Project") 1946 project = e5App().getObject("Project")
1957 if nam == project.ppath and not project.saveAllScripts(): 1947 if nam == project.ppath and not project.saveAllScripts():
1958 return 1948 return
1949 from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog
1959 dlg = SvnRevisionSelectionDialog() 1950 dlg = SvnRevisionSelectionDialog()
1960 if dlg.exec_() == QDialog.Accepted: 1951 if dlg.exec_() == QDialog.Accepted:
1961 revisions = dlg.getRevisions() 1952 revisions = dlg.getRevisions()
1953 from .SvnDiffDialog import SvnDiffDialog
1962 self.diff = SvnDiffDialog(self) 1954 self.diff = SvnDiffDialog(self)
1963 self.diff.show() 1955 self.diff.show()
1964 QApplication.processEvents() 1956 QApplication.processEvents()
1965 self.diff.start(name, revisions) 1957 self.diff.start(name, revisions)
1966 1958
1991 if nam == project.ppath and not project.saveAllScripts(): 1983 if nam == project.ppath and not project.saveAllScripts():
1992 return 1984 return
1993 1985
1994 dname = self.splitPath(names[0])[0] 1986 dname = self.splitPath(names[0])[0]
1995 1987
1988 from .SvnUrlSelectionDialog import SvnUrlSelectionDialog
1996 dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, dname) 1989 dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, dname)
1997 if dlg.exec_() == QDialog.Accepted: 1990 if dlg.exec_() == QDialog.Accepted:
1998 urls, summary = dlg.getURLs() 1991 urls, summary = dlg.getURLs()
1992 from .SvnDiffDialog import SvnDiffDialog
1999 self.diff = SvnDiffDialog(self) 1993 self.diff = SvnDiffDialog(self)
2000 self.diff.show() 1994 self.diff.show()
2001 QApplication.processEvents() 1995 QApplication.processEvents()
2002 self.diff.start(name, urls=urls, summary=summary) 1996 self.diff.start(name, urls=urls, summary=summary)
2003 1997
2006 Public method used to browse the log of a file/directory from the 2000 Public method used to browse the log of a file/directory from the
2007 Subversion repository. 2001 Subversion repository.
2008 2002
2009 @param path file/directory name to show the log of (string) 2003 @param path file/directory name to show the log of (string)
2010 """ 2004 """
2005 from .SvnLogBrowserDialog import SvnLogBrowserDialog
2011 self.logBrowser = SvnLogBrowserDialog(self) 2006 self.logBrowser = SvnLogBrowserDialog(self)
2012 self.logBrowser.show() 2007 self.logBrowser.show()
2013 QApplication.processEvents() 2008 QApplication.processEvents()
2014 self.logBrowser.start(path) 2009 self.logBrowser.start(path)
2015 2010
2102 Public method to show repository information about a file or directory. 2097 Public method to show repository information about a file or directory.
2103 2098
2104 @param projectPath path name of the project (string) 2099 @param projectPath path name of the project (string)
2105 @param name file/directory name relative to the project (string) 2100 @param name file/directory name relative to the project (string)
2106 """ 2101 """
2102 from .SvnInfoDialog import SvnInfoDialog
2107 dlg = SvnInfoDialog(self) 2103 dlg = SvnInfoDialog(self)
2108 dlg.start(projectPath, name) 2104 dlg.start(projectPath, name)
2109 dlg.exec_() 2105 dlg.exec_()
2110 2106
2111 def svnRelocate(self, projectPath): 2107 def svnRelocate(self, projectPath):
2112 """ 2108 """
2113 Public method to relocate the working copy to a new repository URL. 2109 Public method to relocate the working copy to a new repository URL.
2114 2110
2115 @param projectPath path name of the project (string) 2111 @param projectPath path name of the project (string)
2116 """ 2112 """
2113 from .SvnRelocateDialog import SvnRelocateDialog
2117 currUrl = self.svnGetReposName(projectPath) 2114 currUrl = self.svnGetReposName(projectPath)
2118 dlg = SvnRelocateDialog(currUrl) 2115 dlg = SvnRelocateDialog(currUrl)
2119 if dlg.exec_() == QDialog.Accepted: 2116 if dlg.exec_() == QDialog.Accepted:
2120 newUrl, inside = dlg.getData() 2117 newUrl, inside = dlg.getData()
2121 if inside: 2118 if inside:
2156 self.trUtf8("Enter the repository URL."), 2153 self.trUtf8("Enter the repository URL."),
2157 QLineEdit.Normal) 2154 QLineEdit.Normal)
2158 if not ok or not url: 2155 if not ok or not url:
2159 return 2156 return
2160 2157
2158 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog
2161 self.repoBrowser = SvnRepoBrowserDialog(self) 2159 self.repoBrowser = SvnRepoBrowserDialog(self)
2162 self.repoBrowser.start(url) 2160 self.repoBrowser.start(url)
2163 2161
2164 def svnRemoveFromChangelist(self, names): 2162 def svnRemoveFromChangelist(self, names):
2165 """ 2163 """
2229 """ 2227 """
2230 Public method used to inspect the change lists defined for the project. 2228 Public method used to inspect the change lists defined for the project.
2231 2229
2232 @param path directory name to show change lists for (string) 2230 @param path directory name to show change lists for (string)
2233 """ 2231 """
2232 from .SvnChangeListsDialog import SvnChangeListsDialog
2234 self.changeLists = SvnChangeListsDialog(self) 2233 self.changeLists = SvnChangeListsDialog(self)
2235 self.changeLists.show() 2234 self.changeLists.show()
2236 QApplication.processEvents() 2235 QApplication.processEvents()
2237 self.changeLists.start(path) 2236 self.changeLists.start(path)
2238 2237
2322 @param project reference to the project object 2321 @param project reference to the project object
2323 @param isTranslationsBrowser flag indicating, the helper is requested for the 2322 @param isTranslationsBrowser flag indicating, the helper is requested for the
2324 translations browser (this needs some special treatment) 2323 translations browser (this needs some special treatment)
2325 @return the project browser helper object 2324 @return the project browser helper object
2326 """ 2325 """
2326 from .ProjectBrowserHelper import SvnProjectBrowserHelper
2327 return SvnProjectBrowserHelper(self, browser, project, isTranslationsBrowser) 2327 return SvnProjectBrowserHelper(self, browser, project, isTranslationsBrowser)
2328 2328
2329 def vcsGetProjectHelper(self, project): 2329 def vcsGetProjectHelper(self, project):
2330 """ 2330 """
2331 Public method to instanciate a helper object for the project. 2331 Public method to instanciate a helper object for the project.
2350 2350
2351 @param project reference to the project object 2351 @param project reference to the project object
2352 @param interval check interval for the monitor thread in seconds (integer) 2352 @param interval check interval for the monitor thread in seconds (integer)
2353 @return reference to the monitor thread (QThread) 2353 @return reference to the monitor thread (QThread)
2354 """ 2354 """
2355 from .SvnStatusMonitorThread import SvnStatusMonitorThread
2355 return SvnStatusMonitorThread(interval, project, self) 2356 return SvnStatusMonitorThread(interval, project, self)

eric ide

mercurial