Plugins/VcsPlugins/vcsPySvn/subversion.py

changeset 564
b3d966393ba9
parent 537
72b32daeb8d6
child 791
9ec2ac20e54e
equal deleted inserted replaced
563:e35d2cda9a74 564:b3d966393ba9
352 if self.otherData["standardLayout"]: 352 if self.otherData["standardLayout"]:
353 if tag is None or tag == '': 353 if tag is None or tag == '':
354 svnUrl = '{0}/trunk'.format(vcsDir) 354 svnUrl = '{0}/trunk'.format(vcsDir)
355 else: 355 else:
356 if not tag.startswith('tags') and not tag.startswith('branches'): 356 if not tag.startswith('tags') and not tag.startswith('branches'):
357 type_, ok = QInputDialog.getItem(\ 357 type_, ok = QInputDialog.getItem(
358 None, 358 None,
359 self.trUtf8("Subversion Checkout"), 359 self.trUtf8("Subversion Checkout"),
360 self.trUtf8("The tag must be a normal tag (tags) or" 360 self.trUtf8("The tag must be a normal tag (tags) or"
361 " a branch tag (branches)." 361 " a branch tag (branches)."
362 " Please select from the list."), 362 " Please select from the list."),
414 if self.otherData["standardLayout"]: 414 if self.otherData["standardLayout"]:
415 if tag is None or tag == '': 415 if tag is None or tag == '':
416 svnUrl = '{0}/trunk'.format(vcsDir) 416 svnUrl = '{0}/trunk'.format(vcsDir)
417 else: 417 else:
418 if not tag.startswith('tags') and not tag.startswith('branches'): 418 if not tag.startswith('tags') and not tag.startswith('branches'):
419 type_, ok = QInputDialog.getItem(\ 419 type_, ok = QInputDialog.getItem(
420 None, 420 None,
421 self.trUtf8("Subversion Export"), 421 self.trUtf8("Subversion Export"),
422 self.trUtf8("The tag must be a normal tag (tags) or" 422 self.trUtf8("The tag must be a normal tag (tags) or"
423 " a branch tag (branches)." 423 " a branch tag (branches)."
424 " Please select from the list."), 424 " Please select from the list."),
648 force = "--force" in opts or noDialog 648 force = "--force" in opts or noDialog
649 noignore = "--no-ignore" in opts 649 noignore = "--no-ignore" in opts
650 client = self.getClient() 650 client = self.getClient()
651 if not noDialog: 651 if not noDialog:
652 dlg = \ 652 dlg = \
653 SvnDialog(\ 653 SvnDialog(
654 self.trUtf8('Adding files/directories to the Subversion repository'), 654 self.trUtf8('Adding files/directories to the Subversion repository'),
655 "add --non-recursive{0}{1} {2}".format( 655 "add --non-recursive{0}{1} {2}".format(
656 force and " --force" or "", 656 force and " --force" or "",
657 noignore and " --no-ignore" or "", 657 noignore and " --no-ignore" or "",
658 " ".join(names)), 658 " ".join(names)),
721 recurse = True 721 recurse = True
722 force = "--force" in opts 722 force = "--force" in opts
723 ignore = "--ignore" in opts 723 ignore = "--ignore" in opts
724 client = self.getClient() 724 client = self.getClient()
725 dlg = \ 725 dlg = \
726 SvnDialog(\ 726 SvnDialog(
727 self.trUtf8('Adding directory trees to the Subversion repository'), 727 self.trUtf8('Adding directory trees to the Subversion repository'),
728 "add{0}{1} {2}".format( 728 "add{0}{1} {2}".format(
729 force and " --force" or "", 729 force and " --force" or "",
730 ignore and " --ignore" or "", 730 ignore and " --ignore" or "",
731 " ".join(names)), 731 " ".join(names)),
756 opts = self.options['global'] + self.options['remove'] 756 opts = self.options['global'] + self.options['remove']
757 force = "--force" in opts or noDialog 757 force = "--force" in opts or noDialog
758 client = self.getClient() 758 client = self.getClient()
759 if not noDialog: 759 if not noDialog:
760 dlg = \ 760 dlg = \
761 SvnDialog(\ 761 SvnDialog(
762 self.trUtf8('Removing files/directories from the Subversion repository'), 762 self.trUtf8('Removing files/directories from the Subversion repository'),
763 "remove{0} {1}".format( 763 "remove{0} {1}".format(
764 force and " --force" or "", 764 force and " --force" or "",
765 " ".join(name)), 765 " ".join(name)),
766 client) 766 client)
818 else: 818 else:
819 log = "" 819 log = ""
820 target = target 820 target = target
821 if not noDialog: 821 if not noDialog:
822 dlg = \ 822 dlg = \
823 SvnDialog(\ 823 SvnDialog(
824 self.trUtf8('Moving {0}').format(name), 824 self.trUtf8('Moving {0}').format(name),
825 "move{0}{1} {2} {3}".format( 825 "move{0}{1} {2} {3}".format(
826 force and " --force" or "", 826 force and " --force" or "",
827 log and (" --message {0}".format(log)) or "", 827 log and (" --message {0}".format(log)) or "",
828 name, target), 828 name, target),
961 client = self.getClient() 961 client = self.getClient()
962 rev = None 962 rev = None
963 if tagOp in [1, 2]: 963 if tagOp in [1, 2]:
964 log = 'Created tag <{0}>'.format(self.tagName) 964 log = 'Created tag <{0}>'.format(self.tagName)
965 dlg = \ 965 dlg = \
966 SvnDialog(\ 966 SvnDialog(
967 self.trUtf8('Tagging {0} in the Subversion repository').format(name), 967 self.trUtf8('Tagging {0} in the Subversion repository').format(name),
968 "copy --message {0} {1} {2}".format(log, reposURL, url), 968 "copy --message {0} {1} {2}".format(log, reposURL, url),
969 client, log = log) 969 client, log = log)
970 QApplication.processEvents() 970 QApplication.processEvents()
971 locker = QMutexLocker(self.vcsExecutionMutex) 971 locker = QMutexLocker(self.vcsExecutionMutex)
975 dlg.showError(e.args[0]) 975 dlg.showError(e.args[0])
976 locker.unlock() 976 locker.unlock()
977 else: 977 else:
978 log = 'Deleted tag <{0}>'.format(self.tagName) 978 log = 'Deleted tag <{0}>'.format(self.tagName)
979 dlg = \ 979 dlg = \
980 SvnDialog(\ 980 SvnDialog(
981 self.trUtf8('Tagging {0} in the Subversion repository').format(name), 981 self.trUtf8('Tagging {0} in the Subversion repository').format(name),
982 "remove --message {0} {1}".format(log, url), 982 "remove --message {0} {1}".format(log, url),
983 client, log = log) 983 client, log = log)
984 QApplication.processEvents() 984 QApplication.processEvents()
985 locker = QMutexLocker(self.vcsExecutionMutex) 985 locker = QMutexLocker(self.vcsExecutionMutex)
986 try: 986 try:
987 rev = client.remove(url) 987 rev = client.remove(url)
988 except pysvn.ClientError as e: 988 except pysvn.ClientError as e:
989 dlg.showError(e.args[0]) 989 dlg.showError(e.args[0])
990 locker.unlock() 990 locker.unlock()
991 rev and dlg.showMessage(\ 991 rev and dlg.showMessage(
992 self.trUtf8("Revision {0}.\n").format(rev.number)) 992 self.trUtf8("Revision {0}.\n").format(rev.number))
993 dlg.finish() 993 dlg.finish()
994 dlg.exec_() 994 dlg.exec_()
995 995
996 def vcsRevert(self, name): 996 def vcsRevert(self, name):
1174 url2 = urlrev2 1174 url2 = urlrev2
1175 revision2 = pysvn.Revision(pysvn.opt_revision_kind.unspecified) 1175 revision2 = pysvn.Revision(pysvn.opt_revision_kind.unspecified)
1176 rev2 = "" 1176 rev2 = ""
1177 client = self.getClient() 1177 client = self.getClient()
1178 dlg = \ 1178 dlg = \
1179 SvnDialog(\ 1179 SvnDialog(
1180 self.trUtf8('Merging {0}').format(name), 1180 self.trUtf8('Merging {0}').format(name),
1181 "merge{0}{1} {2} {3} {4}".format( 1181 "merge{0}{1} {2} {3} {4}".format(
1182 (not recurse) and " --non-recursive" or "", 1182 (not recurse) and " --non-recursive" or "",
1183 force and " --force" or "", 1183 force and " --force" or "",
1184 "{0}{1}".format(url1, rev1 and ("@"+rev1) or ""), 1184 "{0}{1}".format(url1, rev1 and ("@"+rev1) or ""),
1476 log = "Copying {0} to {1}".format(name, target) 1476 log = "Copying {0} to {1}".format(name, target)
1477 else: 1477 else:
1478 log = "" 1478 log = ""
1479 target = target 1479 target = target
1480 dlg = \ 1480 dlg = \
1481 SvnDialog(\ 1481 SvnDialog(
1482 self.trUtf8('Copying {0}').format(name), 1482 self.trUtf8('Copying {0}').format(name),
1483 "copy{0} {1} {2}".format( 1483 "copy{0} {1} {2}".format(
1484 log and (" --message {0}".format(log)) or "", 1484 log and (" --message {0}".format(log)) or "",
1485 name, target), 1485 name, target),
1486 client, log = log) 1486 client, log = log)
1543 os.chdir(dname) 1543 os.chdir(dname)
1544 opts = self.options['global'] 1544 opts = self.options['global']
1545 skipchecks = "--skip-checks" in opts 1545 skipchecks = "--skip-checks" in opts
1546 client = self.getClient() 1546 client = self.getClient()
1547 dlg = \ 1547 dlg = \
1548 SvnDialog(\ 1548 SvnDialog(
1549 self.trUtf8('Subversion Set Property'), 1549 self.trUtf8('Subversion Set Property'),
1550 "propset{0}{1} {2} {3} {4}".format( 1550 "propset{0}{1} {2} {3} {4}".format(
1551 recurse and " --recurse" or "", 1551 recurse and " --recurse" or "",
1552 skipchecks and " --skip-checks" or "", 1552 skipchecks and " --skip-checks" or "",
1553 propName, propValue, 1553 propName, propValue,
1594 os.chdir(dname) 1594 os.chdir(dname)
1595 opts = self.options['global'] 1595 opts = self.options['global']
1596 skipchecks = "--skip-checks" in opts 1596 skipchecks = "--skip-checks" in opts
1597 client = self.getClient() 1597 client = self.getClient()
1598 dlg = \ 1598 dlg = \
1599 SvnDialog(\ 1599 SvnDialog(
1600 self.trUtf8('Subversion Delete Property'), 1600 self.trUtf8('Subversion Delete Property'),
1601 "propdel{0}{1} {2} {3}".format( 1601 "propdel{0}{1} {2} {3}".format(
1602 recurse and " --recurse" or "", 1602 recurse and " --recurse" or "",
1603 skipchecks and " --skip-checks" or "", 1603 skipchecks and " --skip-checks" or "",
1604 propName, " ".join(fnames)), 1604 propName, " ".join(fnames)),
1727 Public method used to view the (limited) log of a file/directory from the 1727 Public method used to view the (limited) log of a file/directory from the
1728 Subversion repository. 1728 Subversion repository.
1729 1729
1730 @param name file/directory name to show the log of (string) 1730 @param name file/directory name to show the log of (string)
1731 """ 1731 """
1732 noEntries, ok = QInputDialog.getInteger(\ 1732 noEntries, ok = QInputDialog.getInteger(
1733 None, 1733 None,
1734 self.trUtf8("Subversion Log"), 1734 self.trUtf8("Subversion Log"),
1735 self.trUtf8("Select number of entries to show."), 1735 self.trUtf8("Select number of entries to show."),
1736 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1) 1736 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1)
1737 if ok: 1737 if ok:
1758 1758
1759 @param name file/directory name to be locked (string or list of strings) 1759 @param name file/directory name to be locked (string or list of strings)
1760 @param stealIt flag indicating a forced operation (boolean) 1760 @param stealIt flag indicating a forced operation (boolean)
1761 @param parent reference to the parent object of the subversion dialog (QWidget) 1761 @param parent reference to the parent object of the subversion dialog (QWidget)
1762 """ 1762 """
1763 comment, ok = QInputDialog.getText(\ 1763 comment, ok = QInputDialog.getText(
1764 None, 1764 None,
1765 self.trUtf8("Subversion Lock"), 1765 self.trUtf8("Subversion Lock"),
1766 self.trUtf8("Enter lock comment"), 1766 self.trUtf8("Enter lock comment"),
1767 QLineEdit.Normal) 1767 QLineEdit.Normal)
1768 1768
1778 locker = QMutexLocker(self.vcsExecutionMutex) 1778 locker = QMutexLocker(self.vcsExecutionMutex)
1779 cwd = os.getcwd() 1779 cwd = os.getcwd()
1780 os.chdir(dname) 1780 os.chdir(dname)
1781 client = self.getClient() 1781 client = self.getClient()
1782 dlg = \ 1782 dlg = \
1783 SvnDialog(\ 1783 SvnDialog(
1784 self.trUtf8('Locking in the Subversion repository'), 1784 self.trUtf8('Locking in the Subversion repository'),
1785 "lock{0}{1} {2}".format( 1785 "lock{0}{1} {2}".format(
1786 stealIt and " --force" or "", 1786 stealIt and " --force" or "",
1787 comment and (" --message {0}".format(comment)) or "", 1787 comment and (" --message {0}".format(comment)) or "",
1788 " ".join(fnames)), 1788 " ".join(fnames)),
1816 locker = QMutexLocker(self.vcsExecutionMutex) 1816 locker = QMutexLocker(self.vcsExecutionMutex)
1817 cwd = os.getcwd() 1817 cwd = os.getcwd()
1818 os.chdir(dname) 1818 os.chdir(dname)
1819 client = self.getClient() 1819 client = self.getClient()
1820 dlg = \ 1820 dlg = \
1821 SvnDialog(\ 1821 SvnDialog(
1822 self.trUtf8('Unlocking in the Subversion repository'), 1822 self.trUtf8('Unlocking in the Subversion repository'),
1823 "unlock{0} {1}".format( 1823 "unlock{0} {1}".format(
1824 breakIt and " --force" or "", 1824 breakIt and " --force" or "",
1825 " ".join(fnames)), 1825 " ".join(fnames)),
1826 client, parent = parent) 1826 client, parent = parent)
1887 url = self.svnGetReposName(projectPath) 1887 url = self.svnGetReposName(projectPath)
1888 else: 1888 else:
1889 url = None 1889 url = None
1890 1890
1891 if url is None: 1891 if url is None:
1892 url, ok = QInputDialog.getText(\ 1892 url, ok = QInputDialog.getText(
1893 None, 1893 None,
1894 self.trUtf8("Repository Browser"), 1894 self.trUtf8("Repository Browser"),
1895 self.trUtf8("Enter the repository URL."), 1895 self.trUtf8("Enter the repository URL."),
1896 QLineEdit.Normal) 1896 QLineEdit.Normal)
1897 if not ok or not url: 1897 if not ok or not url:
1937 (string) 1937 (string)
1938 """ 1938 """
1939 if not isinstance(names, list): 1939 if not isinstance(names, list):
1940 names = [names] 1940 names = [names]
1941 1941
1942 clname, ok = QInputDialog.getText(\ 1942 clname, ok = QInputDialog.getText(
1943 None, 1943 None,
1944 self.trUtf8("Add to changelist"), 1944 self.trUtf8("Add to changelist"),
1945 self.trUtf8("Enter name of the changelist:"), 1945 self.trUtf8("Enter name of the changelist:"),
1946 QLineEdit.Normal) 1946 QLineEdit.Normal)
1947 if not ok or not clname: 1947 if not ok or not clname:

eric ide

mercurial