Plugins/VcsPlugins/vcsMercurial/hg.py

branch
Py2 comp.
changeset 2575
cbdf5b8a5bc5
parent 2545
2d385ccc14f9
child 2677
3d4277929fb3
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Fri Apr 12 17:30:32 2013 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Fri Apr 12 21:04:00 2013 +0200
@@ -16,9 +16,10 @@
 import os
 import shutil
 import re
-import urllib.request
-import urllib.parse
-import urllib.error
+try:  # Py3
+    import urllib.parse as parse
+except:
+    import urllib as parse
 
 from PyQt4.QtCore import QProcess, pyqtSignal, QFileInfo, QFileSystemWatcher
 from PyQt4.QtGui import QApplication, QDialog, QInputDialog
@@ -1359,19 +1360,19 @@
             host = url[2]
             port, path = url[3].split("/", 1)
             return "{0}:{1}:{2}:{3}/{4}".format(
-                scheme, user, host, port, urllib.parse.quote(path))
+                scheme, user, host, port, parse.quote(path))
         elif len(url) == 3:
             scheme = url[0]
             host = url[1]
             port, path = url[2].split("/", 1)
-            return "{0}:{1}:{2}/{3}".format(scheme, host, port, urllib.parse.quote(path))
+            return "{0}:{1}:{2}/{3}".format(scheme, host, port, parse.quote(path))
         else:
             scheme = url[0]
             if scheme == "file":
-                return "{0}:{1}".format(scheme, urllib.parse.quote(url[1]))
+                return "{0}:{1}".format(scheme, parse.quote(url[1]))
             else:
                 host, path = url[1][2:].split("/", 1)
-                return "{0}://{1}/{2}".format(scheme, host, urllib.parse.quote(path))
+                return "{0}://{1}/{2}".format(scheme, host, parse.quote(path))
 
     def hgNormalizeURL(self, url):
         """

eric ide

mercurial