equal
deleted
inserted
replaced
31 |
31 |
32 try: |
32 try: |
33 f = self.opener.open(req) |
33 f = self.opener.open(req) |
34 data = f.read() |
34 data = f.read() |
35 code = f.code |
35 code = f.code |
36 except urllib2.HTTPError, inst: |
36 except urllib2.HTTPError as inst: |
37 num = inst.code == 404 and errno.ENOENT or None |
37 num = inst.code == 404 and errno.ENOENT or None |
38 raise IOError(num, inst) |
38 raise IOError(num, inst) |
39 except urllib2.URLError, inst: |
39 except urllib2.URLError as inst: |
40 raise IOError(None, inst.reason[1]) |
40 raise IOError(None, inst.reason[1]) |
41 |
41 |
42 if code == 200: |
42 if code == 200: |
43 # HTTPRangeHandler does nothing if remote does not support |
43 # HTTPRangeHandler does nothing if remote does not support |
44 # Range headers and returns the full entity. Let's slice it. |
44 # Range headers and returns the full entity. Let's slice it. |
104 |
104 |
105 self.names = namespaces.namespaces() |
105 self.names = namespaces.namespaces() |
106 |
106 |
107 try: |
107 try: |
108 requirements = scmutil.readrequires(self.vfs, self.supported) |
108 requirements = scmutil.readrequires(self.vfs, self.supported) |
109 except IOError, inst: |
109 except IOError as inst: |
110 if inst.errno != errno.ENOENT: |
110 if inst.errno != errno.ENOENT: |
111 raise |
111 raise |
112 requirements = set() |
112 requirements = set() |
113 |
113 |
114 # check if it is a non-empty old-style repository |
114 # check if it is a non-empty old-style repository |
115 try: |
115 try: |
116 fp = self.vfs("00changelog.i") |
116 fp = self.vfs("00changelog.i") |
117 fp.read(1) |
117 fp.read(1) |
118 fp.close() |
118 fp.close() |
119 except IOError, inst: |
119 except IOError as inst: |
120 if inst.errno != errno.ENOENT: |
120 if inst.errno != errno.ENOENT: |
121 raise |
121 raise |
122 # we do not care about empty old-style repositories here |
122 # we do not care about empty old-style repositories here |
123 msg = _("'%s' does not appear to be an hg repository") % path |
123 msg = _("'%s' does not appear to be an hg repository") % path |
124 raise error.RepoError(msg) |
124 raise error.RepoError(msg) |