Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 5548
95b188f96d3d
parent 5514
1aa13333eb9f
child 5587
ea526b78ee6c
equal deleted inserted replaced
5546:971f5ab7429c 5548:95b188f96d3d
351 try: 351 try:
352 rev = vcsDataDict["revision"] 352 rev = vcsDataDict["revision"]
353 except KeyError: 353 except KeyError:
354 rev = None 354 rev = None
355 vcsUrl = self.hgNormalizeURL(vcsDataDict["url"]) 355 vcsUrl = self.hgNormalizeURL(vcsDataDict["url"])
356 if vcsUrl.startswith('/'):
357 vcsUrl = 'file://{0}'.format(vcsUrl)
358 elif vcsUrl[1] in ['|', ':']:
359 vcsUrl = 'file:///{0}'.format(vcsUrl)
360 356
361 args = self.initCommand("clone") 357 args = self.initCommand("clone")
362 if rev: 358 if rev:
363 args.append("--rev") 359 args.append("--rev")
364 args.append(rev) 360 args.append(rev)
365 if vcsDataDict["largefiles"]: 361 if vcsDataDict["largefiles"]:
366 args.append("--all-largefiles") 362 args.append("--all-largefiles")
367 args.append(self.__hgURL(vcsUrl)) 363 args.append(vcsUrl)
368 args.append(projectDir) 364 args.append(projectDir)
369 365
370 if noDialog: 366 if noDialog:
371 if self.__client is None: 367 if self.__client is None:
372 return self.startSynchronizedProcess(QProcess(), 'hg', args) 368 return self.startSynchronizedProcess(QProcess(), 'hg', args)
1492 1488
1493 ########################################################################### 1489 ###########################################################################
1494 ## Private Mercurial specific methods are below. 1490 ## Private Mercurial specific methods are below.
1495 ########################################################################### 1491 ###########################################################################
1496 1492
1497 def __hgURL(self, url):
1498 """
1499 Private method to format a url for Mercurial.
1500
1501 @param url unformatted url string (string)
1502 @return properly formated url for mercurial (string)
1503 """
1504 url = self.hgNormalizeURL(url)
1505 url = url.split(':', 2)
1506 if len(url) == 4:
1507 scheme = url[0]
1508 user = url[1]
1509 host = url[2]
1510 port, path = url[3].split("/", 1)
1511 return "{0}:{1}:{2}:{3}/{4}".format(
1512 scheme, user, host, port, Utilities.quote(path))
1513 elif len(url) == 3:
1514 scheme = url[0]
1515 host = url[1]
1516 port, path = url[2].split("/", 1)
1517 return "{0}:{1}:{2}/{3}".format(
1518 scheme, host, port, Utilities.quote(path))
1519 else:
1520 scheme = url[0]
1521 if scheme == "file":
1522 return "{0}:{1}".format(scheme, Utilities.quote(url[1]))
1523 else:
1524 host, path = url[1][2:].split("/", 1)
1525 return "{0}://{1}/{2}".format(
1526 scheme, host, Utilities.quote(path))
1527
1528 def hgNormalizeURL(self, url): 1493 def hgNormalizeURL(self, url):
1529 """ 1494 """
1530 Public method to normalize a url for Mercurial. 1495 Public method to normalize a url for Mercurial.
1531 1496
1532 @param url url string (string) 1497 @param url url string (string)

eric ide

mercurial