Plugins/VcsPlugins/vcsMercurial/hg.py

branch
Py2 comp.
changeset 3141
72f3bde98c58
parent 3060
5883ce99ee12
child 3145
a9de05d4a22f
equal deleted inserted replaced
3127:e47a9d5954e8 3141:72f3bde98c58
8 """ 8 """
9 9
10 from __future__ import unicode_literals # __IGNORE_WARNING__ 10 from __future__ import unicode_literals # __IGNORE_WARNING__
11 try: 11 try:
12 str = unicode 12 str = unicode
13 import urllib as parse
14 except (NameError): 13 except (NameError):
15 import urllib.parse as parse # __IGNORE_WARNING__ 14 pass
16 15
17 import os 16 import os
18 import shutil 17 import shutil
19 import re 18 import re
20 19
1443 scheme = url[0] 1442 scheme = url[0]
1444 user = url[1] 1443 user = url[1]
1445 host = url[2] 1444 host = url[2]
1446 port, path = url[3].split("/", 1) 1445 port, path = url[3].split("/", 1)
1447 return "{0}:{1}:{2}:{3}/{4}".format( 1446 return "{0}:{1}:{2}:{3}/{4}".format(
1448 scheme, user, host, port, parse.quote(path)) 1447 scheme, user, host, port, Utilities.quote(path))
1449 elif len(url) == 3: 1448 elif len(url) == 3:
1450 scheme = url[0] 1449 scheme = url[0]
1451 host = url[1] 1450 host = url[1]
1452 port, path = url[2].split("/", 1) 1451 port, path = url[2].split("/", 1)
1453 return "{0}:{1}:{2}/{3}".format( 1452 return "{0}:{1}:{2}/{3}".format(
1454 scheme, host, port, parse.quote(path)) 1453 scheme, host, port, Utilities.quote(path))
1455 else: 1454 else:
1456 scheme = url[0] 1455 scheme = url[0]
1457 if scheme == "file": 1456 if scheme == "file":
1458 return "{0}:{1}".format(scheme, parse.quote(url[1])) 1457 return "{0}:{1}".format(scheme, Utilities.quote(url[1]))
1459 else: 1458 else:
1460 host, path = url[1][2:].split("/", 1) 1459 host, path = url[1][2:].split("/", 1)
1461 return "{0}://{1}/{2}".format( 1460 return "{0}://{1}/{2}".format(
1462 scheme, host, parse.quote(path)) 1461 scheme, host, Utilities.quote(path))
1463 1462
1464 def hgNormalizeURL(self, url): 1463 def hgNormalizeURL(self, url):
1465 """ 1464 """
1466 Public method to normalize a url for Mercurial. 1465 Public method to normalize a url for Mercurial.
1467 1466

eric ide

mercurial