eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py

branch
without_py2_and_pyqt4
changeset 7192
a22eee00b052
parent 7167
b3557e77314a
child 7229
53054eb5b15a
equal deleted inserted replaced
7191:960850ec284c 7192:a22eee00b052
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 import os 12 import os
13 import sys
14 import shutil 13 import shutil
15 import time 14 import time
15 from urllib.parse import quote
16 16
17 from PyQt5.QtCore import Qt, QMutexLocker, pyqtSignal, QRegExp, QDateTime, \ 17 from PyQt5.QtCore import Qt, QMutexLocker, pyqtSignal, QRegExp, QDateTime, \
18 QCoreApplication 18 QCoreApplication
19 from PyQt5.QtWidgets import QLineEdit, QDialog, QInputDialog, QApplication 19 from PyQt5.QtWidgets import QLineEdit, QDialog, QInputDialog, QApplication
20 20
1073 """ be aborted""")) 1073 """ be aborted"""))
1074 return 1074 return
1075 1075
1076 reposRoot = rx_base.cap(1) 1076 reposRoot = rx_base.cap(1)
1077 if tagOp in [1, 4]: 1077 if tagOp in [1, 4]:
1078 url = '{0}/tags/{1}'.format(reposRoot, Utilities.quote(tag)) 1078 url = '{0}/tags/{1}'.format(reposRoot, quote(tag))
1079 elif tagOp in [2, 8]: 1079 elif tagOp in [2, 8]:
1080 url = '{0}/branches/{1}'.format( 1080 url = '{0}/branches/{1}'.format(reposRoot, quote(tag))
1081 reposRoot, Utilities.quote(tag))
1082 else: 1081 else:
1083 url = self.__svnURL(tag) 1082 url = self.__svnURL(tag)
1084 1083
1085 self.tagName = tag 1084 self.tagName = tag
1086 client = self.getClient() 1085 client = self.getClient()
1217 return False 1216 return False
1218 1217
1219 reposRoot = rx_base.cap(1) 1218 reposRoot = rx_base.cap(1)
1220 tn = tag 1219 tn = tag
1221 if tagType == 1: 1220 if tagType == 1:
1222 url = '{0}/tags/{1}'.format(reposRoot, Utilities.quote(tag)) 1221 url = '{0}/tags/{1}'.format(reposRoot, quote(tag))
1223 elif tagType == 2: 1222 elif tagType == 2:
1224 url = '{0}/branches/{1}'.format( 1223 url = '{0}/branches/{1}'.format(reposRoot, quote(tag))
1225 reposRoot, Utilities.quote(tag))
1226 elif tagType == 4: 1224 elif tagType == 4:
1227 url = '{0}/trunk'.format(reposRoot) 1225 url = '{0}/trunk'.format(reposRoot)
1228 tn = 'HEAD' 1226 tn = 'HEAD'
1229 else: 1227 else:
1230 url = self.__svnURL(tag) 1228 url = self.__svnURL(tag)
1723 pysvn.svn_api_version[3]) 1721 pysvn.svn_api_version[3])
1724 else: 1722 else:
1725 apiVersion = QCoreApplication.translate('subversion', "unknown") 1723 apiVersion = QCoreApplication.translate('subversion', "unknown")
1726 1724
1727 hmsz = time.strftime("%H:%M:%S %Z", time.localtime(entry.commit_time)) 1725 hmsz = time.strftime("%H:%M:%S %Z", time.localtime(entry.commit_time))
1728 if sys.version_info[0] == 2:
1729 hmsz = hmsz.decode(sys.getfilesystemencoding())
1730 return QCoreApplication.translate( 1726 return QCoreApplication.translate(
1731 'subversion', 1727 'subversion',
1732 """<h3>Repository information</h3>""" 1728 """<h3>Repository information</h3>"""
1733 """<table>""" 1729 """<table>"""
1734 """<tr><td><b>PySvn V.</b></td><td>{0}</td></tr>""" 1730 """<tr><td><b>PySvn V.</b></td><td>{0}</td></tr>"""
2484 try: 2480 try:
2485 entries = client.get_changelist(ppath, 2481 entries = client.get_changelist(ppath,
2486 depth=pysvn.depth.infinity) 2482 depth=pysvn.depth.infinity)
2487 for entry in entries: 2483 for entry in entries:
2488 changelist = entry[1] 2484 changelist = entry[1]
2489 if sys.version_info[0] == 2:
2490 changelist = changelist.decode('utf-8')
2491 if changelist not in changelists: 2485 if changelist not in changelists:
2492 changelists.append(changelist) 2486 changelists.append(changelist)
2493 except pysvn.ClientError: 2487 except pysvn.ClientError:
2494 pass 2488 pass
2495 locker.unlock() 2489 locker.unlock()
2532 url = url.split(':', 2) 2526 url = url.split(':', 2)
2533 if len(url) == 3: 2527 if len(url) == 3:
2534 scheme = url[0] 2528 scheme = url[0]
2535 host = url[1] 2529 host = url[1]
2536 port, path = url[2].split("/", 1) 2530 port, path = url[2].split("/", 1)
2537 return "{0}:{1}:{2}/{3}".format(scheme, host, port, 2531 return "{0}:{1}:{2}/{3}".format(scheme, host, port, quote(path))
2538 Utilities.quote(path))
2539 else: 2532 else:
2540 scheme = url[0] 2533 scheme = url[0]
2541 if scheme == "file": 2534 if scheme == "file":
2542 return "{0}:{1}".format(scheme, Utilities.quote(url[1])) 2535 return "{0}:{1}".format(scheme, quote(url[1]))
2543 else: 2536 else:
2544 try: 2537 try:
2545 host, path = url[1][2:].split("/", 1) 2538 host, path = url[1][2:].split("/", 1)
2546 except ValueError: 2539 except ValueError:
2547 host = url[1][2:] 2540 host = url[1][2:]
2548 path = "" 2541 path = ""
2549 return "{0}://{1}/{2}".format(scheme, host, 2542 return "{0}://{1}/{2}".format(scheme, host, quote(path))
2550 Utilities.quote(path))
2551 2543
2552 def svnNormalizeURL(self, url): 2544 def svnNormalizeURL(self, url):
2553 """ 2545 """
2554 Public method to normalize a url for subversion. 2546 Public method to normalize a url for subversion.
2555 2547

eric ide

mercurial