convert/svn: fix HTTP detection bug introduced by 1b2516a547d4
The probe expected response is a 404 with content, and while urllib returns the
response body in this case, urllib2 raises an HTTP error.
--- a/hgext/convert/subversion.py Wed Nov 11 22:53:01 2009 +0100
+++ b/hgext/convert/subversion.py Thu Nov 12 12:05:43 2009 +0100
@@ -150,17 +150,18 @@
try:
opener = urllib2.build_opener()
rsp = opener.open('%s://%s/!svn/ver/0/.svn' % (proto, path))
- return '<m:human-readable errcode="160013">' in rsp.read()
+ data = rsp.read()
except urllib2.HTTPError, inst:
- if inst.code == 404:
- return False
- # Except for 404 we cannot know for sure this is not an svn repo
- ui.warn(_('svn: cannot probe remote repository, assume it could be '
- 'a subversion repository. Use --source if you know better.\n'))
- return True
+ if inst.code != 404:
+ # Except for 404 we cannot know for sure this is not an svn repo
+ ui.warn(_('svn: cannot probe remote repository, assume it could be '
+ 'a subversion repository. Use --source if you know better.\n'))
+ return True
+ data = inst.fp.read()
except:
# Could be urllib2.URLError if the URL is invalid or anything else.
return False
+ return '<m:human-readable errcode="160013">' in data
protomap = {'http': httpcheck,
'https': httpcheck,