217 else: |
217 else: |
218 cwdIsPpath = False |
218 cwdIsPpath = False |
219 if os.getcwd() == project.ppath: |
219 if os.getcwd() == project.ppath: |
220 os.chdir(os.path.dirname(project.ppath)) |
220 os.chdir(os.path.dirname(project.ppath)) |
221 cwdIsPpath = True |
221 cwdIsPpath = True |
222 tmpProjectDir = "%s_tmp" % project.ppath |
222 tmpProjectDir = "{0}_tmp".format(project.ppath) |
223 shutil.rmtree(tmpProjectDir, True) |
223 shutil.rmtree(tmpProjectDir, True) |
224 os.rename(project.ppath, tmpProjectDir) |
224 os.rename(project.ppath, tmpProjectDir) |
225 os.makedirs(project.ppath) |
225 os.makedirs(project.ppath) |
226 self.vcsCheckout(vcsDataDict, project.ppath) |
226 self.vcsCheckout(vcsDataDict, project.ppath) |
227 if cwdIsPpath: |
227 if cwdIsPpath: |
268 if not msg: |
268 if not msg: |
269 msg = '***' |
269 msg = '***' |
270 |
270 |
271 vcsDir = self.svnNormalizeURL(vcsDataDict["url"]) |
271 vcsDir = self.svnNormalizeURL(vcsDataDict["url"]) |
272 if vcsDir.startswith('/'): |
272 if vcsDir.startswith('/'): |
273 vcsDir = 'file://%s' % vcsDir |
273 vcsDir = 'file://{0}'.format(vcsDir) |
274 elif vcsDir[1] in ['|', ':']: |
274 elif vcsDir[1] in ['|', ':']: |
275 vcsDir = 'file:///%s' % vcsDir |
275 vcsDir = 'file:///{0}'.format(vcsDir) |
276 |
276 |
277 project = vcsDir[vcsDir.rfind('/') + 1:] |
277 project = vcsDir[vcsDir.rfind('/') + 1:] |
278 |
278 |
279 # create the dir structure to be imported into the repository |
279 # create the dir structure to be imported into the repository |
280 tmpDir = '%s_tmp' % projectDir |
280 tmpDir = '{0}_tmp'.format(projectDir) |
281 try: |
281 try: |
282 os.makedirs(tmpDir) |
282 os.makedirs(tmpDir) |
283 if self.otherData["standardLayout"]: |
283 if self.otherData["standardLayout"]: |
284 os.mkdir(os.path.join(tmpDir, project)) |
284 os.mkdir(os.path.join(tmpDir, project)) |
285 os.mkdir(os.path.join(tmpDir, project, 'branches')) |
285 os.mkdir(os.path.join(tmpDir, project, 'branches')) |
300 url = self.__svnURL(vcsDir) |
300 url = self.__svnURL(vcsDir) |
301 client = self.getClient() |
301 client = self.getClient() |
302 if not noDialog: |
302 if not noDialog: |
303 dlg = \ |
303 dlg = \ |
304 SvnDialog(self.trUtf8('Importing project into Subversion repository'), |
304 SvnDialog(self.trUtf8('Importing project into Subversion repository'), |
305 "import%s --message %s ." % \ |
305 "import{0} --message {1} .".format( |
306 ((not recurse) and " --non-recursive" or "", |
306 (not recurse) and " --non-recursive" or "", |
307 msg), |
307 msg), |
308 client) |
308 client) |
309 QApplication.processEvents() |
309 QApplication.processEvents() |
310 try: |
310 try: |
311 rev = client.import_(".", url, msg, recurse, ignore = True) |
311 rev = client.import_(".", url, msg, recurse, ignore = True) |
312 status = True |
312 status = True |
340 tag = vcsDataDict["tag"] |
340 tag = vcsDataDict["tag"] |
341 except KeyError: |
341 except KeyError: |
342 tag = None |
342 tag = None |
343 vcsDir = self.svnNormalizeURL(vcsDataDict["url"]) |
343 vcsDir = self.svnNormalizeURL(vcsDataDict["url"]) |
344 if vcsDir.startswith('/'): |
344 if vcsDir.startswith('/'): |
345 vcsDir = 'file://%s' % vcsDir |
345 vcsDir = 'file://{0}'.format(vcsDir) |
346 elif vcsDir[1] in ['|', ':']: |
346 elif vcsDir[1] in ['|', ':']: |
347 vcsDir = 'file:///%s' % vcsDir |
347 vcsDir = 'file:///{0}'.format(vcsDir) |
348 |
348 |
349 if self.otherData["standardLayout"]: |
349 if self.otherData["standardLayout"]: |
350 if tag is None or tag == '': |
350 if tag is None or tag == '': |
351 svnUrl = '%s/trunk' % vcsDir |
351 svnUrl = '{0}/trunk'.format(vcsDir) |
352 else: |
352 else: |
353 if not tag.startswith('tags') and not tag.startswith('branches'): |
353 if not tag.startswith('tags') and not tag.startswith('branches'): |
354 type_, ok = QInputDialog.getItem(\ |
354 type_, ok = QInputDialog.getItem(\ |
355 None, |
355 None, |
356 self.trUtf8("Subversion Checkout"), |
356 self.trUtf8("Subversion Checkout"), |
359 " Please select from the list."), |
359 " Please select from the list."), |
360 self.tagTypeList, |
360 self.tagTypeList, |
361 0, False) |
361 0, False) |
362 if not ok: |
362 if not ok: |
363 return False |
363 return False |
364 tag = '%s/%s' % (type_, tag) |
364 tag = '{0}/{1}'.format(type_, tag) |
365 svnUrl = '%s/%s' % (vcsDir, tag) |
365 svnUrl = '{0}/{1}'.format(vcsDir, tag) |
366 else: |
366 else: |
367 svnUrl = vcsDir |
367 svnUrl = vcsDir |
368 |
368 |
369 opts = self.options['global'] + self.options['checkout'] |
369 opts = self.options['global'] + self.options['checkout'] |
370 recurse = "--non-recursive" not in opts |
370 recurse = "--non-recursive" not in opts |
371 url = self.__svnURL(svnUrl) |
371 url = self.__svnURL(svnUrl) |
372 client = self.getClient() |
372 client = self.getClient() |
373 if not noDialog: |
373 if not noDialog: |
374 dlg = \ |
374 dlg = \ |
375 SvnDialog(self.trUtf8('Checking project out of Subversion repository'), |
375 SvnDialog(self.trUtf8('Checking project out of Subversion repository'), |
376 "checkout%s %s %s" % \ |
376 "checkout{0} {1} {2}".format( |
377 ((not recurse) and " --non-recursive" or "", |
377 (not recurse) and " --non-recursive" or "", |
378 url, projectDir), |
378 url, projectDir), |
379 client) |
379 client) |
380 QApplication.processEvents() |
380 QApplication.processEvents() |
381 locker = QMutexLocker(self.vcsExecutionMutex) |
381 locker = QMutexLocker(self.vcsExecutionMutex) |
382 try: |
382 try: |
383 client.checkout(url, projectDir, recurse) |
383 client.checkout(url, projectDir, recurse) |
404 tag = vcsDataDict["tag"] |
404 tag = vcsDataDict["tag"] |
405 except KeyError: |
405 except KeyError: |
406 tag = None |
406 tag = None |
407 vcsDir = self.svnNormalizeURL(vcsDataDict["url"]) |
407 vcsDir = self.svnNormalizeURL(vcsDataDict["url"]) |
408 if vcsDir.startswith('/') or vcsDir[1] == '|': |
408 if vcsDir.startswith('/') or vcsDir[1] == '|': |
409 vcsDir = 'file://%s' % vcsDir |
409 vcsDir = 'file://{0}'.format(vcsDir) |
410 |
410 |
411 if self.otherData["standardLayout"]: |
411 if self.otherData["standardLayout"]: |
412 if tag is None or tag == '': |
412 if tag is None or tag == '': |
413 svnUrl = '%s/trunk' % vcsDir |
413 svnUrl = '{0}/trunk'.format(vcsDir) |
414 else: |
414 else: |
415 if not tag.startswith('tags') and not tag.startswith('branches'): |
415 if not tag.startswith('tags') and not tag.startswith('branches'): |
416 type_, ok = QInputDialog.getItem(\ |
416 type_, ok = QInputDialog.getItem(\ |
417 None, |
417 None, |
418 self.trUtf8("Subversion Export"), |
418 self.trUtf8("Subversion Export"), |
421 " Please select from the list."), |
421 " Please select from the list."), |
422 self.tagTypeList, |
422 self.tagTypeList, |
423 0, False) |
423 0, False) |
424 if not ok: |
424 if not ok: |
425 return False |
425 return False |
426 tag = '%s/%s' % (type_, tag) |
426 tag = '{0}/{1}'.format(type_, tag) |
427 svnUrl = '%s/%s' % (vcsDir, tag) |
427 svnUrl = '{0}/{1}'.format(vcsDir, tag) |
428 else: |
428 else: |
429 svnUrl = vcsDir |
429 svnUrl = vcsDir |
430 |
430 |
431 opts = self.options['global'] |
431 opts = self.options['global'] |
432 recurse = "--non-recursive" not in opts |
432 recurse = "--non-recursive" not in opts |
433 url = self.__svnURL(svnUrl) |
433 url = self.__svnURL(svnUrl) |
434 client = self.getClient() |
434 client = self.getClient() |
435 dlg = \ |
435 dlg = \ |
436 SvnDialog(self.trUtf8('Exporting project from Subversion repository'), |
436 SvnDialog(self.trUtf8('Exporting project from Subversion repository'), |
437 "export --force%s %s %s" % \ |
437 "export --force{0} {1} {2}".format( |
438 ((not recurse) and " --non-recursive" or "", |
438 (not recurse) and " --non-recursive" or "", |
439 url, projectDir), |
439 url, projectDir), |
440 client) |
440 client) |
441 QApplication.processEvents() |
441 QApplication.processEvents() |
442 locker = QMutexLocker(self.vcsExecutionMutex) |
442 locker = QMutexLocker(self.vcsExecutionMutex) |
443 try: |
443 try: |
444 client.export(url, projectDir, force = True, recurse = recurse) |
444 client.export(url, projectDir, force = True, recurse = recurse) |
518 keeplocks = "--keep-locks" in opts |
518 keeplocks = "--keep-locks" in opts |
519 client = self.getClient() |
519 client = self.getClient() |
520 if not noDialog: |
520 if not noDialog: |
521 dlg = \ |
521 dlg = \ |
522 SvnDialog(self.trUtf8('Commiting changes to Subversion repository'), |
522 SvnDialog(self.trUtf8('Commiting changes to Subversion repository'), |
523 "commit%s%s%s%s --message %s %s" % \ |
523 "commit{0}{1}{2}{3} --message {4} {5}".format( |
524 ((not recurse) and " --non-recursive" or "", |
524 (not recurse) and " --non-recursive" or "", |
525 keeplocks and " --keep-locks" or "", |
525 keeplocks and " --keep-locks" or "", |
526 keepChangelists and " --keep-changelists" or "", |
526 keepChangelists and " --keep-changelists" or "", |
527 changelists and \ |
527 changelists and \ |
528 " --changelist ".join([""] + changelists) or "", |
528 " --changelist ".join([""] + changelists) or "", |
529 msg, " ".join(fnames)), |
529 msg, " ".join(fnames)), |
530 client) |
530 client) |
531 QApplication.processEvents() |
531 QApplication.processEvents() |
532 try: |
532 try: |
533 if changelists: |
533 if changelists: |
534 rev = client.checkin(fnames, msg, |
534 rev = client.checkin(fnames, msg, |
574 recurse = "--non-recursive" not in opts |
574 recurse = "--non-recursive" not in opts |
575 client = self.getClient() |
575 client = self.getClient() |
576 if not noDialog: |
576 if not noDialog: |
577 dlg = \ |
577 dlg = \ |
578 SvnDialog(self.trUtf8('Synchronizing with the Subversion repository'), |
578 SvnDialog(self.trUtf8('Synchronizing with the Subversion repository'), |
579 "update%s %s" % ((not recurse) and " --non-recursive" or "", |
579 "update{0} {1}".format( |
|
580 (not recurse) and " --non-recursive" or "", |
580 " ".join(fnames)), |
581 " ".join(fnames)), |
581 client) |
582 client) |
582 QApplication.processEvents() |
583 QApplication.processEvents() |
583 try: |
584 try: |
584 client.update(fnames, recurse) |
585 client.update(fnames, recurse) |
648 client = self.getClient() |
649 client = self.getClient() |
649 if not noDialog: |
650 if not noDialog: |
650 dlg = \ |
651 dlg = \ |
651 SvnDialog(\ |
652 SvnDialog(\ |
652 self.trUtf8('Adding files/directories to the Subversion repository'), |
653 self.trUtf8('Adding files/directories to the Subversion repository'), |
653 "add --non-recursive%s%s %s" % \ |
654 "add --non-recursive{0}{1} {2}".format( |
654 (force and " --force" or "", |
655 force and " --force" or "", |
655 noignore and " --no-ignore" or "", |
656 noignore and " --no-ignore" or "", |
656 " ".join(names)), |
657 " ".join(names)), |
657 client) |
658 client) |
658 QApplication.processEvents() |
659 QApplication.processEvents() |
659 try: |
660 try: |
660 client.add(names, recurse = recurse, force = force, ignore = not noignore) |
661 client.add(names, recurse = recurse, force = force, ignore = not noignore) |
661 except pysvn.ClientError as e: |
662 except pysvn.ClientError as e: |
721 ignore = "--ignore" in opts |
722 ignore = "--ignore" in opts |
722 client = self.getClient() |
723 client = self.getClient() |
723 dlg = \ |
724 dlg = \ |
724 SvnDialog(\ |
725 SvnDialog(\ |
725 self.trUtf8('Adding directory trees to the Subversion repository'), |
726 self.trUtf8('Adding directory trees to the Subversion repository'), |
726 "add%s%s %s" % \ |
727 "add{0}{1} {2}".format( |
727 (force and " --force" or "", |
728 force and " --force" or "", |
728 ignore and " --ignore" or "", |
729 ignore and " --ignore" or "", |
729 " ".join(names)), |
730 " ".join(names)), |
730 client) |
731 client) |
731 QApplication.processEvents() |
732 QApplication.processEvents() |
732 try: |
733 try: |
733 client.add(names, recurse = recurse, force = force, ignore = ignore) |
734 client.add(names, recurse = recurse, force = force, ignore = ignore) |
734 except pysvn.ClientError as e: |
735 except pysvn.ClientError as e: |
756 client = self.getClient() |
757 client = self.getClient() |
757 if not noDialog: |
758 if not noDialog: |
758 dlg = \ |
759 dlg = \ |
759 SvnDialog(\ |
760 SvnDialog(\ |
760 self.trUtf8('Removing files/directories from the Subversion repository'), |
761 self.trUtf8('Removing files/directories from the Subversion repository'), |
761 "remove%s %s" % \ |
762 "remove{0} {1}".format( |
762 (force and " --force" or "", |
763 force and " --force" or "", |
763 " ".join(name)), |
764 " ".join(name)), |
764 client) |
765 client) |
765 QApplication.processEvents() |
766 QApplication.processEvents() |
766 locker = QMutexLocker(self.vcsExecutionMutex) |
767 locker = QMutexLocker(self.vcsExecutionMutex) |
767 try: |
768 try: |
768 client.remove(name, force = force) |
769 client.remove(name, force = force) |
810 |
811 |
811 if accepted: |
812 if accepted: |
812 client = self.getClient() |
813 client = self.getClient() |
813 if rx_prot.exactMatch(target): |
814 if rx_prot.exactMatch(target): |
814 target = self.__svnURL(target) |
815 target = self.__svnURL(target) |
815 log = "Moving %s to %s" % (name, target) |
816 log = "Moving {0} to {1}".format(name, target) |
816 else: |
817 else: |
817 log = "" |
818 log = "" |
818 target = target |
819 target = target |
819 if not noDialog: |
820 if not noDialog: |
820 dlg = \ |
821 dlg = \ |
821 SvnDialog(\ |
822 SvnDialog(\ |
822 self.trUtf8('Moving {0}').format(name), |
823 self.trUtf8('Moving {0}').format(name), |
823 "move%s%s %s %s" % \ |
824 "move{0}{1} {2} {3}".format( |
824 (force and " --force" or "", |
825 force and " --force" or "", |
825 log and (" --message %s" % log) or "", |
826 log and (" --message {0}".format(log)) or "", |
826 name, target), |
827 name, target), |
827 client, log = log) |
828 client, log = log) |
828 QApplication.processEvents() |
829 QApplication.processEvents() |
829 locker = QMutexLocker(self.vcsExecutionMutex) |
830 locker = QMutexLocker(self.vcsExecutionMutex) |
830 try: |
831 try: |
947 """ be aborted""")) |
948 """ be aborted""")) |
948 return |
949 return |
949 |
950 |
950 reposRoot = rx_base.cap(1) |
951 reposRoot = rx_base.cap(1) |
951 if tagOp in [1, 4]: |
952 if tagOp in [1, 4]: |
952 url = '%s/tags/%s' % (reposRoot, urllib.parse.quote(tag)) |
953 url = '{0}/tags/{1}'.format(reposRoot, urllib.parse.quote(tag)) |
953 elif tagOp in [2, 8]: |
954 elif tagOp in [2, 8]: |
954 url = '%s/branches/%s' % (reposRoot, urllib.parse.quote(tag)) |
955 url = '{0}/branches/{1}'.format(reposRoot, urllib.parse.quote(tag)) |
955 else: |
956 else: |
956 url = self.__svnURL(tag) |
957 url = self.__svnURL(tag) |
957 |
958 |
958 self.tagName = tag |
959 self.tagName = tag |
959 client = self.getClient() |
960 client = self.getClient() |
960 rev = None |
961 rev = None |
961 if tagOp in [1, 2]: |
962 if tagOp in [1, 2]: |
962 log = 'Created tag <%s>' % self.tagName |
963 log = 'Created tag <{0}>'.format(self.tagName) |
963 dlg = \ |
964 dlg = \ |
964 SvnDialog(\ |
965 SvnDialog(\ |
965 self.trUtf8('Tagging {0} in the Subversion repository').format(name), |
966 self.trUtf8('Tagging {0} in the Subversion repository').format(name), |
966 "copy --message %s %s %s" % (log, reposURL, url), |
967 "copy --message {0} {1} {2}".format(log, reposURL, url), |
967 client, log = log) |
968 client, log = log) |
968 QApplication.processEvents() |
969 QApplication.processEvents() |
969 locker = QMutexLocker(self.vcsExecutionMutex) |
970 locker = QMutexLocker(self.vcsExecutionMutex) |
970 try: |
971 try: |
971 rev = client.copy(reposURL, url) |
972 rev = client.copy(reposURL, url) |
972 except pysvn.ClientError as e: |
973 except pysvn.ClientError as e: |
973 dlg.showError(e.args[0]) |
974 dlg.showError(e.args[0]) |
974 locker.unlock() |
975 locker.unlock() |
975 else: |
976 else: |
976 log = 'Deleted tag <%s>' % self.tagName |
977 log = 'Deleted tag <{0}>'.format(self.tagName) |
977 dlg = \ |
978 dlg = \ |
978 SvnDialog(\ |
979 SvnDialog(\ |
979 self.trUtf8('Tagging {0} in the Subversion repository').format(name), |
980 self.trUtf8('Tagging {0} in the Subversion repository').format(name), |
980 "remove --message %s %s" % (log, url), |
981 "remove --message {0} {1}".format(log, url), |
981 client, log = log) |
982 client, log = log) |
982 QApplication.processEvents() |
983 QApplication.processEvents() |
983 locker = QMutexLocker(self.vcsExecutionMutex) |
984 locker = QMutexLocker(self.vcsExecutionMutex) |
984 try: |
985 try: |
985 rev = client.remove(url) |
986 rev = client.remove(url) |
1003 if os.path.isdir(name[0]): |
1004 if os.path.isdir(name[0]): |
1004 recurse = True |
1005 recurse = True |
1005 client = self.getClient() |
1006 client = self.getClient() |
1006 dlg = \ |
1007 dlg = \ |
1007 SvnDialog(self.trUtf8('Reverting changes'), |
1008 SvnDialog(self.trUtf8('Reverting changes'), |
1008 "revert %s %s" % ((not recurse) and " --non-recursive" or "", |
1009 "revert {0} {1}".format((not recurse) and " --non-recursive" or "", |
1009 " ".join(name)), |
1010 " ".join(name)), |
1010 client) |
1011 client) |
1011 QApplication.processEvents() |
1012 QApplication.processEvents() |
1012 locker = QMutexLocker(self.vcsExecutionMutex) |
1013 locker = QMutexLocker(self.vcsExecutionMutex) |
1013 try: |
1014 try: |
1061 return |
1062 return |
1062 |
1063 |
1063 reposRoot = rx_base.cap(1) |
1064 reposRoot = rx_base.cap(1) |
1064 tn = tag |
1065 tn = tag |
1065 if tagType == 1: |
1066 if tagType == 1: |
1066 url = '%s/tags/%s' % (reposRoot, urllib.parse.quote(tag)) |
1067 url = '{0}/tags/{1}'.format(reposRoot, urllib.parse.quote(tag)) |
1067 elif tagType == 2: |
1068 elif tagType == 2: |
1068 url = '%s/branches/%s' % (reposRoot, urllib.parse.quote(tag)) |
1069 url = '{0}/branches/{1}'.format(reposRoot, urllib.parse.quote(tag)) |
1069 elif tagType == 4: |
1070 elif tagType == 4: |
1070 url = '%s/trunk' % (reposRoot) |
1071 url = '{0}/trunk'.format(reposRoot) |
1071 tn = 'HEAD' |
1072 tn = 'HEAD' |
1072 else: |
1073 else: |
1073 url = self.__svnURL(tag) |
1074 url = self.__svnURL(tag) |
1074 tn = url |
1075 tn = url |
1075 |
1076 |
1076 client = self.getClient() |
1077 client = self.getClient() |
1077 dlg = \ |
1078 dlg = \ |
1078 SvnDialog(self.trUtf8('Switching to {0}').format(tn), |
1079 SvnDialog(self.trUtf8('Switching to {0}').format(tn), |
1079 "switch %s %s" % (url, name), |
1080 "switch {0} {1}".format(url, name), |
1080 client) |
1081 client) |
1081 QApplication.processEvents() |
1082 QApplication.processEvents() |
1082 locker = QMutexLocker(self.vcsExecutionMutex) |
1083 locker = QMutexLocker(self.vcsExecutionMutex) |
1083 try: |
1084 try: |
1084 rev = client.switch(name, url) |
1085 rev = client.switch(name, url) |
1174 rev2 = "" |
1175 rev2 = "" |
1175 client = self.getClient() |
1176 client = self.getClient() |
1176 dlg = \ |
1177 dlg = \ |
1177 SvnDialog(\ |
1178 SvnDialog(\ |
1178 self.trUtf8('Merging {0}').format(name), |
1179 self.trUtf8('Merging {0}').format(name), |
1179 "merge%s%s %s %s %s" % \ |
1180 "merge{0}{1} {2} {3} {4}".format( |
1180 ((not recurse) and " --non-recursive" or "", |
1181 (not recurse) and " --non-recursive" or "", |
1181 force and " --force" or "", |
1182 force and " --force" or "", |
1182 "%s%s" % (url1, rev1 and ("@"+rev1) or ""), |
1183 "{0}{1}".format(url1, rev1 and ("@"+rev1) or ""), |
1183 "%s%s" % (url2, rev2 and ("@"+rev2) or ""), |
1184 "{0}{1}".format(url2, rev2 and ("@"+rev2) or ""), |
1184 fname), |
1185 fname), |
1185 client) |
1186 client) |
1186 QApplication.processEvents() |
1187 QApplication.processEvents() |
1187 try: |
1188 try: |
1188 client.merge(url1, revision1, url2, revision2, fname, |
1189 client.merge(url1, revision1, url2, revision2, fname, |
1189 recurse = recurse, force = force) |
1190 recurse = recurse, force = force) |
1293 @param name directory name to be cleaned up (string) |
1294 @param name directory name to be cleaned up (string) |
1294 """ |
1295 """ |
1295 client = self.getClient() |
1296 client = self.getClient() |
1296 dlg = \ |
1297 dlg = \ |
1297 SvnDialog(self.trUtf8('Cleaning up {0}').format(name), |
1298 SvnDialog(self.trUtf8('Cleaning up {0}').format(name), |
1298 "cleanup %s" % name, |
1299 "cleanup {0}".format(name), |
1299 client) |
1300 client) |
1300 QApplication.processEvents() |
1301 QApplication.processEvents() |
1301 locker = QMutexLocker(self.vcsExecutionMutex) |
1302 locker = QMutexLocker(self.vcsExecutionMutex) |
1302 try: |
1303 try: |
1303 client.cleanup(name) |
1304 client.cleanup(name) |
1365 entry = self.getClient().info(ppath) |
1366 entry = self.getClient().info(ppath) |
1366 except pysvn.ClientError as e: |
1367 except pysvn.ClientError as e: |
1367 return e.args[0] |
1368 return e.args[0] |
1368 |
1369 |
1369 if hasattr(pysvn, 'svn_api_version'): |
1370 if hasattr(pysvn, 'svn_api_version'): |
1370 apiVersion = "%s %s" % \ |
1371 apiVersion = "{0} {1}".format( |
1371 (".".join([str(v) for v in pysvn.svn_api_version[:3]]), |
1372 ".".join([str(v) for v in pysvn.svn_api_version[:3]]), |
1372 pysvn.svn_api_version[3]) |
1373 pysvn.svn_api_version[3]) |
1373 else: |
1374 else: |
1374 apiVersion = QApplication.translate('subversion', "unknown") |
1375 apiVersion = QApplication.translate('subversion', "unknown") |
1375 return QApplication.translate('subversion', |
1376 return QApplication.translate('subversion', |
1376 """<h3>Repository information</h3>""" |
1377 """<h3>Repository information</h3>""" |
1377 """<table>""" |
1378 """<table>""" |
1436 opts = self.options['global'] |
1437 opts = self.options['global'] |
1437 recurse = "--non-recursive" not in opts |
1438 recurse = "--non-recursive" not in opts |
1438 client = self.getClient() |
1439 client = self.getClient() |
1439 dlg = \ |
1440 dlg = \ |
1440 SvnDialog(self.trUtf8('Resolving conficts'), |
1441 SvnDialog(self.trUtf8('Resolving conficts'), |
1441 "resolved%s %s" % \ |
1442 "resolved{0} {1}".format( |
1442 ((not recurse) and " --non-recursive" or "", |
1443 (not recurse) and " --non-recursive" or "", |
1443 " ".join(fnames)), |
1444 " ".join(fnames)), |
1444 client) |
1445 client) |
1445 QApplication.processEvents() |
1446 QApplication.processEvents() |
1446 try: |
1447 try: |
1447 for name in fnames: |
1448 for name in fnames: |
1469 target, force = dlg.getData() |
1470 target, force = dlg.getData() |
1470 |
1471 |
1471 client = self.getClient() |
1472 client = self.getClient() |
1472 if rx_prot.exactMatch(target): |
1473 if rx_prot.exactMatch(target): |
1473 target = self.__svnURL(target) |
1474 target = self.__svnURL(target) |
1474 log = "Copying %s to %s" % (name, target) |
1475 log = "Copying {0} to {1}".format(name, target) |
1475 else: |
1476 else: |
1476 log = "" |
1477 log = "" |
1477 target = target |
1478 target = target |
1478 dlg = \ |
1479 dlg = \ |
1479 SvnDialog(\ |
1480 SvnDialog(\ |
1480 self.trUtf8('Copying {0}').format(name), |
1481 self.trUtf8('Copying {0}').format(name), |
1481 "copy%s %s %s" % \ |
1482 "copy{0} {1} {2}".format( |
1482 (log and (" --message %s" % log) or "", |
1483 log and (" --message {0}".format(log)) or "", |
1483 name, target), |
1484 name, target), |
1484 client, log = log) |
1485 client, log = log) |
1485 QApplication.processEvents() |
1486 QApplication.processEvents() |
1486 locker = QMutexLocker(self.vcsExecutionMutex) |
1487 locker = QMutexLocker(self.vcsExecutionMutex) |
1487 try: |
1488 try: |
1543 skipchecks = "--skip-checks" in opts |
1544 skipchecks = "--skip-checks" in opts |
1544 client = self.getClient() |
1545 client = self.getClient() |
1545 dlg = \ |
1546 dlg = \ |
1546 SvnDialog(\ |
1547 SvnDialog(\ |
1547 self.trUtf8('Subversion Set Property'), |
1548 self.trUtf8('Subversion Set Property'), |
1548 "propset%s%s %s %s %s" % \ |
1549 "propset{0}{1} {2} {3} {4}".format( |
1549 (recurse and " --recurse" or "", |
1550 recurse and " --recurse" or "", |
1550 skipchecks and " --skip-checks" or "", |
1551 skipchecks and " --skip-checks" or "", |
1551 propName, propValue, |
1552 propName, propValue, |
1552 " ".join(fnames)), |
1553 " ".join(fnames)), |
1553 client) |
1554 client) |
1554 QApplication.processEvents() |
1555 QApplication.processEvents() |
1555 try: |
1556 try: |
1556 for name in fnames: |
1557 for name in fnames: |
1557 client.propset(propName, propValue, name, |
1558 client.propset(propName, propValue, name, |
1594 skipchecks = "--skip-checks" in opts |
1595 skipchecks = "--skip-checks" in opts |
1595 client = self.getClient() |
1596 client = self.getClient() |
1596 dlg = \ |
1597 dlg = \ |
1597 SvnDialog(\ |
1598 SvnDialog(\ |
1598 self.trUtf8('Subversion Delete Property'), |
1599 self.trUtf8('Subversion Delete Property'), |
1599 "propdel%s%s %s %s" % \ |
1600 "propdel{0}{1} {2} {3}".format( |
1600 (recurse and " --recurse" or "", |
1601 recurse and " --recurse" or "", |
1601 skipchecks and " --skip-checks" or "", |
1602 skipchecks and " --skip-checks" or "", |
1602 propName, " ".join(fnames)), |
1603 propName, " ".join(fnames)), |
1603 client) |
1604 client) |
1604 QApplication.processEvents() |
1605 QApplication.processEvents() |
1605 try: |
1606 try: |
1606 for name in fnames: |
1607 for name in fnames: |
1607 client.propdel(propName, name, |
1608 client.propdel(propName, name, |
1778 os.chdir(dname) |
1779 os.chdir(dname) |
1779 client = self.getClient() |
1780 client = self.getClient() |
1780 dlg = \ |
1781 dlg = \ |
1781 SvnDialog(\ |
1782 SvnDialog(\ |
1782 self.trUtf8('Locking in the Subversion repository'), |
1783 self.trUtf8('Locking in the Subversion repository'), |
1783 "lock%s%s %s" % \ |
1784 "lock{0}{1} {2}".format( |
1784 (stealIt and " --force" or "", |
1785 stealIt and " --force" or "", |
1785 comment and (" --message %s" % comment) or "", |
1786 comment and (" --message {0}".format(comment)) or "", |
1786 " ".join(fnames)), |
1787 " ".join(fnames)), |
1787 client, parent = parent) |
1788 client, parent = parent) |
1788 QApplication.processEvents() |
1789 QApplication.processEvents() |
1789 try: |
1790 try: |
1790 client.lock(fnames, comment, force = stealIt) |
1791 client.lock(fnames, comment, force = stealIt) |
1791 except pysvn.ClientError as e: |
1792 except pysvn.ClientError as e: |
1816 os.chdir(dname) |
1817 os.chdir(dname) |
1817 client = self.getClient() |
1818 client = self.getClient() |
1818 dlg = \ |
1819 dlg = \ |
1819 SvnDialog(\ |
1820 SvnDialog(\ |
1820 self.trUtf8('Unlocking in the Subversion repository'), |
1821 self.trUtf8('Unlocking in the Subversion repository'), |
1821 "unlock%s %s" % \ |
1822 "unlock{0} {1}".format( |
1822 (breakIt and " --force" or "", |
1823 breakIt and " --force" or "", |
1823 " ".join(fnames)), |
1824 " ".join(fnames)), |
1824 client, parent = parent) |
1825 client, parent = parent) |
1825 QApplication.processEvents() |
1826 QApplication.processEvents() |
1826 try: |
1827 try: |
1827 client.unlock(fnames, force = breakIt) |
1828 client.unlock(fnames, force = breakIt) |
1828 except pysvn.ClientError as e: |
1829 except pysvn.ClientError as e: |
1854 currUrl = self.svnGetReposName(projectPath) |
1855 currUrl = self.svnGetReposName(projectPath) |
1855 dlg = SvnRelocateDialog(currUrl) |
1856 dlg = SvnRelocateDialog(currUrl) |
1856 if dlg.exec_() == QDialog.Accepted: |
1857 if dlg.exec_() == QDialog.Accepted: |
1857 newUrl, inside = dlg.getData() |
1858 newUrl, inside = dlg.getData() |
1858 if inside: |
1859 if inside: |
1859 msg = "switch %s %s" % (newUrl, projectPath) |
1860 msg = "switch {0} {1}".format(newUrl, projectPath) |
1860 else: |
1861 else: |
1861 msg = "relocate %s %s %s" % (currUrl, newUrl, projectPath) |
1862 msg = "relocate {0} {1} {2}".format(currUrl, newUrl, projectPath) |
1862 client = self.getClient() |
1863 client = self.getClient() |
1863 dlg = \ |
1864 dlg = \ |
1864 SvnDialog(self.trUtf8('Relocating'), msg, client) |
1865 SvnDialog(self.trUtf8('Relocating'), msg, client) |
1865 QApplication.processEvents() |
1866 QApplication.processEvents() |
1866 locker = QMutexLocker(self.vcsExecutionMutex) |
1867 locker = QMutexLocker(self.vcsExecutionMutex) |
1910 if not isinstance(names, list): |
1911 if not isinstance(names, list): |
1911 names = [names] |
1912 names = [names] |
1912 client = self.getClient() |
1913 client = self.getClient() |
1913 dlg = \ |
1914 dlg = \ |
1914 SvnDialog(self.trUtf8('Remove from changelist'), |
1915 SvnDialog(self.trUtf8('Remove from changelist'), |
1915 "changelist --remove %s" % " ".join(names), |
1916 "changelist --remove {0}".format(" ".join(names)), |
1916 client) |
1917 client) |
1917 QApplication.processEvents() |
1918 QApplication.processEvents() |
1918 locker = QMutexLocker(self.vcsExecutionMutex) |
1919 locker = QMutexLocker(self.vcsExecutionMutex) |
1919 try: |
1920 try: |
1920 for name in names: |
1921 for name in names: |
1946 return |
1947 return |
1947 |
1948 |
1948 client = self.getClient() |
1949 client = self.getClient() |
1949 dlg = \ |
1950 dlg = \ |
1950 SvnDialog(self.trUtf8('Add to changelist'), |
1951 SvnDialog(self.trUtf8('Add to changelist'), |
1951 "changelist %s" % " ".join(names), |
1952 "changelist {0}".format(" ".join(names)), |
1952 client) |
1953 client) |
1953 QApplication.processEvents() |
1954 QApplication.processEvents() |
1954 locker = QMutexLocker(self.vcsExecutionMutex) |
1955 locker = QMutexLocker(self.vcsExecutionMutex) |
1955 try: |
1956 try: |
1956 for name in names: |
1957 for name in names: |
1976 url = url.split(':', 2) |
1977 url = url.split(':', 2) |
1977 if len(url) == 3: |
1978 if len(url) == 3: |
1978 scheme = url[0] |
1979 scheme = url[0] |
1979 host = url[1] |
1980 host = url[1] |
1980 port, path = url[2].split("/",1) |
1981 port, path = url[2].split("/",1) |
1981 return "%s:%s:%s/%s" % (scheme, host, port, urllib.parse.quote(path)) |
1982 return "{0}:{1}:{2}/{3}".format(scheme, host, port, urllib.parse.quote(path)) |
1982 else: |
1983 else: |
1983 scheme = url[0] |
1984 scheme = url[0] |
1984 if scheme == "file": |
1985 if scheme == "file": |
1985 return "%s:%s" % (scheme, urllib.parse.quote(url[1])) |
1986 return "{0}:{1}".format(scheme, urllib.parse.quote(url[1])) |
1986 else: |
1987 else: |
1987 host, path = url[1][2:].split("/",1) |
1988 host, path = url[1][2:].split("/",1) |
1988 return "%s://%s/%s" % (scheme, host, urllib.parse.quote(path)) |
1989 return "{0}://{1}/{2}".format(scheme, host, urllib.parse.quote(path)) |
1989 |
1990 |
1990 def svnNormalizeURL(self, url): |
1991 def svnNormalizeURL(self, url): |
1991 """ |
1992 """ |
1992 Public method to normalize a url for subversion. |
1993 Public method to normalize a url for subversion. |
1993 |
1994 |
1996 """ |
1997 """ |
1997 url = url.replace('\\', '/') |
1998 url = url.replace('\\', '/') |
1998 if url.endswith('/'): |
1999 if url.endswith('/'): |
1999 url = url[:-1] |
2000 url = url[:-1] |
2000 urll = url.split('//') |
2001 urll = url.split('//') |
2001 return "%s//%s" % (urll[0], '/'.join(urll[1:])) |
2002 return "{0}//{1}".format(urll[0], '/'.join(urll[1:])) |
2002 |
2003 |
2003 ############################################################################ |
2004 ############################################################################ |
2004 ## Methods to get the helper objects are below. |
2005 ## Methods to get the helper objects are below. |
2005 ############################################################################ |
2006 ############################################################################ |
2006 |
2007 |