Plugins/VcsPlugins/vcsSubversion/subversion.py

changeset 3025
67064c71df21
parent 3020
542e97d4ecb3
child 3034
7ce719013078
child 3058
0a02c433f52d
equal deleted inserted replaced
3024:17c01303a239 3025:67064c71df21
300 args.append('-m') 300 args.append('-m')
301 args.append(msg) 301 args.append(msg)
302 args.append(self.__svnURL(vcsDir)) 302 args.append(self.__svnURL(vcsDir))
303 303
304 if noDialog: 304 if noDialog:
305 status = self.startSynchronizedProcess(QProcess(), "svn", args, 305 status = self.startSynchronizedProcess(
306 os.path.join(tmpDir, project)) 306 QProcess(), "svn", args, os.path.join(tmpDir, project))
307 else: 307 else:
308 dia = SvnDialog( 308 dia = SvnDialog(
309 self.trUtf8('Importing project into Subversion repository')) 309 self.trUtf8('Importing project into Subversion repository'))
310 res = dia.startProcess(args, os.path.join(tmpDir, project)) 310 res = dia.startProcess(args, os.path.join(tmpDir, project))
311 if res: 311 if res:
343 if not tag.startswith('tags') and \ 343 if not tag.startswith('tags') and \
344 not tag.startswith('branches'): 344 not tag.startswith('branches'):
345 type, ok = QInputDialog.getItem( 345 type, ok = QInputDialog.getItem(
346 None, 346 None,
347 self.trUtf8("Subversion Checkout"), 347 self.trUtf8("Subversion Checkout"),
348 self.trUtf8("The tag must be a normal tag (tags) or" 348 self.trUtf8(
349 "The tag must be a normal tag (tags) or"
349 " a branch tag (branches)." 350 " a branch tag (branches)."
350 " Please select from the list."), 351 " Please select from the list."),
351 self.tagTypeList, 352 self.tagTypeList,
352 0, False) 353 0, False)
353 if not ok: 354 if not ok:
398 if not tag.startswith('tags') and \ 399 if not tag.startswith('tags') and \
399 not tag.startswith('branches'): 400 not tag.startswith('branches'):
400 type, ok = QInputDialog.getItem( 401 type, ok = QInputDialog.getItem(
401 None, 402 None,
402 self.trUtf8("Subversion Export"), 403 self.trUtf8("Subversion Export"),
403 self.trUtf8("The tag must be a normal tag (tags) or" 404 self.trUtf8(
405 "The tag must be a normal tag (tags) or"
404 " a branch tag (branches)." 406 " a branch tag (branches)."
405 " Please select from the list."), 407 " Please select from the list."),
406 self.tagTypeList, 408 self.tagTypeList,
407 0, False) 409 0, False)
408 if not ok: 410 if not ok:
650 return # oops, project is not version controlled 652 return # oops, project is not version controlled
651 while os.path.normcase(d) != \ 653 while os.path.normcase(d) != \
652 os.path.normcase(repodir) and \ 654 os.path.normcase(repodir) and \
653 (d not in tree2 + tree) and \ 655 (d not in tree2 + tree) and \
654 (os.path.normcase(d) not in self.statusCache or \ 656 (os.path.normcase(d) not in self.statusCache or \
655 self.statusCache[os.path.normcase(d)] == \ 657 self.statusCache[os.path.normcase(d)] == \
656 self.canBeAdded): 658 self.canBeAdded):
657 tree2.append(d) 659 tree2.append(d)
658 d = os.path.dirname(d) 660 d = os.path.dirname(d)
659 else: 661 else:
660 while not os.path.exists(os.path.join(d, self.adminDir)): 662 while not os.path.exists(os.path.join(d, self.adminDir)):
855 857
856 if noDialog: 858 if noDialog:
857 res = self.startSynchronizedProcess(QProcess(), "svn", args) 859 res = self.startSynchronizedProcess(QProcess(), "svn", args)
858 else: 860 else:
859 dia = SvnDialog(self.trUtf8('Moving {0}') 861 dia = SvnDialog(self.trUtf8('Moving {0}')
860 .format(name)) 862 .format(name))
861 res = dia.startProcess(args) 863 res = dia.startProcess(args)
862 if res: 864 if res:
863 dia.exec_() 865 dia.exec_()
864 res = dia.normalExit() 866 res = dia.normalExit()
865 if res and not rx_prot.exactMatch(target): 867 if res and not rx_prot.exactMatch(target):
977 rx_base = QRegExp('(.+)/(trunk|tags|branches).*') 979 rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
978 if not rx_base.exactMatch(reposURL): 980 if not rx_base.exactMatch(reposURL):
979 E5MessageBox.critical( 981 E5MessageBox.critical(
980 self.__ui, 982 self.__ui,
981 self.trUtf8("Subversion Error"), 983 self.trUtf8("Subversion Error"),
982 self.trUtf8("""The URL of the project repository has an""" 984 self.trUtf8(
985 """The URL of the project repository has an"""
983 """ invalid format. The tag operation will""" 986 """ invalid format. The tag operation will"""
984 """ be aborted""")) 987 """ be aborted"""))
985 return 988 return
986 989
987 reposRoot = rx_base.cap(1) 990 reposRoot = rx_base.cap(1)
1009 args.append('--message') 1012 args.append('--message')
1010 args.append('Deleted tag <{0}>'.format(tag)) 1013 args.append('Deleted tag <{0}>'.format(tag))
1011 args.append(url) 1014 args.append(url)
1012 1015
1013 dia = SvnDialog(self.trUtf8('Tagging {0} in the Subversion repository') 1016 dia = SvnDialog(self.trUtf8('Tagging {0} in the Subversion repository')
1014 .format(name)) 1017 .format(name))
1015 res = dia.startProcess(args) 1018 res = dia.startProcess(args)
1016 if res: 1019 if res:
1017 dia.exec_() 1020 dia.exec_()
1018 1021
1019 def vcsRevert(self, name): 1022 def vcsRevert(self, name):
1037 project = e5App().getObject("Project") 1040 project = e5App().getObject("Project")
1038 names = [project.getRelativePath(nam) for nam in names] 1041 names = [project.getRelativePath(nam) for nam in names]
1039 if names[0]: 1042 if names[0]:
1040 from UI.DeleteFilesConfirmationDialog import \ 1043 from UI.DeleteFilesConfirmationDialog import \
1041 DeleteFilesConfirmationDialog 1044 DeleteFilesConfirmationDialog
1042 dlg = DeleteFilesConfirmationDialog(self.parent(), 1045 dlg = DeleteFilesConfirmationDialog(
1046 self.parent(),
1043 self.trUtf8("Revert changes"), 1047 self.trUtf8("Revert changes"),
1044 self.trUtf8("Do you really want to revert all changes to" 1048 self.trUtf8("Do you really want to revert all changes to"
1045 " these files or directories?"), 1049 " these files or directories?"),
1046 names) 1050 names)
1047 yes = dlg.exec_() == QDialog.Accepted 1051 yes = dlg.exec_() == QDialog.Accepted
1097 rx_base = QRegExp('(.+)/(trunk|tags|branches).*') 1101 rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
1098 if not rx_base.exactMatch(reposURL): 1102 if not rx_base.exactMatch(reposURL):
1099 E5MessageBox.critical( 1103 E5MessageBox.critical(
1100 self.__ui, 1104 self.__ui,
1101 self.trUtf8("Subversion Error"), 1105 self.trUtf8("Subversion Error"),
1102 self.trUtf8("""The URL of the project repository has an""" 1106 self.trUtf8(
1107 """The URL of the project repository has an"""
1103 """ invalid format. The switch operation will""" 1108 """ invalid format. The switch operation will"""
1104 """ be aborted""")) 1109 """ be aborted"""))
1105 return False 1110 return False
1106 1111
1107 reposRoot = rx_base.cap(1) 1112 reposRoot = rx_base.cap(1)
1125 args.append('postpone') 1130 args.append('postpone')
1126 args.append(url) 1131 args.append(url)
1127 args.append(name) 1132 args.append(name)
1128 1133
1129 dia = SvnDialog(self.trUtf8('Switching to {0}') 1134 dia = SvnDialog(self.trUtf8('Switching to {0}')
1130 .format(tn)) 1135 .format(tn))
1131 res = dia.startProcess(args, setLanguage=True) 1136 res = dia.startProcess(args, setLanguage=True)
1132 if res: 1137 if res:
1133 dia.exec_() 1138 dia.exec_()
1134 res = dia.hasAddOrDelete() 1139 res = dia.hasAddOrDelete()
1135 self.checkVCSStatus() 1140 self.checkVCSStatus()
1456 args.append('cleanup') 1461 args.append('cleanup')
1457 self.addArguments(args, self.options['global']) 1462 self.addArguments(args, self.options['global'])
1458 args.append(name) 1463 args.append(name)
1459 1464
1460 dia = SvnDialog(self.trUtf8('Cleaning up {0}') 1465 dia = SvnDialog(self.trUtf8('Cleaning up {0}')
1461 .format(name)) 1466 .format(name))
1462 res = dia.startProcess(args) 1467 res = dia.startProcess(args)
1463 if res: 1468 if res:
1464 dia.exec_() 1469 dia.exec_()
1465 1470
1466 def vcsCommandLine(self, name): 1471 def vcsCommandLine(self, name):
1578 date, time = value.split('T') 1583 date, time = value.split('T')
1579 info['committed-date'] = date 1584 info['committed-date'] = date
1580 info['committed-time'] = "{0}{1}".format( 1585 info['committed-time'] = "{0}{1}".format(
1581 time.split('.')[0], time[-1]) 1586 time.split('.')[0], time[-1])
1582 1587
1583 return QApplication.translate('subversion', 1588 return QApplication.translate(
1589 'subversion',
1584 """<h3>Repository information</h3>""" 1590 """<h3>Repository information</h3>"""
1585 """<table>""" 1591 """<table>"""
1586 """<tr><td><b>Subversion V.</b></td><td>{0}</td></tr>""" 1592 """<tr><td><b>Subversion V.</b></td><td>{0}</td></tr>"""
1587 """<tr><td><b>URL</b></td><td>{1}</td></tr>""" 1593 """<tr><td><b>URL</b></td><td>{1}</td></tr>"""
1588 """<tr><td><b>Current revision</b></td><td>{2}</td></tr>""" 1594 """<tr><td><b>Current revision</b></td><td>{2}</td></tr>"""
1687 target = self.__svnURL(target) 1693 target = self.__svnURL(target)
1688 args.append(name) 1694 args.append(name)
1689 args.append(target) 1695 args.append(target)
1690 1696
1691 dia = SvnDialog(self.trUtf8('Copying {0}') 1697 dia = SvnDialog(self.trUtf8('Copying {0}')
1692 .format(name)) 1698 .format(name))
1693 res = dia.startProcess(args) 1699 res = dia.startProcess(args)
1694 if res: 1700 if res:
1695 dia.exec_() 1701 dia.exec_()
1696 res = dia.normalExit() 1702 res = dia.normalExit()
1697 if res and \ 1703 if res and \
1904 1910
1905 dname = self.splitPath(names[0])[0] 1911 dname = self.splitPath(names[0])[0]
1906 1912
1907 from .SvnUrlSelectionDialog import SvnUrlSelectionDialog 1913 from .SvnUrlSelectionDialog import SvnUrlSelectionDialog
1908 dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, 1914 dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList,
1909 dname) 1915 dname)
1910 if dlg.exec_() == QDialog.Accepted: 1916 if dlg.exec_() == QDialog.Accepted:
1911 urls, summary = dlg.getURLs() 1917 urls, summary = dlg.getURLs()
1912 from .SvnDiffDialog import SvnDiffDialog 1918 from .SvnDiffDialog import SvnDiffDialog
1913 self.diff = SvnDiffDialog(self) 1919 self.diff = SvnDiffDialog(self)
1914 self.diff.show() 1920 self.diff.show()
1939 procStarted = process.waitForStarted(5000) 1945 procStarted = process.waitForStarted(5000)
1940 if procStarted: 1946 if procStarted:
1941 finished = process.waitForFinished(30000) 1947 finished = process.waitForFinished(30000)
1942 if finished: 1948 if finished:
1943 if process.exitCode() == 0: 1949 if process.exitCode() == 0:
1944 output = str(process.readAllStandardOutput(), 1950 output = str(
1951 process.readAllStandardOutput(),
1945 Preferences.getSystem("IOEncoding"), 'replace') 1952 Preferences.getSystem("IOEncoding"), 'replace')
1946 else: 1953 else:
1947 error = str(process.readAllStandardError(), 1954 error = str(
1955 process.readAllStandardError(),
1948 Preferences.getSystem("IOEncoding"), 'replace') 1956 Preferences.getSystem("IOEncoding"), 'replace')
1949 else: 1957 else:
1950 error = self.trUtf8( 1958 error = self.trUtf8(
1951 "The svn process did not finish within 30s.") 1959 "The svn process did not finish within 30s.")
1952 else: 1960 else:
1953 error = self.trUtf8('The process {0} could not be started. ' 1961 error = self.trUtf8(
1954 'Ensure, that it is in the search path.').format('svn') 1962 'The process {0} could not be started. '
1963 'Ensure, that it is in the search path.').format('svn')
1955 1964
1956 return output, error 1965 return output, error
1957 1966
1958 def svnSbsDiff(self, name, extended=False, revisions=None): 1967 def svnSbsDiff(self, name, extended=False, revisions=None):
1959 """ 1968 """

eric ide

mercurial