Plugins/VcsPlugins/vcsPySvn/subversion.py

branch
Py2 comp.
changeset 3141
72f3bde98c58
parent 3060
5883ce99ee12
child 3142
55030c09e142
--- a/Plugins/VcsPlugins/vcsPySvn/subversion.py	Wed Dec 04 22:08:03 2013 +0100
+++ b/Plugins/VcsPlugins/vcsPySvn/subversion.py	Fri Dec 13 22:45:47 2013 +0100
@@ -10,8 +10,8 @@
 from __future__ import unicode_literals    # __IGNORE_WARNING__
 
 import os
+import sys
 import shutil
-import urllib.parse
 import time
 
 from PyQt4.QtCore import Qt, QMutexLocker, pyqtSignal, QRegExp, QDateTime
@@ -1078,10 +1078,10 @@
             
             reposRoot = rx_base.cap(1)
             if tagOp in [1, 4]:
-                url = '{0}/tags/{1}'.format(reposRoot, urllib.parse.quote(tag))
+                url = '{0}/tags/{1}'.format(reposRoot, Utilities.quote(tag))
             elif tagOp in [2, 8]:
                 url = '{0}/branches/{1}'.format(
-                    reposRoot, urllib.parse.quote(tag))
+                    reposRoot, Utilities.quote(tag))
         else:
             url = self.__svnURL(tag)
         
@@ -1222,10 +1222,10 @@
             reposRoot = rx_base.cap(1)
             tn = tag
             if tagType == 1:
-                url = '{0}/tags/{1}'.format(reposRoot, urllib.parse.quote(tag))
+                url = '{0}/tags/{1}'.format(reposRoot, Utilities.quote(tag))
             elif tagType == 2:
                 url = '{0}/branches/{1}'.format(
-                    reposRoot, urllib.parse.quote(tag))
+                    reposRoot, Utilities.quote(tag))
             elif tagType == 4:
                 url = '{0}/trunk'.format(reposRoot)
                 tn = 'HEAD'
@@ -1495,6 +1495,7 @@
                 locker.unlock()
                 dirs = [x for x in names.keys() if os.path.isdir(x)]
                 for file in allFiles:
+                    # file.path is always unicode in Python 2
                     name = os.path.normcase(file.path)
                     if file.is_versioned:
                         if name in names:
@@ -1569,6 +1570,7 @@
                                          ignore=True, update=False)
                 locker.unlock()
                 for file in allFiles:
+                    # file.path is always unicode in Python 2
                     name = os.path.normcase(file.path)
                     if file.is_versioned:
                         if name in names:
@@ -1705,6 +1707,10 @@
                 pysvn.svn_api_version[3])
         else:
             apiVersion = QApplication.translate('subversion', "unknown")
+        
+        hmsz = time.strftime("%H:%M:%S %Z", time.localtime(entry.commit_time))
+        if sys.version_info[0] == 2:
+            hmsz = hmsz.decode(sys.getfilesystemencoding())
         return QApplication.translate(
             'subversion',
             """<h3>Repository information</h3>"""
@@ -1728,8 +1734,7 @@
                     entry.commit_revision.number,
                     time.strftime(
                         "%Y-%m-%d", time.localtime(entry.commit_time)),
-                    time.strftime(
-                        "%H:%M:%S %Z", time.localtime(entry.commit_time)),
+                    hmsz,
                     entry.commit_author
                     )
     
@@ -2112,7 +2117,7 @@
                 output = client.cat(name, revision=rev)
             else:
                 output = client.cat(name)
-            output = output.decode()
+            output = output.decode('utf-8')
         except pysvn.ClientError as e:
             error = str(e)
         
@@ -2447,6 +2452,8 @@
                                                 depth=pysvn.depth.infinity)
                 for entry in entries:
                     changelist = entry[1]
+                    if sys.version_info[0] == 2:
+                        changelist = changelist.decode('utf-8')
                     if changelist not in changelists:
                         changelists.append(changelist)
             except pysvn.ClientError:
@@ -2473,11 +2480,11 @@
             host = url[1]
             port, path = url[2].split("/", 1)
             return "{0}:{1}:{2}/{3}".format(scheme, host, port,
-                                            urllib.parse.quote(path))
+                                            Utilities.quote(path))
         else:
             scheme = url[0]
             if scheme == "file":
-                return "{0}:{1}".format(scheme, urllib.parse.quote(url[1]))
+                return "{0}:{1}".format(scheme, Utilities.quote(url[1]))
             else:
                 try:
                     host, path = url[1][2:].split("/", 1)
@@ -2485,7 +2492,7 @@
                     host = url[1][2:]
                     path = ""
                 return "{0}://{1}/{2}".format(scheme, host,
-                                              urllib.parse.quote(path))
+                                              Utilities.quote(path))
 
     def svnNormalizeURL(self, url):
         """

eric ide

mercurial