src/eric7/Plugins/VcsPlugins/vcsSubversion/subversion.py

branch
eric7
changeset 10438
4cd7e5a8b3cf
parent 10403
ea3320d5e8e9
child 10439
21c28b0f9e41
equal deleted inserted replaced
10437:2f70ca07f0af 10438:4cd7e5a8b3cf
38 def __init__(self, plugin, parent=None, name=None): 38 def __init__(self, plugin, parent=None, name=None):
39 """ 39 """
40 Constructor 40 Constructor
41 41
42 @param plugin reference to the plugin object 42 @param plugin reference to the plugin object
43 @param parent parent widget (QWidget) 43 @type VcsSubversionPlugin
44 @param name name of this object (string) 44 @param parent parent widget
45 @type QWidget
46 @param name name of this object
47 @type str
45 """ 48 """
46 VersionControl.__init__(self, parent, name) 49 VersionControl.__init__(self, parent, name)
47 self.defaultOptions = { 50 self.defaultOptions = {
48 "global": [""], 51 "global": [""],
49 "commit": [""], 52 "commit": [""],
112 115
113 def getPlugin(self): 116 def getPlugin(self):
114 """ 117 """
115 Public method to get a reference to the plugin object. 118 Public method to get a reference to the plugin object.
116 119
117 @return reference to the plugin object (VcsSubversionPlugin) 120 @return reference to the plugin object
121 @rtype VcsSubversionPlugin
118 """ 122 """
119 return self.__plugin 123 return self.__plugin
120 124
121 def vcsShutdown(self): 125 def vcsShutdown(self):
122 """ 126 """
144 def vcsExists(self): 148 def vcsExists(self):
145 """ 149 """
146 Public method used to test for the presence of the svn executable. 150 Public method used to test for the presence of the svn executable.
147 151
148 @return flag indicating the existance (boolean) and an error message 152 @return flag indicating the existance (boolean) and an error message
149 (string) 153
154 @rtype str
150 """ 155 """
151 self.versionStr = "" 156 self.versionStr = ""
152 errMsg = "" 157 errMsg = ""
153 ioEncoding = Preferences.getSystem("IOEncoding") 158 ioEncoding = Preferences.getSystem("IOEncoding")
154 159
190 195
191 The subversion repository has to be initialized from outside eric 196 The subversion repository has to be initialized from outside eric
192 because the respective command always works locally. Therefore we 197 because the respective command always works locally. Therefore we
193 always return TRUE without doing anything. 198 always return TRUE without doing anything.
194 199
195 @param vcsDir name of the VCS directory (string) 200 @param vcsDir name of the VCS directory
196 @param noDialog flag indicating quiet operations (boolean) 201 @type str
197 @return always TRUE 202 @param noDialog flag indicating quiet operations
203 @type bool
204 @return always True
205 @rtype bool
198 """ 206 """
199 return True 207 return True
200 208
201 def vcsConvertProject(self, vcsDataDict, project, addAll=True): 209 def vcsConvertProject(self, vcsDataDict, project, addAll=True):
202 """ 210 """
271 Public method used to import the project into the Subversion 279 Public method used to import the project into the Subversion
272 repository. 280 repository.
273 281
274 @param vcsDataDict dictionary of data required for the import 282 @param vcsDataDict dictionary of data required for the import
275 @type dict 283 @type dict
276 @param projectDir project directory (string) 284 @param projectDir project directory
277 @type str 285 @type str
278 @param noDialog flag indicating quiet operations 286 @param noDialog flag indicating quiet operations
279 @type bool 287 @type bool
280 @param addAll flag indicating to add all files to the repository 288 @param addAll flag indicating to add all files to the repository
281 @type bool 289 @type bool
337 """ 345 """
338 Public method used to check the project out of the Subversion 346 Public method used to check the project out of the Subversion
339 repository. 347 repository.
340 348
341 @param vcsDataDict dictionary of data required for the checkout 349 @param vcsDataDict dictionary of data required for the checkout
342 @param projectDir project directory to create (string) 350 @type dict
351 @param projectDir project directory to create
352 @type str
343 @param noDialog flag indicating quiet operations 353 @param noDialog flag indicating quiet operations
344 @return flag indicating an execution without errors (boolean) 354 @type bool
355 @return flag indicating an execution without errors
356 @rtype bool
345 """ 357 """
346 noDialog = False 358 noDialog = False
347 try: 359 try:
348 tag = vcsDataDict["tag"] 360 tag = vcsDataDict["tag"]
349 except KeyError: 361 except KeyError:
398 """ 410 """
399 Public method used to export a directory from the Subversion 411 Public method used to export a directory from the Subversion
400 repository. 412 repository.
401 413
402 @param vcsDataDict dictionary of data required for the checkout 414 @param vcsDataDict dictionary of data required for the checkout
403 @param projectDir project directory to create (string) 415 @type dict
404 @return flag indicating an execution without errors (boolean) 416 @param projectDir project directory to create
417 @type str
418 @return flag indicating an execution without errors
419 @rtype bool
405 """ 420 """
406 try: 421 try:
407 tag = vcsDataDict["tag"] 422 tag = vcsDataDict["tag"]
408 except KeyError: 423 except KeyError:
409 tag = None 424 tag = None
451 def vcsCommit(self, name, message, noDialog=False): 466 def vcsCommit(self, name, message, noDialog=False):
452 """ 467 """
453 Public method used to make the change of a file/directory permanent 468 Public method used to make the change of a file/directory permanent
454 in the Subversion repository. 469 in the Subversion repository.
455 470
456 @param name file/directory name to be committed (string or list of 471 @param name file/directory name to be committed
457 strings) 472 @type str or list of str
458 @param message message for this operation (string) 473 @param message message for this operation
474 @type str
459 @param noDialog flag indicating quiet operations 475 @param noDialog flag indicating quiet operations
476 @type bool
460 """ 477 """
461 from .SvnCommitDialog import SvnCommitDialog 478 from .SvnCommitDialog import SvnCommitDialog
462 479
463 msg = message 480 msg = message
464 481
611 def vcsUpdate(self, name, noDialog=False): 628 def vcsUpdate(self, name, noDialog=False):
612 """ 629 """
613 Public method used to update a file/directory with the Subversion 630 Public method used to update a file/directory with the Subversion
614 repository. 631 repository.
615 632
616 @param name file/directory name to be updated (string or list of 633 @param name file/directory name to be updated
617 strings) 634 @type str or list of str
618 @param noDialog flag indicating quiet operations (boolean) 635 @param noDialog flag indicating quiet operations
619 @return flag indicating, that the update contained an add 636 @type bool
620 or delete (boolean) 637 @return flag indicating, that the update contained an add or delete
638 @rtype bool
621 """ 639 """
622 args = [] 640 args = []
623 args.append("update") 641 args.append("update")
624 self.addArguments(args, self.options["global"]) 642 self.addArguments(args, self.options["global"])
625 self.addArguments(args, self.options["update"]) 643 self.addArguments(args, self.options["update"])
648 def vcsAdd(self, name, isDir=False, noDialog=False): 666 def vcsAdd(self, name, isDir=False, noDialog=False):
649 """ 667 """
650 Public method used to add a file/directory to the Subversion 668 Public method used to add a file/directory to the Subversion
651 repository. 669 repository.
652 670
653 @param name file/directory name to be added (string) 671 @param name file/directory name to be added
654 @param isDir flag indicating name is a directory (boolean) 672 @type str
673 @param isDir flag indicating name is a directory
674 @type bool
655 @param noDialog flag indicating quiet operations 675 @param noDialog flag indicating quiet operations
676 @type bool
656 """ 677 """
657 args = [] 678 args = []
658 args.append("add") 679 args.append("add")
659 self.addArguments(args, self.options["global"]) 680 self.addArguments(args, self.options["global"])
660 self.addArguments(args, self.options["add"]) 681 self.addArguments(args, self.options["add"])
743 def vcsAddBinary(self, name, isDir=False): 764 def vcsAddBinary(self, name, isDir=False):
744 """ 765 """
745 Public method used to add a file/directory in binary mode to the 766 Public method used to add a file/directory in binary mode to the
746 Subversion repository. 767 Subversion repository.
747 768
748 @param name file/directory name to be added (string) 769 @param name file/directory name to be added
749 @param isDir flag indicating name is a directory (boolean) 770 @type str
771 @param isDir flag indicating name is a directory
772 @type bool
750 """ 773 """
751 self.vcsAdd(name, isDir) 774 self.vcsAdd(name, isDir)
752 775
753 def vcsAddTree(self, path): 776 def vcsAddTree(self, path):
754 """ 777 """
755 Public method to add a directory tree rooted at path to the Subversion 778 Public method to add a directory tree rooted at path to the Subversion
756 repository. 779 repository.
757 780
758 @param path root directory of the tree to be added (string or list of 781 @param path root directory of the tree to be added
759 strings)) 782 @type str or list of str
760 """ 783 """
761 args = [] 784 args = []
762 args.append("add") 785 args.append("add")
763 self.addArguments(args, self.options["global"]) 786 self.addArguments(args, self.options["global"])
764 self.addArguments(args, self.options["add"]) 787 self.addArguments(args, self.options["add"])
833 Public method used to remove a file/directory from the Subversion 856 Public method used to remove a file/directory from the Subversion
834 repository. 857 repository.
835 858
836 The default operation is to remove the local copy as well. 859 The default operation is to remove the local copy as well.
837 860
838 @param name file/directory name to be removed (string or list of 861 @param name file/directory name to be removed
839 strings)) 862 @type str or list of str
840 @param project flag indicating deletion of a project tree (boolean) 863 @param project flag indicating deletion of a project tree
841 (not needed) 864 @type bool
842 @param noDialog flag indicating quiet operations 865 @param noDialog flag indicating quiet operations
843 @return flag indicating successfull operation (boolean) 866 @type bool
867 @return flag indicating successfull operation
868 @rtype bool
844 """ 869 """
845 args = [] 870 args = []
846 args.append("delete") 871 args.append("delete")
847 self.addArguments(args, self.options["global"]) 872 self.addArguments(args, self.options["global"])
848 self.addArguments(args, self.options["remove"]) 873 self.addArguments(args, self.options["remove"])
869 894
870 def vcsMove(self, name, project, target=None, noDialog=False): 895 def vcsMove(self, name, project, target=None, noDialog=False):
871 """ 896 """
872 Public method used to move a file/directory. 897 Public method used to move a file/directory.
873 898
874 @param name file/directory name to be moved (string) 899 @param name file/directory name to be moved
900 @type str
875 @param project reference to the project object 901 @param project reference to the project object
876 @param target new name of the file/directory (string) 902 @type Project
903 @param target new name of the file/directory
904 @type str
877 @param noDialog flag indicating quiet operations 905 @param noDialog flag indicating quiet operations
878 @return flag indicating successfull operation (boolean) 906 @type bool
907 @return flag indicating successfull operation
908 @rtype bool
879 """ 909 """
880 from .SvnCopyDialog import SvnCopyDialog 910 from .SvnCopyDialog import SvnCopyDialog
881 911
882 rx_prot = re.compile("(file:|svn:|svn+ssh:|http:|https:).+") 912 rx_prot = re.compile("(file:|svn:|svn+ssh:|http:|https:).+")
883 opts = self.options["global"][:] 913 opts = self.options["global"][:]
943 If name is a directory and is the project directory, all project files 973 If name is a directory and is the project directory, all project files
944 are saved first. If name is a file (or list of files), which is/are 974 are saved first. If name is a file (or list of files), which is/are
945 being edited and has unsaved modification, they can be saved or the 975 being edited and has unsaved modification, they can be saved or the
946 operation may be aborted. 976 operation may be aborted.
947 977
948 @param name file/directory name to be diffed (string) 978 @param name file/directory name to be diffed
979 @type str
949 """ 980 """
950 from .SvnDiffDialog import SvnDiffDialog 981 from .SvnDiffDialog import SvnDiffDialog
951 982
952 names = name[:] if isinstance(name, list) else [name] 983 names = name[:] if isinstance(name, list) else [name]
953 for nam in names: 984 for nam in names:
970 """ 1001 """
971 Public method used to view the status of files/directories in the 1002 Public method used to view the status of files/directories in the
972 Subversion repository. 1003 Subversion repository.
973 1004
974 @param name file/directory name(s) to show the status of 1005 @param name file/directory name(s) to show the status of
975 (string or list of strings) 1006 @type str or list of str
976 """ 1007 """
977 from .SvnStatusDialog import SvnStatusDialog 1008 from .SvnStatusDialog import SvnStatusDialog
978 1009
979 if self.status is None: 1010 if self.status is None:
980 self.status = SvnStatusDialog(self) 1011 self.status = SvnStatusDialog(self)
985 def vcsTag(self, name): 1016 def vcsTag(self, name):
986 """ 1017 """
987 Public method used to set the tag of a file/directory in the 1018 Public method used to set the tag of a file/directory in the
988 Subversion repository. 1019 Subversion repository.
989 1020
990 @param name file/directory name to be tagged (string) 1021 @param name file/directory name to be tagged
1022 @type str
991 """ 1023 """
992 from .SvnTagDialog import SvnTagDialog 1024 from .SvnTagDialog import SvnTagDialog
993 1025
994 dname, fname = self.splitPath(name) 1026 dname, fname = self.splitPath(name)
995 1027
1134 1166
1135 def vcsSwitch(self, name): 1167 def vcsSwitch(self, name):
1136 """ 1168 """
1137 Public method used to switch a directory to a different tag/branch. 1169 Public method used to switch a directory to a different tag/branch.
1138 1170
1139 @param name directory name to be switched (string) 1171 @param name directory name to be switched
1140 @return flag indicating added or changed files (boolean) 1172 @type str
1173 @return flag indicating added or changed files
1174 @rtype bool
1141 """ 1175 """
1142 from .SvnSwitchDialog import SvnSwitchDialog 1176 from .SvnSwitchDialog import SvnSwitchDialog
1143 1177
1144 dname, fname = self.splitPath(name) 1178 dname, fname = self.splitPath(name)
1145 1179
1216 1250
1217 def vcsMerge(self, name): 1251 def vcsMerge(self, name):
1218 """ 1252 """
1219 Public method used to merge a URL/revision into the local project. 1253 Public method used to merge a URL/revision into the local project.
1220 1254
1221 @param name file/directory name to be merged (string) 1255 @param name file/directory name to be merged
1256 @type str
1222 """ 1257 """
1223 from .SvnMergeDialog import SvnMergeDialog 1258 from .SvnMergeDialog import SvnMergeDialog
1224 1259
1225 dname, fname = self.splitPath(name) 1260 dname, fname = self.splitPath(name)
1226 1261
1279 1314
1280 def vcsRegisteredState(self, name): 1315 def vcsRegisteredState(self, name):
1281 """ 1316 """
1282 Public method used to get the registered state of a file in the vcs. 1317 Public method used to get the registered state of a file in the vcs.
1283 1318
1284 @param name filename to check (string) 1319 @param name filename to check
1285 @return a combination of canBeCommited and canBeAdded 1320 @type str
1321 @return registered state (one of canBeCommited and canBeAdded)
1322 @rtype int
1286 """ 1323 """
1287 if self.__wcng: 1324 if self.__wcng:
1288 return self.__vcsRegisteredState_wcng(name) 1325 return self.__vcsRegisteredState_wcng(name)
1289 else: 1326 else:
1290 return self.__vcsRegisteredState_wc(name) 1327 return self.__vcsRegisteredState_wc(name)
1294 Private method used to get the registered state of a file in the vcs. 1331 Private method used to get the registered state of a file in the vcs.
1295 1332
1296 This is the variant for subversion installations using the new 1333 This is the variant for subversion installations using the new
1297 working copy meta-data format. 1334 working copy meta-data format.
1298 1335
1299 @param name filename to check (string) 1336 @param name filename to check
1300 @return a combination of canBeCommited and canBeAdded 1337 @type str
1338 @return registered state (one of canBeCommited and canBeAdded)
1339 @rtype int
1301 """ 1340 """
1302 if name.endswith(os.sep): 1341 if name.endswith(os.sep):
1303 name = name[:-1] 1342 name = name[:-1]
1304 name = os.path.normcase(name) 1343 name = os.path.normcase(name)
1305 dname, fname = self.splitPath(name) 1344 dname, fname = self.splitPath(name)
1323 Private method used to get the registered state of a file in the VCS. 1362 Private method used to get the registered state of a file in the VCS.
1324 1363
1325 This is the variant for subversion installations using the old working 1364 This is the variant for subversion installations using the old working
1326 copy meta-data format. 1365 copy meta-data format.
1327 1366
1328 @param name filename to check (string) 1367 @param name filename to check
1329 @return a combination of canBeCommited and canBeAdded 1368 @type str
1369 @return registered state (one of canBeCommited and canBeAdded)
1370 @rtype int
1330 """ 1371 """
1331 dname, fname = self.splitPath(name) 1372 dname, fname = self.splitPath(name)
1332 1373
1333 if fname == ".": 1374 if fname == ".":
1334 if os.path.isdir(os.path.join(dname, self.adminDir)): 1375 if os.path.isdir(os.path.join(dname, self.adminDir)):
1352 <b>Note:</b> If a shortcut is to be taken, the code will only check, 1393 <b>Note:</b> If a shortcut is to be taken, the code will only check,
1353 if the named directory has been scanned already. If so, it is assumed, 1394 if the named directory has been scanned already. If so, it is assumed,
1354 that the states for all files have been populated by the previous run. 1395 that the states for all files have been populated by the previous run.
1355 1396
1356 @param names dictionary with all filenames to be checked as keys 1397 @param names dictionary with all filenames to be checked as keys
1357 @param dname directory to check in (string) 1398 @type dict
1358 @param shortcut flag indicating a shortcut should be taken (boolean) 1399 @param dname directory to check in
1400 @type str
1401 @param shortcut flag indicating a shortcut should be taken
1402 @type bool
1359 @return the received dictionary completed with a combination of 1403 @return the received dictionary completed with a combination of
1360 canBeCommited and canBeAdded or None in order to signal an error 1404 canBeCommited and canBeAdded or None in order to signal an error
1405 @rtype dict
1361 """ 1406 """
1362 if self.__wcng: 1407 if self.__wcng:
1363 return self.__vcsAllRegisteredStates_wcng(names, dname) 1408 return self.__vcsAllRegisteredStates_wcng(names, dname)
1364 else: 1409 else:
1365 return self.__vcsAllRegisteredStates_wc(names, dname, shortcut) 1410 return self.__vcsAllRegisteredStates_wc(names, dname, shortcut)
1375 <b>Note:</b> If a shortcut is to be taken, the code will only check, 1420 <b>Note:</b> If a shortcut is to be taken, the code will only check,
1376 if the named directory has been scanned already. If so, it is assumed, 1421 if the named directory has been scanned already. If so, it is assumed,
1377 that the states for all files has been populated by the previous run. 1422 that the states for all files has been populated by the previous run.
1378 1423
1379 @param names dictionary with all filenames to be checked as keys 1424 @param names dictionary with all filenames to be checked as keys
1380 @param dname directory to check in (string) 1425 @type dict
1426 @param dname directory to check in
1427 @type str
1381 @return the received dictionary completed with a combination of 1428 @return the received dictionary completed with a combination of
1382 canBeCommited and canBeAdded or None in order to signal an error 1429 canBeCommited and canBeAdded or None in order to signal an error
1430 @rtype dict
1383 """ 1431 """
1384 if dname.endswith(os.sep): 1432 if dname.endswith(os.sep):
1385 dname = dname[:-1] 1433 dname = dname[:-1]
1386 dname = os.path.normcase(dname) 1434 dname = os.path.normcase(dname)
1387 1435
1445 <b>Note:</b> If a shortcut is to be taken, the code will only check, 1493 <b>Note:</b> If a shortcut is to be taken, the code will only check,
1446 if the named directory has been scanned already. If so, it is assumed, 1494 if the named directory has been scanned already. If so, it is assumed,
1447 that the states for all files has been populated by the previous run. 1495 that the states for all files has been populated by the previous run.
1448 1496
1449 @param names dictionary with all filenames to be checked as keys 1497 @param names dictionary with all filenames to be checked as keys
1450 @param dname directory to check in (string) 1498 @type dict
1451 @param shortcut flag indicating a shortcut should be taken (boolean) 1499 @param dname directory to check in
1500 @type str
1501 @param shortcut flag indicating a shortcut should be taken
1502 @type bool
1452 @return the received dictionary completed with a combination of 1503 @return the received dictionary completed with a combination of
1453 canBeCommited and canBeAdded or None in order to signal an error 1504 canBeCommited and canBeAdded or None in order to signal an error
1505 @rtype dict
1454 """ 1506 """
1455 if not os.path.isdir(os.path.join(dname, self.adminDir)): 1507 if not os.path.isdir(os.path.join(dname, self.adminDir)):
1456 # not under version control -> do nothing 1508 # not under version control -> do nothing
1457 return names 1509 return names
1458 1510
1512 """ 1564 """
1513 Public method to initialize the VCS configuration. 1565 Public method to initialize the VCS configuration.
1514 1566
1515 This method ensures, that an ignore file exists. 1567 This method ensures, that an ignore file exists.
1516 1568
1517 @param project reference to the project (Project) 1569 @param project reference to the project
1570 @type Project
1518 """ 1571 """
1519 configPath = getConfigPath() 1572 configPath = getConfigPath()
1520 if os.path.exists(configPath): 1573 if os.path.exists(configPath):
1521 amendConfig() 1574 amendConfig()
1522 else: 1575 else:
1524 1577
1525 def vcsName(self): 1578 def vcsName(self):
1526 """ 1579 """
1527 Public method returning the name of the vcs. 1580 Public method returning the name of the vcs.
1528 1581
1529 @return always 'Subversion' (string) 1582 @return always 'Subversion'
1583 @rtype str
1530 """ 1584 """
1531 return "Subversion" 1585 return "Subversion"
1532 1586
1533 def vcsCleanup(self, name): 1587 def vcsCleanup(self, name):
1534 """ 1588 """
1535 Public method used to cleanup the working copy. 1589 Public method used to cleanup the working copy.
1536 1590
1537 @param name directory name to be cleaned up (string) 1591 @param name directory name to be cleaned up
1592 @type str
1538 """ 1593 """
1539 args = [] 1594 args = []
1540 args.append("cleanup") 1595 args.append("cleanup")
1541 self.addArguments(args, self.options["global"]) 1596 self.addArguments(args, self.options["global"])
1542 args.append(name) 1597 args.append(name)
1548 1603
1549 def vcsCommandLine(self, name): 1604 def vcsCommandLine(self, name):
1550 """ 1605 """
1551 Public method used to execute arbitrary subversion commands. 1606 Public method used to execute arbitrary subversion commands.
1552 1607
1553 @param name directory name of the working directory (string) 1608 @param name directory name of the working directory
1609 @type str
1554 """ 1610 """
1555 from .SvnCommandDialog import SvnCommandDialog 1611 from .SvnCommandDialog import SvnCommandDialog
1556 1612
1557 dlg = SvnCommandDialog(self.commandHistory, self.wdHistory, name) 1613 dlg = SvnCommandDialog(self.commandHistory, self.wdHistory, name)
1558 if dlg.exec() == QDialog.DialogCode.Accepted: 1614 if dlg.exec() == QDialog.DialogCode.Accepted:
1581 ): 1637 ):
1582 """ 1638 """
1583 Public method to get a dialog to enter repository info. 1639 Public method to get a dialog to enter repository info.
1584 1640
1585 @param project reference to the project object 1641 @param project reference to the project object
1586 @param archive name of the project in the repository (string) 1642 @type Project
1643 @param archive name of the project in the repository
1644 @type str
1587 @param editable flag indicating that the project name is editable 1645 @param editable flag indicating that the project name is editable
1588 (boolean) 1646 @type bool
1589 @param parent parent widget (QWidget) 1647 @param parent parent widget
1590 @return reference to the instantiated options dialog (SvnOptionsDialog) 1648 @type QWidget
1649 @return reference to the instantiated options dialog
1650 @rtype SvnOptionsDialog
1591 """ 1651 """
1592 from .SvnOptionsDialog import SvnOptionsDialog 1652 from .SvnOptionsDialog import SvnOptionsDialog
1593 1653
1594 return SvnOptionsDialog(self, project, parent) 1654 return SvnOptionsDialog(self, project, parent)
1595 1655
1596 def vcsNewProjectOptionsDialog(self, parent=None): 1656 def vcsNewProjectOptionsDialog(self, parent=None):
1597 """ 1657 """
1598 Public method to get a dialog to enter repository info for getting 1658 Public method to get a dialog to enter repository info for getting
1599 a new project. 1659 a new project.
1600 1660
1601 @param parent parent widget (QWidget) 1661 @param parent parent widget
1662 @type QWidget
1602 @return reference to the instantiated options dialog 1663 @return reference to the instantiated options dialog
1603 (SvnNewProjectOptionsDialog) 1664 @rtype SvnNewProjectOptionsDialog
1604 """ 1665 """
1605 from .SvnNewProjectOptionsDialog import SvnNewProjectOptionsDialog 1666 from .SvnNewProjectOptionsDialog import SvnNewProjectOptionsDialog
1606 1667
1607 return SvnNewProjectOptionsDialog(self, parent) 1668 return SvnNewProjectOptionsDialog(self, parent)
1608 1669
1609 def vcsRepositoryInfos(self, ppath): 1670 def vcsRepositoryInfos(self, ppath):
1610 """ 1671 """
1611 Public method to retrieve information about the repository. 1672 Public method to retrieve information about the repository.
1612 1673
1613 @param ppath local path to get the repository infos (string) 1674 @param ppath local path to get the repository infos
1614 @return string with ready formated info for display (string) 1675 @type str
1676 @return string with ready formated info for display
1677 @rtype str
1615 """ 1678 """
1616 info = { 1679 info = {
1617 "committed-rev": "", 1680 "committed-rev": "",
1618 "committed-date": "", 1681 "committed-date": "",
1619 "committed-time": "", 1682 "committed-time": "",
1696 def svnGetReposName(self, path): 1759 def svnGetReposName(self, path):
1697 """ 1760 """
1698 Public method used to retrieve the URL of the subversion repository 1761 Public method used to retrieve the URL of the subversion repository
1699 path. 1762 path.
1700 1763
1701 @param path local path to get the svn repository path for (string) 1764 @param path local path to get the svn repository path for
1765 @type str
1702 @return string with the repository path URL 1766 @return string with the repository path URL
1767 @rtype str
1703 """ 1768 """
1704 ioEncoding = Preferences.getSystem("IOEncoding") 1769 ioEncoding = Preferences.getSystem("IOEncoding")
1705 1770
1706 process = QProcess() 1771 process = QProcess()
1707 args = [] 1772 args = []
1725 1790
1726 def vcsResolved(self, name): 1791 def vcsResolved(self, name):
1727 """ 1792 """
1728 Public method used to resolve conflicts of a file/directory. 1793 Public method used to resolve conflicts of a file/directory.
1729 1794
1730 @param name file/directory name to be resolved (string) 1795 @param name file/directory name to be resolved
1796 @type str
1731 """ 1797 """
1732 args = [] 1798 args = []
1733 if self.version >= (1, 5, 0): 1799 if self.version >= (1, 5, 0):
1734 args.append("resolve") 1800 args.append("resolve")
1735 args.append("--accept") 1801 args.append("--accept")
1752 1818
1753 def svnCopy(self, name, project): 1819 def svnCopy(self, name, project):
1754 """ 1820 """
1755 Public method used to copy a file/directory. 1821 Public method used to copy a file/directory.
1756 1822
1757 @param name file/directory name to be copied (string) 1823 @param name file/directory name to be copied
1824 @type str
1758 @param project reference to the project object 1825 @param project reference to the project object
1759 @return flag indicating successfull operation (boolean) 1826 @type Project
1827 @return flag indicating successfull operation
1828 @rtype bool
1760 """ 1829 """
1761 from .SvnCopyDialog import SvnCopyDialog 1830 from .SvnCopyDialog import SvnCopyDialog
1762 1831
1763 rx_prot = re.compile("(file:|svn:|svn+ssh:|http:|https:).+") 1832 rx_prot = re.compile("(file:|svn:|svn+ssh:|http:|https:).+")
1764 dlg = SvnCopyDialog(name) 1833 dlg = SvnCopyDialog(name)
1795 1864
1796 def svnListProps(self, name, recursive=False): 1865 def svnListProps(self, name, recursive=False):
1797 """ 1866 """
1798 Public method used to list the properties of a file/directory. 1867 Public method used to list the properties of a file/directory.
1799 1868
1800 @param name file/directory name (string or list of strings) 1869 @param name file/directory name
1870 @type str or list of str
1801 @param recursive flag indicating a recursive list is requested 1871 @param recursive flag indicating a recursive list is requested
1872 @type bool
1802 """ 1873 """
1803 from .SvnPropListDialog import SvnPropListDialog 1874 from .SvnPropListDialog import SvnPropListDialog
1804 1875
1805 if self.propList is None: 1876 if self.propList is None:
1806 self.propList = SvnPropListDialog(self) 1877 self.propList = SvnPropListDialog(self)
1810 1881
1811 def svnSetProp(self, name, recursive=False): 1882 def svnSetProp(self, name, recursive=False):
1812 """ 1883 """
1813 Public method used to add a property to a file/directory. 1884 Public method used to add a property to a file/directory.
1814 1885
1815 @param name file/directory name (string or list of strings) 1886 @param name file/directory name
1887 @type str or list of str
1816 @param recursive flag indicating a recursive list is requested 1888 @param recursive flag indicating a recursive list is requested
1889 @type bool
1817 """ 1890 """
1818 from .SvnPropSetDialog import SvnPropSetDialog 1891 from .SvnPropSetDialog import SvnPropSetDialog
1819 1892
1820 dlg = SvnPropSetDialog() 1893 dlg = SvnPropSetDialog()
1821 if dlg.exec() == QDialog.DialogCode.Accepted: 1894 if dlg.exec() == QDialog.DialogCode.Accepted:
1851 1924
1852 def svnDelProp(self, name, recursive=False): 1925 def svnDelProp(self, name, recursive=False):
1853 """ 1926 """
1854 Public method used to delete a property of a file/directory. 1927 Public method used to delete a property of a file/directory.
1855 1928
1856 @param name file/directory name (string or list of strings) 1929 @param name file/directory name
1930 @type str or list of str
1857 @param recursive flag indicating a recursive list is requested 1931 @param recursive flag indicating a recursive list is requested
1932 @type bool
1858 """ 1933 """
1859 propName, ok = QInputDialog.getText( 1934 propName, ok = QInputDialog.getText(
1860 None, 1935 None,
1861 self.tr("Subversion Delete Property"), 1936 self.tr("Subversion Delete Property"),
1862 self.tr("Enter property name"), 1937 self.tr("Enter property name"),
1894 1969
1895 def svnListTagBranch(self, path, tags=True): 1970 def svnListTagBranch(self, path, tags=True):
1896 """ 1971 """
1897 Public method used to list the available tags or branches. 1972 Public method used to list the available tags or branches.
1898 1973
1899 @param path directory name of the project (string) 1974 @param path directory name of the project
1975 @type str
1900 @param tags flag indicating listing of branches or tags 1976 @param tags flag indicating listing of branches or tags
1901 (False = branches, True = tags) 1977 (False = branches, True = tags)
1978 @type bool
1902 """ 1979 """
1903 from .SvnTagBranchListDialog import SvnTagBranchListDialog 1980 from .SvnTagBranchListDialog import SvnTagBranchListDialog
1904 1981
1905 if self.tagbranchList is None: 1982 if self.tagbranchList is None:
1906 self.tagbranchList = SvnTagBranchListDialog(self) 1983 self.tagbranchList = SvnTagBranchListDialog(self)
1927 2004
1928 def svnBlame(self, name): 2005 def svnBlame(self, name):
1929 """ 2006 """
1930 Public method to show the output of the svn blame command. 2007 Public method to show the output of the svn blame command.
1931 2008
1932 @param name file name to show the blame for (string) 2009 @param name file name to show the blame for
2010 @type str
1933 """ 2011 """
1934 from .SvnBlameDialog import SvnBlameDialog 2012 from .SvnBlameDialog import SvnBlameDialog
1935 2013
1936 if self.blame is None: 2014 if self.blame is None:
1937 self.blame = SvnBlameDialog(self) 2015 self.blame = SvnBlameDialog(self)
1949 being edited and has unsaved modification, they can be saved or the 2027 being edited and has unsaved modification, they can be saved or the
1950 operation may be aborted. 2028 operation may be aborted.
1951 2029
1952 This method gives the chance to enter the revisions to be compared. 2030 This method gives the chance to enter the revisions to be compared.
1953 2031
1954 @param name file/directory name to be diffed (string) 2032 @param name file/directory name to be diffed
2033 @type str
1955 """ 2034 """
1956 from .SvnDiffDialog import SvnDiffDialog 2035 from .SvnDiffDialog import SvnDiffDialog
1957 from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog 2036 from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog
1958 2037
1959 names = name[:] if isinstance(name, list) else [name] 2038 names = name[:] if isinstance(name, list) else [name]
1983 being edited and has unsaved modification, they can be saved or the 2062 being edited and has unsaved modification, they can be saved or the
1984 operation may be aborted. 2063 operation may be aborted.
1985 2064
1986 This method gives the chance to enter the revisions to be compared. 2065 This method gives the chance to enter the revisions to be compared.
1987 2066
1988 @param name file/directory name to be diffed (string) 2067 @param name file/directory name to be diffed
2068 @type str
1989 """ 2069 """
1990 from .SvnDiffDialog import SvnDiffDialog 2070 from .SvnDiffDialog import SvnDiffDialog
1991 from .SvnUrlSelectionDialog import SvnUrlSelectionDialog 2071 from .SvnUrlSelectionDialog import SvnUrlSelectionDialog
1992 2072
1993 names = name[:] if isinstance(name, list) else [name] 2073 names = name[:] if isinstance(name, list) else [name]
2014 def __svnGetFileForRevision(self, name, rev=""): 2094 def __svnGetFileForRevision(self, name, rev=""):
2015 """ 2095 """
2016 Private method to get a file for a specific revision from the 2096 Private method to get a file for a specific revision from the
2017 repository. 2097 repository.
2018 2098
2019 @param name file name to get from the repository (string) 2099 @param name file name to get from the repository
2020 @param rev revision to retrieve (integer or string) 2100 @type str
2021 @return contents of the file (string) and an error message (string) 2101 @param rev revision to retrieve
2102 @type int or str
2103 @return contents of the file (string) and an error message
2104 @rtype str
2022 """ 2105 """
2023 args = [] 2106 args = []
2024 args.append("cat") 2107 args.append("cat")
2025 if rev: 2108 if rev:
2026 args.append("--revision") 2109 args.append("--revision")
2061 def vcsSbsDiff(self, name, extended=False, revisions=None): 2144 def vcsSbsDiff(self, name, extended=False, revisions=None):
2062 """ 2145 """
2063 Public method used to view the difference of a file to the Mercurial 2146 Public method used to view the difference of a file to the Mercurial
2064 repository side-by-side. 2147 repository side-by-side.
2065 2148
2066 @param name file name to be diffed (string) 2149 @param name file name to be diffed
2067 @param extended flag indicating the extended variant (boolean) 2150 @type str
2068 @param revisions tuple of two revisions (tuple of strings) 2151 @param extended flag indicating the extended variant
2152 @type bool
2153 @param revisions tuple of two revisions
2154 @type tuple of (str, str)
2069 @exception ValueError raised to indicate an illegal name parameter type 2155 @exception ValueError raised to indicate an illegal name parameter type
2070 """ 2156 """
2071 from eric7.UI.CompareDialog import CompareDialog 2157 from eric7.UI.CompareDialog import CompareDialog
2072 2158
2073 from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog 2159 from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog
2130 def vcsLogBrowser(self, name, isFile=False): 2216 def vcsLogBrowser(self, name, isFile=False):
2131 """ 2217 """
2132 Public method used to browse the log of a file/directory from the 2218 Public method used to browse the log of a file/directory from the
2133 Subversion repository. 2219 Subversion repository.
2134 2220
2135 @param name file/directory name to show the log of (string) 2221 @param name file/directory name to show the log of
2136 @param isFile flag indicating log for a file is to be shown (boolean) 2222 @type str
2223 @param isFile flag indicating log for a file is to be shown
2224 @type bool
2137 """ 2225 """
2138 from .SvnLogBrowserDialog import SvnLogBrowserDialog 2226 from .SvnLogBrowserDialog import SvnLogBrowserDialog
2139 2227
2140 if self.logBrowser is None: 2228 if self.logBrowser is None:
2141 self.logBrowser = SvnLogBrowserDialog(self) 2229 self.logBrowser = SvnLogBrowserDialog(self)
2145 2233
2146 def svnLock(self, name, stealIt=False, parent=None): 2234 def svnLock(self, name, stealIt=False, parent=None):
2147 """ 2235 """
2148 Public method used to lock a file in the Subversion repository. 2236 Public method used to lock a file in the Subversion repository.
2149 2237
2150 @param name file/directory name to be locked (string or list of 2238 @param name file/directory name to be locked
2151 strings) 2239 @type str or list of str
2152 @param stealIt flag indicating a forced operation (boolean) 2240 @param stealIt flag indicating a forced operation
2241 @type bool
2153 @param parent reference to the parent object of the subversion dialog 2242 @param parent reference to the parent object of the subversion dialog
2154 (QWidget) 2243 @type QWidget
2155 """ 2244 """
2156 args = [] 2245 args = []
2157 args.append("lock") 2246 args.append("lock")
2158 self.addArguments(args, self.options["global"]) 2247 self.addArguments(args, self.options["global"])
2159 if stealIt: 2248 if stealIt:
2172 2261
2173 def svnUnlock(self, name, breakIt=False, parent=None): 2262 def svnUnlock(self, name, breakIt=False, parent=None):
2174 """ 2263 """
2175 Public method used to unlock a file in the Subversion repository. 2264 Public method used to unlock a file in the Subversion repository.
2176 2265
2177 @param name file/directory name to be unlocked (string or list of 2266 @param name file/directory name to be unlocked
2178 strings) 2267 @type str or list of str
2179 @param breakIt flag indicating a forced operation (boolean) 2268 @param breakIt flag indicating a forced operation
2269 @type bool
2180 @param parent reference to the parent object of the subversion dialog 2270 @param parent reference to the parent object of the subversion dialog
2181 (QWidget) 2271 @type QWidget
2182 """ 2272 """
2183 args = [] 2273 args = []
2184 args.append("unlock") 2274 args.append("unlock")
2185 self.addArguments(args, self.options["global"]) 2275 self.addArguments(args, self.options["global"])
2186 if breakIt: 2276 if breakIt:
2199 2289
2200 def svnRelocate(self, projectPath): 2290 def svnRelocate(self, projectPath):
2201 """ 2291 """
2202 Public method to relocate the working copy to a new repository URL. 2292 Public method to relocate the working copy to a new repository URL.
2203 2293
2204 @param projectPath path name of the project (string) 2294 @param projectPath path name of the project
2295 @type str
2205 """ 2296 """
2206 from .SvnRelocateDialog import SvnRelocateDialog 2297 from .SvnRelocateDialog import SvnRelocateDialog
2207 2298
2208 currUrl = self.svnGetReposName(projectPath) 2299 currUrl = self.svnGetReposName(projectPath)
2209 dlg = SvnRelocateDialog(currUrl) 2300 dlg = SvnRelocateDialog(currUrl)
2224 2315
2225 def svnRepoBrowser(self, projectPath=None): 2316 def svnRepoBrowser(self, projectPath=None):
2226 """ 2317 """
2227 Public method to open the repository browser. 2318 Public method to open the repository browser.
2228 2319
2229 @param projectPath path name of the project (string) 2320 @param projectPath path name of the project
2321 @type str
2230 """ 2322 """
2231 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog 2323 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog
2232 2324
2233 url = self.svnGetReposName(projectPath) if projectPath else None 2325 url = self.svnGetReposName(projectPath) if projectPath else None
2234 2326
2253 Public method to remove a file or directory from its changelist. 2345 Public method to remove a file or directory from its changelist.
2254 2346
2255 Note: Directories will be removed recursively. 2347 Note: Directories will be removed recursively.
2256 2348
2257 @param names name or list of names of file or directory to remove 2349 @param names name or list of names of file or directory to remove
2258 (string) 2350 @type str or list of str
2259 """ 2351 """
2260 args = [] 2352 args = []
2261 args.append("changelist") 2353 args.append("changelist")
2262 self.addArguments(args, self.options["global"]) 2354 self.addArguments(args, self.options["global"])
2263 args.append("--remove") 2355 args.append("--remove")
2279 Public method to add a file or directory to a changelist. 2371 Public method to add a file or directory to a changelist.
2280 2372
2281 Note: Directories will be added recursively. 2373 Note: Directories will be added recursively.
2282 2374
2283 @param names name or list of names of file or directory to add 2375 @param names name or list of names of file or directory to add
2284 (string) 2376 @type str or list of str
2285 """ 2377 """
2286 clname, ok = QInputDialog.getItem( 2378 clname, ok = QInputDialog.getItem(
2287 None, 2379 None,
2288 self.tr("Add to changelist"), 2380 self.tr("Add to changelist"),
2289 self.tr("Enter name of the changelist:"), 2381 self.tr("Enter name of the changelist:"),
2313 2405
2314 def svnShowChangelists(self, path): 2406 def svnShowChangelists(self, path):
2315 """ 2407 """
2316 Public method used to inspect the change lists defined for the project. 2408 Public method used to inspect the change lists defined for the project.
2317 2409
2318 @param path directory name to show change lists for (string) 2410 @param path directory name to show change lists for
2411 @type str
2319 """ 2412 """
2320 from .SvnChangeListsDialog import SvnChangeListsDialog 2413 from .SvnChangeListsDialog import SvnChangeListsDialog
2321 2414
2322 self.changeLists = SvnChangeListsDialog(self) 2415 self.changeLists = SvnChangeListsDialog(self)
2323 self.changeLists.show() 2416 self.changeLists.show()
2326 2419
2327 def svnGetChangelists(self): 2420 def svnGetChangelists(self):
2328 """ 2421 """
2329 Public method to get a list of all defined change lists. 2422 Public method to get a list of all defined change lists.
2330 2423
2331 @return list of defined change list names (list of strings) 2424 @return list of defined change list names
2425 @rtype list of str
2332 """ 2426 """
2333 changelists = [] 2427 changelists = []
2334 rx_changelist = re.compile("--- \\S+ .([\\w\\s]+).:\\s*") 2428 rx_changelist = re.compile("--- \\S+ .([\\w\\s]+).:\\s*")
2335 # three dashes, Changelist (translated), quote, 2429 # three dashes, Changelist (translated), quote,
2336 # changelist name, quote, : 2430 # changelist name, quote, :
2365 2459
2366 def svnUpgrade(self, path): 2460 def svnUpgrade(self, path):
2367 """ 2461 """
2368 Public method to upgrade the working copy format. 2462 Public method to upgrade the working copy format.
2369 2463
2370 @param path directory name to show change lists for (string) 2464 @param path directory name to show change lists for
2465 @type str
2371 """ 2466 """
2372 args = [] 2467 args = []
2373 args.append("upgrade") 2468 args.append("upgrade")
2374 args.append(".") 2469 args.append(".")
2375 2470
2384 2479
2385 def __svnURL(self, url): 2480 def __svnURL(self, url):
2386 """ 2481 """
2387 Private method to format a url for subversion. 2482 Private method to format a url for subversion.
2388 2483
2389 @param url unformatted url string (string) 2484 @param url unformatted url string
2390 @return properly formated url for subversion (string) 2485 @type str
2486 @return properly formated url for subversion
2487 @rtype str
2391 """ 2488 """
2392 url = self.svnNormalizeURL(url) 2489 url = self.svnNormalizeURL(url)
2393 url = url.split(":", 2) 2490 url = url.split(":", 2)
2394 if len(url) == 3: 2491 if len(url) == 3:
2395 scheme = url[0] 2492 scheme = url[0]
2410 2507
2411 def svnNormalizeURL(self, url): 2508 def svnNormalizeURL(self, url):
2412 """ 2509 """
2413 Public method to normalize a url for subversion. 2510 Public method to normalize a url for subversion.
2414 2511
2415 @param url url string (string) 2512 @param url url string
2416 @return properly normalized url for subversion (string) 2513 @type str
2514 @return properly normalized url for subversion
2515 @rtype str
2417 """ 2516 """
2418 protocol, url = url.split("://", 1) 2517 protocol, url = url.split("://", 1)
2419 if url.startswith("\\\\"): 2518 if url.startswith("\\\\"):
2420 url = url[2:] 2519 url = url[2:]
2421 if protocol == "file": 2520 if protocol == "file":
2435 """ 2534 """
2436 Public method to instanciate a helper object for the different 2535 Public method to instanciate a helper object for the different
2437 project browsers. 2536 project browsers.
2438 2537
2439 @param browser reference to the project browser object 2538 @param browser reference to the project browser object
2539 @type ProjectBaseBrowser
2440 @param project reference to the project object 2540 @param project reference to the project object
2541 @type Project
2441 @param isTranslationsBrowser flag indicating, the helper is requested 2542 @param isTranslationsBrowser flag indicating, the helper is requested
2442 for the translations browser (this needs some special treatment) 2543 for the translations browser (this needs some special treatment)
2544 @type bool
2443 @return the project browser helper object 2545 @return the project browser helper object
2546 @rtype SvnProjectBrowserHelper
2444 """ 2547 """
2445 from .ProjectBrowserHelper import SvnProjectBrowserHelper 2548 from .ProjectBrowserHelper import SvnProjectBrowserHelper
2446 2549
2447 return SvnProjectBrowserHelper(self, browser, project, isTranslationsBrowser) 2550 return SvnProjectBrowserHelper(self, browser, project, isTranslationsBrowser)
2448 2551
2449 def vcsGetProjectHelper(self, project): 2552 def vcsGetProjectHelper(self, project):
2450 """ 2553 """
2451 Public method to instanciate a helper object for the project. 2554 Public method to instanciate a helper object for the project.
2452 2555
2453 @param project reference to the project object 2556 @param project reference to the project object
2557 @type Project
2454 @return the project helper object 2558 @return the project helper object
2559 @rtype SvnProjectHelper
2455 """ 2560 """
2456 helper = self.__plugin.getProjectHelper() 2561 helper = self.__plugin.getProjectHelper()
2457 helper.setObjects(self, project) 2562 helper.setObjects(self, project)
2458 self.__wcng = ( 2563 self.__wcng = (
2459 os.path.exists(os.path.join(project.getProjectPath(), ".svn", "format")) 2564 os.path.exists(os.path.join(project.getProjectPath(), ".svn", "format"))
2471 """ 2576 """
2472 Protected method to create an instance of the VCS status monitor 2577 Protected method to create an instance of the VCS status monitor
2473 thread. 2578 thread.
2474 2579
2475 @param interval check interval for the monitor thread in seconds 2580 @param interval check interval for the monitor thread in seconds
2476 (integer) 2581 @type int
2477 @param project reference to the project object 2582 @param project reference to the project object
2478 @return reference to the monitor thread (QThread) 2583 @type Project
2584 @return reference to the monitor thread
2585 @rtype SvnStatusMonitorThread
2479 """ 2586 """
2480 from .SvnStatusMonitorThread import SvnStatusMonitorThread 2587 from .SvnStatusMonitorThread import SvnStatusMonitorThread
2481 2588
2482 return SvnStatusMonitorThread(interval, project, self) 2589 return SvnStatusMonitorThread(interval, project, self)

eric ide

mercurial