eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py

changeset 7260
4cc6f121119a
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7259:7c017076c12e 7260:4cc6f121119a
11 import os 11 import os
12 import shutil 12 import shutil
13 import time 13 import time
14 from urllib.parse import quote 14 from urllib.parse import quote
15 15
16 from PyQt5.QtCore import Qt, QMutexLocker, pyqtSignal, QRegExp, QDateTime, \ 16 from PyQt5.QtCore import (
17 QCoreApplication 17 Qt, QMutexLocker, pyqtSignal, QRegExp, QDateTime, QCoreApplication
18 )
18 from PyQt5.QtWidgets import QLineEdit, QDialog, QInputDialog, QApplication 19 from PyQt5.QtWidgets import QLineEdit, QDialog, QInputDialog, QApplication
19 20
20 from E5Gui.E5Application import e5App 21 from E5Gui.E5Application import e5App
21 from E5Gui import E5MessageBox 22 from E5Gui import E5MessageBox
22 23
83 ] 84 ]
84 85
85 self.commandHistory = [] 86 self.commandHistory = []
86 self.wdHistory = [] 87 self.wdHistory = []
87 88
88 if pysvn.version >= (1, 4, 3, 0) and \ 89 if (
89 "SVN_ASP_DOT_NET_HACK" in os.environ: 90 pysvn.version >= (1, 4, 3, 0) and
91 "SVN_ASP_DOT_NET_HACK" in os.environ
92 ):
90 self.adminDir = '_svn' 93 self.adminDir = '_svn'
91 else: 94 else:
92 self.adminDir = '.svn' 95 self.adminDir = '.svn'
93 96
94 self.log = None 97 self.log = None
354 357
355 if self.otherData["standardLayout"]: 358 if self.otherData["standardLayout"]:
356 if tag is None or tag == '': 359 if tag is None or tag == '':
357 svnUrl = '{0}/trunk'.format(vcsDir) 360 svnUrl = '{0}/trunk'.format(vcsDir)
358 else: 361 else:
359 if not tag.startswith('tags') and \ 362 if (
360 not tag.startswith('branches'): 363 not tag.startswith('tags') and
364 not tag.startswith('branches')
365 ):
361 type_, ok = QInputDialog.getItem( 366 type_, ok = QInputDialog.getItem(
362 None, 367 None,
363 self.tr("Subversion Checkout"), 368 self.tr("Subversion Checkout"),
364 self.tr( 369 self.tr(
365 "The tag must be a normal tag (tags) or" 370 "The tag must be a normal tag (tags) or"
419 424
420 if self.otherData["standardLayout"]: 425 if self.otherData["standardLayout"]:
421 if tag is None or tag == '': 426 if tag is None or tag == '':
422 svnUrl = '{0}/trunk'.format(vcsDir) 427 svnUrl = '{0}/trunk'.format(vcsDir)
423 else: 428 else:
424 if not tag.startswith('tags') and \ 429 if (
425 not tag.startswith('branches'): 430 not tag.startswith('tags') and
431 not tag.startswith('branches')
432 ):
426 type_, ok = QInputDialog.getItem( 433 type_, ok = QInputDialog.getItem(
427 None, 434 None,
428 self.tr("Subversion Export"), 435 self.tr("Subversion Export"),
429 self.tr( 436 self.tr(
430 "The tag must be a normal tag (tags) or" 437 "The tag must be a normal tag (tags) or"
509 # check for commit of the project 516 # check for commit of the project
510 if os.path.isdir(nam): 517 if os.path.isdir(nam):
511 project = e5App().getObject("Project") 518 project = e5App().getObject("Project")
512 if nam == project.getProjectPath(): 519 if nam == project.getProjectPath():
513 ok &= project.checkAllScriptsDirty( 520 ok &= project.checkAllScriptsDirty(
514 reportSyntaxErrors=True) and \ 521 reportSyntaxErrors=True) and project.checkDirty()
515 project.checkDirty()
516 continue 522 continue
517 elif os.path.isfile(nam): 523 elif os.path.isfile(nam):
518 editor = e5App().getObject("ViewManager")\ 524 editor = e5App().getObject("ViewManager").getOpenEditor(
519 .getOpenEditor(nam) 525 nam)
520 if editor: 526 if editor:
521 ok &= editor.checkDirty() 527 ok &= editor.checkDirty()
522 if not ok: 528 if not ok:
523 break 529 break
524 530
534 return 540 return
535 541
536 if self.__commitDialog is not None: 542 if self.__commitDialog is not None:
537 msg = self.__commitDialog.logMessage() 543 msg = self.__commitDialog.logMessage()
538 if self.__commitDialog.hasChangelists(): 544 if self.__commitDialog.hasChangelists():
539 changelists, keepChangelists = \ 545 changelists, keepChangelists = (
540 self.__commitDialog.changelistsData() 546 self.__commitDialog.changelistsData()
547 )
541 else: 548 else:
542 changelists, keepChangelists = [], False 549 changelists, keepChangelists = [], False
543 self.__commitDialog.deleteLater() 550 self.__commitDialog.deleteLater()
544 self.__commitDialog = None 551 self.__commitDialog = None
545 else: 552 else:
552 dname, fnames = self.splitPathList(name) 559 dname, fnames = self.splitPathList(name)
553 else: 560 else:
554 dname, fname = self.splitPath(name) 561 dname, fname = self.splitPath(name)
555 fnames = [fname] 562 fnames = [fname]
556 563
557 if self.svnGetReposName(dname).startswith('http') or \ 564 if (
558 self.svnGetReposName(dname).startswith('svn'): 565 self.svnGetReposName(dname).startswith('http') or
566 self.svnGetReposName(dname).startswith('svn')
567 ):
559 noDialog = False 568 noDialog = False
560 569
561 locker = QMutexLocker(self.vcsExecutionMutex) 570 locker = QMutexLocker(self.vcsExecutionMutex)
562 cwd = os.getcwd() 571 cwd = os.getcwd()
563 os.chdir(dname) 572 os.chdir(dname)
672 repodir = dname 681 repodir = dname
673 while not os.path.isdir(os.path.join(repodir, self.adminDir)): 682 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
674 repodir = os.path.dirname(repodir) 683 repodir = os.path.dirname(repodir)
675 if os.path.splitdrive(repodir)[1] == os.sep: 684 if os.path.splitdrive(repodir)[1] == os.sep:
676 return # oops, project is not version controlled 685 return # oops, project is not version controlled
677 while os.path.normcase(dname) != os.path.normcase(repodir) and \ 686 while (
687 os.path.normcase(dname) != os.path.normcase(repodir) and
678 (os.path.normcase(dname) not in self.statusCache or 688 (os.path.normcase(dname) not in self.statusCache or
679 self.statusCache[os.path.normcase(dname)] == 689 self.statusCache[os.path.normcase(dname)] ==
680 self.canBeAdded): 690 self.canBeAdded)
691 ):
681 # add directories recursively, if they aren't in the 692 # add directories recursively, if they aren't in the
682 # repository already 693 # repository already
683 tree.insert(-1, dname) 694 tree.insert(-1, dname)
684 dname = os.path.dirname(dname) 695 dname = os.path.dirname(dname)
685 wdir = dname 696 wdir = dname
701 while not os.path.isdir( 712 while not os.path.isdir(
702 os.path.join(repodir, self.adminDir)): 713 os.path.join(repodir, self.adminDir)):
703 repodir = os.path.dirname(repodir) 714 repodir = os.path.dirname(repodir)
704 if os.path.splitdrive(repodir)[1] == os.sep: 715 if os.path.splitdrive(repodir)[1] == os.sep:
705 return # oops, project is not version controlled 716 return # oops, project is not version controlled
706 while (os.path.normcase(d) != 717 while (
707 os.path.normcase(repodir)) and \ 718 (os.path.normcase(d) != os.path.normcase(repodir)) and
708 (d not in tree2 + tree) and \ 719 (d not in tree2 + tree) and
709 (os.path.normcase(d) not in self.statusCache or 720 (os.path.normcase(d) not in self.statusCache or
710 self.statusCache[os.path.normcase(d)] == 721 self.statusCache[os.path.normcase(d)] ==
711 self.canBeAdded): 722 self.canBeAdded)
723 ):
712 tree2.append(d) 724 tree2.append(d)
713 d = os.path.dirname(d) 725 d = os.path.dirname(d)
714 else: 726 else:
715 while not os.path.exists(os.path.join(d, self.adminDir)): 727 while not os.path.exists(os.path.join(d, self.adminDir)):
716 if d in tree2 + tree: 728 if d in tree2 + tree:
781 while not os.path.isdir( 793 while not os.path.isdir(
782 os.path.join(repodir, self.adminDir)): 794 os.path.join(repodir, self.adminDir)):
783 repodir = os.path.dirname(repodir) 795 repodir = os.path.dirname(repodir)
784 if os.path.splitdrive(repodir)[1] == os.sep: 796 if os.path.splitdrive(repodir)[1] == os.sep:
785 return # oops, project is not version controlled 797 return # oops, project is not version controlled
786 while (os.path.normcase(d) != 798 while (
787 os.path.normcase(repodir)) and \ 799 (os.path.normcase(d) != os.path.normcase(repodir)) and
788 (d not in tree) and \ 800 (d not in tree) and
789 (os.path.normcase(d) not in self.statusCache or 801 (os.path.normcase(d) not in self.statusCache or
790 self.statusCache[os.path.normcase(d)] == 802 self.statusCache[os.path.normcase(d)] ==
791 self.canBeAdded): 803 self.canBeAdded)
804 ):
792 tree.append(d) 805 tree.append(d)
793 d = os.path.dirname(d) 806 d = os.path.dirname(d)
794 else: 807 else:
795 while not os.path.exists(os.path.join(d, self.adminDir)): 808 while not os.path.exists(os.path.join(d, self.adminDir)):
796 # add directories recursively, 809 # add directories recursively,
806 repodir = dname 819 repodir = dname
807 while not os.path.isdir(os.path.join(repodir, self.adminDir)): 820 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
808 repodir = os.path.dirname(repodir) 821 repodir = os.path.dirname(repodir)
809 if os.path.splitdrive(repodir)[1] == os.sep: 822 if os.path.splitdrive(repodir)[1] == os.sep:
810 return # oops, project is not version controlled 823 return # oops, project is not version controlled
811 while (os.path.normcase(dname) != 824 while (
812 os.path.normcase(repodir)) and \ 825 (os.path.normcase(dname) != os.path.normcase(repodir)) and
813 (os.path.normcase(dname) not in self.statusCache or 826 (os.path.normcase(dname) not in self.statusCache or
814 self.statusCache[os.path.normcase(dname)] == 827 self.statusCache[os.path.normcase(dname)] ==
815 self.canBeAdded): 828 self.canBeAdded)
829 ):
816 # add directories recursively, if they aren't in the 830 # add directories recursively, if they aren't in the
817 # repository already 831 # repository already
818 tree.insert(-1, dname) 832 tree.insert(-1, dname)
819 dname = os.path.dirname(dname) 833 dname = os.path.dirname(dname)
820 else: 834 else:
940 log = "Moving {0} to {1}".format(name, target) 954 log = "Moving {0} to {1}".format(name, target)
941 else: 955 else:
942 log = "" 956 log = ""
943 target = target 957 target = target
944 if not noDialog: 958 if not noDialog:
945 dlg = \ 959 dlg = SvnDialog(
946 SvnDialog( 960 self.tr('Moving {0}').format(name),
947 self.tr('Moving {0}').format(name), 961 "move{0}{1} {2} {3}".format(
948 "move{0}{1} {2} {3}".format( 962 force and " --force" or "",
949 force and " --force" or "", 963 log and (" --message {0}".format(log)) or "",
950 log and (" --message {0}".format(log)) or "", 964 name, target),
951 name, target), 965 client, log=log)
952 client, log=log)
953 QApplication.processEvents() 966 QApplication.processEvents()
954 locker = QMutexLocker(self.vcsExecutionMutex) 967 locker = QMutexLocker(self.vcsExecutionMutex)
955 try: 968 try:
956 client.move(name, target, force=force) 969 client.move(name, target, force=force)
957 res = True 970 res = True
1129 recurse = True 1142 recurse = True
1130 1143
1131 project = e5App().getObject("Project") 1144 project = e5App().getObject("Project")
1132 names = [project.getRelativePath(nam) for nam in name] 1145 names = [project.getRelativePath(nam) for nam in name]
1133 if names[0]: 1146 if names[0]:
1134 from UI.DeleteFilesConfirmationDialog import \ 1147 from UI.DeleteFilesConfirmationDialog import (
1135 DeleteFilesConfirmationDialog 1148 DeleteFilesConfirmationDialog
1149 )
1136 dia = DeleteFilesConfirmationDialog( 1150 dia = DeleteFilesConfirmationDialog(
1137 self.parent(), 1151 self.parent(),
1138 self.tr("Revert changes"), 1152 self.tr("Revert changes"),
1139 self.tr( 1153 self.tr(
1140 "Do you really want to revert all changes to these files" 1154 "Do you really want to revert all changes to these files"
1328 else: 1342 else:
1329 url2 = urlrev2 1343 url2 = urlrev2
1330 revision2 = pysvn.Revision(pysvn.opt_revision_kind.unspecified) 1344 revision2 = pysvn.Revision(pysvn.opt_revision_kind.unspecified)
1331 rev2 = "" 1345 rev2 = ""
1332 client = self.getClient() 1346 client = self.getClient()
1333 dlg = \ 1347 dlg = SvnDialog(
1334 SvnDialog( 1348 self.tr('Merging {0}').format(name),
1335 self.tr('Merging {0}').format(name), 1349 "merge{0}{1} {2} {3} {4}".format(
1336 "merge{0}{1} {2} {3} {4}".format( 1350 (not recurse) and " --non-recursive" or "",
1337 (not recurse) and " --non-recursive" or "", 1351 force and " --force" or "",
1338 force and " --force" or "", 1352 "{0}{1}".format(url1, rev1 and ("@" + rev1) or ""),
1339 "{0}{1}".format(url1, rev1 and ("@" + rev1) or ""), 1353 "{0}{1}".format(url2, rev2 and ("@" + rev2) or ""),
1340 "{0}{1}".format(url2, rev2 and ("@" + rev2) or ""), 1354 fname),
1341 fname), 1355 client)
1342 client)
1343 QApplication.processEvents() 1356 QApplication.processEvents()
1344 try: 1357 try:
1345 client.merge(url1, revision1, url2, revision2, fname, 1358 client.merge(url1, revision1, url2, revision2, fname,
1346 recurse=recurse, force=force) 1359 recurse=recurse, force=force)
1347 except pysvn.ClientError as e: 1360 except pysvn.ClientError as e:
1475 return names 1488 return names
1476 1489
1477 from .SvnDialogMixin import SvnDialogMixin 1490 from .SvnDialogMixin import SvnDialogMixin
1478 mixin = SvnDialogMixin() 1491 mixin = SvnDialogMixin()
1479 client = self.getClient() 1492 client = self.getClient()
1480 client.callback_get_login = \ 1493 client.callback_get_login = mixin._clientLoginCallback
1481 mixin._clientLoginCallback 1494 client.callback_ssl_server_trust_prompt = (
1482 client.callback_ssl_server_trust_prompt = \
1483 mixin._clientSslServerTrustPromptCallback 1495 mixin._clientSslServerTrustPromptCallback
1496 )
1484 1497
1485 try: 1498 try:
1486 locker = QMutexLocker(self.vcsExecutionMutex) 1499 locker = QMutexLocker(self.vcsExecutionMutex)
1487 allFiles = client.status(dname, recurse=True, get_all=True, 1500 allFiles = client.status(dname, recurse=True, get_all=True,
1488 ignore=True, update=False) 1501 ignore=True, update=False)
1493 name = os.path.normcase(file.path) 1506 name = os.path.normcase(file.path)
1494 if self.__isVersioned(file): 1507 if self.__isVersioned(file):
1495 if name in names: 1508 if name in names:
1496 names[name] = self.canBeCommitted 1509 names[name] = self.canBeCommitted
1497 dn = name 1510 dn = name
1498 while os.path.splitdrive(dn)[1] != os.sep and \ 1511 while (
1499 dn != repodir: 1512 os.path.splitdrive(dn)[1] != os.sep and
1513 dn != repodir
1514 ):
1500 dn = os.path.dirname(dn) 1515 dn = os.path.dirname(dn)
1501 if dn in self.statusCache and \ 1516 if (
1502 self.statusCache[dn] == self.canBeCommitted: 1517 dn in self.statusCache and
1518 self.statusCache[dn] ==
1519 self.canBeCommitted
1520 ):
1503 break 1521 break
1504 self.statusCache[dn] = self.canBeCommitted 1522 self.statusCache[dn] = self.canBeCommitted
1505 self.statusCache[name] = self.canBeCommitted 1523 self.statusCache[name] = self.canBeCommitted
1506 if dirs: 1524 if dirs:
1507 for d in dirs: 1525 for d in dirs:
1551 1569
1552 if not found: 1570 if not found:
1553 from .SvnDialogMixin import SvnDialogMixin 1571 from .SvnDialogMixin import SvnDialogMixin
1554 mixin = SvnDialogMixin() 1572 mixin = SvnDialogMixin()
1555 client = self.getClient() 1573 client = self.getClient()
1556 client.callback_get_login = \ 1574 client.callback_get_login = mixin._clientLoginCallback
1557 mixin._clientLoginCallback 1575 client.callback_ssl_server_trust_prompt = (
1558 client.callback_ssl_server_trust_prompt = \
1559 mixin._clientSslServerTrustPromptCallback 1576 mixin._clientSslServerTrustPromptCallback
1577 )
1560 1578
1561 try: 1579 try:
1562 locker = QMutexLocker(self.vcsExecutionMutex) 1580 locker = QMutexLocker(self.vcsExecutionMutex)
1563 allFiles = client.status(dname, recurse=True, get_all=True, 1581 allFiles = client.status(dname, recurse=True, get_all=True,
1564 ignore=True, update=False) 1582 ignore=True, update=False)
1667 self.wdHistory.insert(0, wd) 1685 self.wdHistory.insert(0, wd)
1668 1686
1669 args = [] 1687 args = []
1670 self.addArguments(args, commandList) 1688 self.addArguments(args, commandList)
1671 1689
1672 from Plugins.VcsPlugins.vcsSubversion.SvnDialog import \ 1690 from Plugins.VcsPlugins.vcsSubversion.SvnDialog import (
1673 SvnDialog as SvnProcessDialog 1691 SvnDialog as SvnProcessDialog
1692 )
1674 dia = SvnProcessDialog(self.tr('Subversion command')) 1693 dia = SvnProcessDialog(self.tr('Subversion command'))
1675 res = dia.startProcess(args, wd) 1694 res = dia.startProcess(args, wd)
1676 if res: 1695 if res:
1677 dia.exec_() 1696 dia.exec_()
1678 1697
1734 """<tr><td><b>Committed revision</b></td><td>{5}</td></tr>""" 1753 """<tr><td><b>Committed revision</b></td><td>{5}</td></tr>"""
1735 """<tr><td><b>Committed date</b></td><td>{6}</td></tr>""" 1754 """<tr><td><b>Committed date</b></td><td>{6}</td></tr>"""
1736 """<tr><td><b>Comitted time</b></td><td>{7}</td></tr>""" 1755 """<tr><td><b>Comitted time</b></td><td>{7}</td></tr>"""
1737 """<tr><td><b>Last author</b></td><td>{8}</td></tr>""" 1756 """<tr><td><b>Last author</b></td><td>{8}</td></tr>"""
1738 """</table>""" 1757 """</table>"""
1739 )\ 1758 ).format(
1740 .format(".".join([str(v) for v in pysvn.version]), 1759 ".".join([str(v) for v in pysvn.version]),
1741 ".".join([str(v) for v in pysvn.svn_version[:3]]), 1760 ".".join([str(v) for v in pysvn.svn_version[:3]]),
1742 apiVersion, 1761 apiVersion,
1743 entry.url, 1762 entry.url,
1744 entry.revision.number, 1763 entry.revision.number,
1745 entry.commit_revision.number, 1764 entry.commit_revision.number,
1746 time.strftime( 1765 time.strftime(
1747 "%Y-%m-%d", time.localtime(entry.commit_time)), 1766 "%Y-%m-%d", time.localtime(entry.commit_time)),
1748 hmsz, 1767 hmsz,
1749 entry.commit_author 1768 entry.commit_author
1750 ) 1769 )
1751 1770
1752 ########################################################################### 1771 ###########################################################################
1753 ## Public Subversion specific methods are below. 1772 ## Public Subversion specific methods are below.
1754 ########################################################################### 1773 ###########################################################################
1755 1774
1826 target = self.__svnURL(target) 1845 target = self.__svnURL(target)
1827 log = "Copying {0} to {1}".format(name, target) 1846 log = "Copying {0} to {1}".format(name, target)
1828 else: 1847 else:
1829 log = "" 1848 log = ""
1830 target = target 1849 target = target
1831 dlg = \ 1850 dlg = SvnDialog(
1832 SvnDialog( 1851 self.tr('Copying {0}').format(name),
1833 self.tr('Copying {0}').format(name), 1852 "copy{0} {1} {2}".format(
1834 "copy{0} {1} {2}".format( 1853 log and (" --message {0}".format(log)) or "",
1835 log and (" --message {0}".format(log)) or "", 1854 name, target),
1836 name, target), 1855 client, log=log)
1837 client, log=log)
1838 QApplication.processEvents() 1856 QApplication.processEvents()
1839 locker = QMutexLocker(self.vcsExecutionMutex) 1857 locker = QMutexLocker(self.vcsExecutionMutex)
1840 try: 1858 try:
1841 client.copy(name, target) 1859 client.copy(name, target)
1842 res = True 1860 res = True
1844 res = False 1862 res = False
1845 dlg.showError(e.args[0]) 1863 dlg.showError(e.args[0])
1846 locker.unlock() 1864 locker.unlock()
1847 dlg.finish() 1865 dlg.finish()
1848 dlg.exec_() 1866 dlg.exec_()
1849 if res and \ 1867 if (
1850 not rx_prot.exactMatch(target) and \ 1868 res and
1851 target.startswith(project.getProjectPath()): 1869 not rx_prot.exactMatch(target) and
1870 target.startswith(project.getProjectPath())
1871 ):
1852 if os.path.isdir(name): 1872 if os.path.isdir(name):
1853 project.copyDirectory(name, target) 1873 project.copyDirectory(name, target)
1854 else: 1874 else:
1855 project.appendFile(target) 1875 project.appendFile(target)
1856 return res 1876 return res
1899 cwd = os.getcwd() 1919 cwd = os.getcwd()
1900 os.chdir(dname) 1920 os.chdir(dname)
1901 opts = self.options['global'] 1921 opts = self.options['global']
1902 skipchecks = "--skip-checks" in opts 1922 skipchecks = "--skip-checks" in opts
1903 client = self.getClient() 1923 client = self.getClient()
1904 dlg = \ 1924 dlg = SvnDialog(
1905 SvnDialog( 1925 self.tr('Subversion Set Property'),
1906 self.tr('Subversion Set Property'), 1926 "propset{0}{1} {2} {3} {4}".format(
1907 "propset{0}{1} {2} {3} {4}".format( 1927 recurse and " --recurse" or "",
1908 recurse and " --recurse" or "", 1928 skipchecks and " --skip-checks" or "",
1909 skipchecks and " --skip-checks" or "", 1929 propName, propValue,
1910 propName, propValue, 1930 " ".join(fnames)),
1911 " ".join(fnames)), 1931 client)
1912 client)
1913 QApplication.processEvents() 1932 QApplication.processEvents()
1914 try: 1933 try:
1915 for name in fnames: 1934 for name in fnames:
1916 client.propset(propName, propValue, name, 1935 client.propset(propName, propValue, name,
1917 recurse=recurse, skip_checks=skipchecks) 1936 recurse=recurse, skip_checks=skipchecks)
1953 cwd = os.getcwd() 1972 cwd = os.getcwd()
1954 os.chdir(dname) 1973 os.chdir(dname)
1955 opts = self.options['global'] 1974 opts = self.options['global']
1956 skipchecks = "--skip-checks" in opts 1975 skipchecks = "--skip-checks" in opts
1957 client = self.getClient() 1976 client = self.getClient()
1958 dlg = \ 1977 dlg = SvnDialog(
1959 SvnDialog( 1978 self.tr('Subversion Delete Property'),
1960 self.tr('Subversion Delete Property'), 1979 "propdel{0}{1} {2} {3}".format(
1961 "propdel{0}{1} {2} {3}".format( 1980 recurse and " --recurse" or "",
1962 recurse and " --recurse" or "", 1981 skipchecks and " --skip-checks" or "",
1963 skipchecks and " --skip-checks" or "", 1982 propName, " ".join(fnames)),
1964 propName, " ".join(fnames)), 1983 client)
1965 client)
1966 QApplication.processEvents() 1984 QApplication.processEvents()
1967 try: 1985 try:
1968 for name in fnames: 1986 for name in fnames:
1969 client.propdel(propName, name, 1987 client.propdel(propName, name,
1970 recurse=recurse, skip_checks=skipchecks) 1988 recurse=recurse, skip_checks=skipchecks)
1993 res = self.tagbranchList.start(path, tags) 2011 res = self.tagbranchList.start(path, tags)
1994 if res: 2012 if res:
1995 if tags: 2013 if tags:
1996 self.tagsList = self.tagbranchList.getTagList() 2014 self.tagsList = self.tagbranchList.getTagList()
1997 if not self.showedTags: 2015 if not self.showedTags:
1998 self.allTagsBranchesList = \ 2016 self.allTagsBranchesList = (
1999 self.allTagsBranchesList + self.tagsList 2017 self.allTagsBranchesList +
2018 self.tagsList
2019 )
2000 self.showedTags = True 2020 self.showedTags = True
2001 elif not tags: 2021 elif not tags:
2002 self.branchesList = self.tagbranchList.getTagList() 2022 self.branchesList = self.tagbranchList.getTagList()
2003 if not self.showedBranches: 2023 if not self.showedBranches:
2004 self.allTagsBranchesList = \ 2024 self.allTagsBranchesList = (
2005 self.allTagsBranchesList + self.branchesList 2025 self.allTagsBranchesList +
2026 self.branchesList
2027 )
2006 self.showedBranches = True 2028 self.showedBranches = True
2007 2029
2008 def svnBlame(self, name): 2030 def svnBlame(self, name):
2009 """ 2031 """
2010 Public method to show the output of the svn blame command. 2032 Public method to show the output of the svn blame command.
2256 2278
2257 locker = QMutexLocker(self.vcsExecutionMutex) 2279 locker = QMutexLocker(self.vcsExecutionMutex)
2258 cwd = os.getcwd() 2280 cwd = os.getcwd()
2259 os.chdir(dname) 2281 os.chdir(dname)
2260 client = self.getClient() 2282 client = self.getClient()
2261 dlg = \ 2283 dlg = SvnDialog(
2262 SvnDialog( 2284 self.tr('Locking in the Subversion repository'),
2263 self.tr('Locking in the Subversion repository'), 2285 "lock{0}{1} {2}".format(
2264 "lock{0}{1} {2}".format( 2286 stealIt and " --force" or "",
2265 stealIt and " --force" or "", 2287 comment and (" --message {0}".format(comment)) or "",
2266 comment and (" --message {0}".format(comment)) or "", 2288 " ".join(fnames)),
2267 " ".join(fnames)), 2289 client, parent=parent)
2268 client, parent=parent)
2269 QApplication.processEvents() 2290 QApplication.processEvents()
2270 try: 2291 try:
2271 client.lock(fnames, comment, force=stealIt) 2292 client.lock(fnames, comment, force=stealIt)
2272 except pysvn.ClientError as e: 2293 except pysvn.ClientError as e:
2273 dlg.showError(e.args[0]) 2294 dlg.showError(e.args[0])
2296 2317
2297 locker = QMutexLocker(self.vcsExecutionMutex) 2318 locker = QMutexLocker(self.vcsExecutionMutex)
2298 cwd = os.getcwd() 2319 cwd = os.getcwd()
2299 os.chdir(dname) 2320 os.chdir(dname)
2300 client = self.getClient() 2321 client = self.getClient()
2301 dlg = \ 2322 dlg = SvnDialog(
2302 SvnDialog( 2323 self.tr('Unlocking in the Subversion repository'),
2303 self.tr('Unlocking in the Subversion repository'), 2324 "unlock{0} {1}".format(breakIt and " --force" or "",
2304 "unlock{0} {1}".format( 2325 " ".join(fnames)),
2305 breakIt and " --force" or "", 2326 client, parent=parent)
2306 " ".join(fnames)),
2307 client, parent=parent)
2308 QApplication.processEvents() 2327 QApplication.processEvents()
2309 try: 2328 try:
2310 client.unlock(fnames, force=breakIt) 2329 client.unlock(fnames, force=breakIt)
2311 except pysvn.ClientError as e: 2330 except pysvn.ClientError as e:
2312 dlg.showError(e.args[0]) 2331 dlg.showError(e.args[0])
2344 msg = "switch {0} {1}".format(newUrl, projectPath) 2363 msg = "switch {0} {1}".format(newUrl, projectPath)
2345 else: 2364 else:
2346 msg = "relocate {0} {1} {2}".format(currUrl, newUrl, 2365 msg = "relocate {0} {1} {2}".format(currUrl, newUrl,
2347 projectPath) 2366 projectPath)
2348 client = self.getClient() 2367 client = self.getClient()
2349 dlg = \ 2368 dlg = SvnDialog(self.tr('Relocating'), msg, client)
2350 SvnDialog(self.tr('Relocating'), msg, client)
2351 QApplication.processEvents() 2369 QApplication.processEvents()
2352 locker = QMutexLocker(self.vcsExecutionMutex) 2370 locker = QMutexLocker(self.vcsExecutionMutex)
2353 try: 2371 try:
2354 if inside: 2372 if inside:
2355 client.switch(projectPath, newUrl) 2373 client.switch(projectPath, newUrl)
2398 (string) 2416 (string)
2399 """ 2417 """
2400 if not isinstance(names, list): 2418 if not isinstance(names, list):
2401 names = [names] 2419 names = [names]
2402 client = self.getClient() 2420 client = self.getClient()
2403 dlg = \ 2421 dlg = SvnDialog(
2404 SvnDialog(self.tr('Remove from changelist'), 2422 self.tr('Remove from changelist'),
2405 "changelist --remove {0}".format(" ".join(names)), 2423 "changelist --remove {0}".format(" ".join(names)),
2406 client) 2424 client)
2407 QApplication.processEvents() 2425 QApplication.processEvents()
2408 locker = QMutexLocker(self.vcsExecutionMutex) 2426 locker = QMutexLocker(self.vcsExecutionMutex)
2409 try: 2427 try:
2410 for name in names: 2428 for name in names:
2411 client.remove_from_changelists(name) 2429 client.remove_from_changelists(name)
2435 0, True) 2453 0, True)
2436 if not ok or not clname: 2454 if not ok or not clname:
2437 return 2455 return
2438 2456
2439 client = self.getClient() 2457 client = self.getClient()
2440 dlg = \ 2458 dlg = SvnDialog(
2441 SvnDialog(self.tr('Add to changelist'), 2459 self.tr('Add to changelist'),
2442 "changelist {0}".format(" ".join(names)), 2460 "changelist {0}".format(" ".join(names)),
2443 client) 2461 client)
2444 QApplication.processEvents() 2462 QApplication.processEvents()
2445 locker = QMutexLocker(self.vcsExecutionMutex) 2463 locker = QMutexLocker(self.vcsExecutionMutex)
2446 try: 2464 try:
2447 for name in names: 2465 for name in names:
2448 client.add_to_changelist(name, clname, 2466 client.add_to_changelist(name, clname,
2494 Public method to upgrade the working copy format. 2512 Public method to upgrade the working copy format.
2495 2513
2496 @param path directory name to show change lists for (string) 2514 @param path directory name to show change lists for (string)
2497 """ 2515 """
2498 client = self.getClient() 2516 client = self.getClient()
2499 dlg = \ 2517 dlg = SvnDialog(
2500 SvnDialog(self.tr('Upgrade'), 2518 self.tr('Upgrade'),
2501 "upgrade {0}".format(path), 2519 "upgrade {0}".format(path),
2502 client) 2520 client)
2503 QApplication.processEvents() 2521 QApplication.processEvents()
2504 locker = QMutexLocker(self.vcsExecutionMutex) 2522 locker = QMutexLocker(self.vcsExecutionMutex)
2505 try: 2523 try:
2506 client.upgrade(path) 2524 client.upgrade(path)
2507 except pysvn.ClientError as e: 2525 except pysvn.ClientError as e:
2588 @param project reference to the project object 2606 @param project reference to the project object
2589 @return the project helper object 2607 @return the project helper object
2590 """ 2608 """
2591 helper = self.__plugin.getProjectHelper() 2609 helper = self.__plugin.getProjectHelper()
2592 helper.setObjects(self, project) 2610 helper.setObjects(self, project)
2593 self.__wcng = \ 2611 self.__wcng = (
2594 os.path.exists( 2612 os.path.exists(
2595 os.path.join(project.getProjectPath(), ".svn", "format")) or \ 2613 os.path.join(project.getProjectPath(), ".svn", "format")) or
2596 os.path.exists( 2614 os.path.exists(
2597 os.path.join(project.getProjectPath(), "_svn", "format")) or \ 2615 os.path.join(project.getProjectPath(), "_svn", "format")) or
2598 os.path.exists( 2616 os.path.exists(
2599 os.path.join(project.getProjectPath(), ".svn", "wc.db")) or \ 2617 os.path.join(project.getProjectPath(), ".svn", "wc.db")) or
2600 os.path.exists( 2618 os.path.exists(
2601 os.path.join(project.getProjectPath(), "_svn", "wc.db")) 2619 os.path.join(project.getProjectPath(), "_svn", "wc.db"))
2620 )
2602 return helper 2621 return helper
2603 2622
2604 ########################################################################### 2623 ###########################################################################
2605 ## Status Monitor Thread methods 2624 ## Status Monitor Thread methods
2606 ########################################################################### 2625 ###########################################################################

eric ide

mercurial