262 rev = vcsDataDict["revision"] |
262 rev = vcsDataDict["revision"] |
263 except KeyError: |
263 except KeyError: |
264 rev = None |
264 rev = None |
265 vcsUrl = self.hgNormalizeURL(vcsDataDict["url"]) |
265 vcsUrl = self.hgNormalizeURL(vcsDataDict["url"]) |
266 if vcsUrl.startswith('/'): |
266 if vcsUrl.startswith('/'): |
267 vcsUrl = 'file://%s' % vcsUrl |
267 vcsUrl = 'file://{0}'.format(vcsUrl) |
268 elif vcsUrl[1] in ['|', ':']: |
268 elif vcsUrl[1] in ['|', ':']: |
269 vcsUrl = 'file:///%s' % vcsUrl |
269 vcsUrl = 'file:///{0}'.format(vcsUrl) |
270 |
270 |
271 args = [] |
271 args = [] |
272 args.append('clone') |
272 args.append('clone') |
273 self.addArguments(args, self.options['global']) |
273 self.addArguments(args, self.options['global']) |
274 self.addArguments(args, self.options['checkout']) |
274 self.addArguments(args, self.options['checkout']) |
1088 if len(url) == 4: |
1088 if len(url) == 4: |
1089 scheme = url[0] |
1089 scheme = url[0] |
1090 user = url[1] |
1090 user = url[1] |
1091 host = url[2] |
1091 host = url[2] |
1092 port, path = url[3].split("/",1) |
1092 port, path = url[3].split("/",1) |
1093 return "%s:%s:%s:%s/%s" % (scheme, user, host, port, urllib.parse.quote(path)) |
1093 return "{0}:{1}:{2}:{3}/{4}".format( |
|
1094 scheme, user, host, port, urllib.parse.quote(path)) |
1094 elif len(url) == 3: |
1095 elif len(url) == 3: |
1095 scheme = url[0] |
1096 scheme = url[0] |
1096 host = url[1] |
1097 host = url[1] |
1097 port, path = url[2].split("/",1) |
1098 port, path = url[2].split("/",1) |
1098 return "%s:%s:%s/%s" % (scheme, host, port, urllib.parse.quote(path)) |
1099 return "{0}:{1}:{2}/{3}".format(scheme, host, port, urllib.parse.quote(path)) |
1099 else: |
1100 else: |
1100 scheme = url[0] |
1101 scheme = url[0] |
1101 if scheme == "file": |
1102 if scheme == "file": |
1102 return "%s:%s" % (scheme, urllib.parse.quote(url[1])) |
1103 return "{0}:{1}".format(scheme, urllib.parse.quote(url[1])) |
1103 else: |
1104 else: |
1104 host, path = url[1][2:].split("/",1) |
1105 host, path = url[1][2:].split("/",1) |
1105 return "%s://%s/%s" % (scheme, host, urllib.parse.quote(path)) |
1106 return "{0}://{1}/{2}".format(scheme, host, urllib.parse.quote(path)) |
1106 |
1107 |
1107 def hgNormalizeURL(self, url): |
1108 def hgNormalizeURL(self, url): |
1108 """ |
1109 """ |
1109 Public method to normalize a url for Mercurial. |
1110 Public method to normalize a url for Mercurial. |
1110 |
1111 |
1113 """ |
1114 """ |
1114 url = url.replace('\\', '/') |
1115 url = url.replace('\\', '/') |
1115 if url.endswith('/'): |
1116 if url.endswith('/'): |
1116 url = url[:-1] |
1117 url = url[:-1] |
1117 urll = url.split('//') |
1118 urll = url.split('//') |
1118 return "%s//%s" % (urll[0], '/'.join(urll[1:])) |
1119 return "{0}//{1}".format(urll[0], '/'.join(urll[1:])) |
1119 |
1120 |
1120 def hgCopy(self, name, project): |
1121 def hgCopy(self, name, project): |
1121 """ |
1122 """ |
1122 Public method used to copy a file/directory. |
1123 Public method used to copy a file/directory. |
1123 |
1124 |