Show More
@@ -316,6 +316,7 b' class HgRemote(object):' | |||||
316 |
|
316 | |||
317 | @reraise_safe_exceptions |
|
317 | @reraise_safe_exceptions | |
318 | def check_url(self, url, config): |
|
318 | def check_url(self, url, config): | |
|
319 | log.info("Checking URL for remote cloning/import: %s", url) | |||
319 | _proto = None |
|
320 | _proto = None | |
320 | if '+' in url[:url.find('://')]: |
|
321 | if '+' in url[:url.find('://')]: | |
321 | _proto = url[0:url.find('+')] |
|
322 | _proto = url[0:url.find('+')] | |
@@ -345,10 +346,12 b' class HgRemote(object):' | |||||
345 | req = urllib2.Request(cu, None, {}) |
|
346 | req = urllib2.Request(cu, None, {}) | |
346 |
|
347 | |||
347 | try: |
|
348 | try: | |
|
349 | log.debug("Trying to open URL %s", url) | |||
348 | resp = o.open(req) |
|
350 | resp = o.open(req) | |
349 | if resp.code != 200: |
|
351 | if resp.code != 200: | |
350 | raise exceptions.URLError('Return Code is not 200') |
|
352 | raise exceptions.URLError('Return Code is not 200') | |
351 | except Exception as e: |
|
353 | except Exception as e: | |
|
354 | log.warning("URL cannot be opened: %s", url, exc_info=True) | |||
352 | # means it cannot be cloned |
|
355 | # means it cannot be cloned | |
353 | raise exceptions.URLError("[%s] org_exc: %s" % (cleaned_uri, e)) |
|
356 | raise exceptions.URLError("[%s] org_exc: %s" % (cleaned_uri, e)) | |
354 |
|
357 | |||
@@ -358,12 +361,16 b' class HgRemote(object):' | |||||
358 | pass |
|
361 | pass | |
359 | else: |
|
362 | else: | |
360 | # check for pure hg repos |
|
363 | # check for pure hg repos | |
|
364 | log.debug( | |||
|
365 | "Verifying if URL is a Mercurial repository: %s", url) | |||
361 | httppeer(make_ui_from_config(config), url).lookup('tip') |
|
366 | httppeer(make_ui_from_config(config), url).lookup('tip') | |
362 | except Exception as e: |
|
367 | except Exception as e: | |
|
368 | log.warning("URL is not a valid Mercurial repository: %s", url) | |||
363 | raise exceptions.URLError( |
|
369 | raise exceptions.URLError( | |
364 | "url [%s] does not look like an hg repo org_exc: %s" |
|
370 | "url [%s] does not look like an hg repo org_exc: %s" | |
365 | % (cleaned_uri, e)) |
|
371 | % (cleaned_uri, e)) | |
366 |
|
372 | |||
|
373 | log.info("URL is a valid Mercurial repository: %s", url) | |||
367 | return True |
|
374 | return True | |
368 |
|
375 | |||
369 | @reraise_safe_exceptions |
|
376 | @reraise_safe_exceptions |
General Comments 0
You need to be logged in to leave comments.
Login now