Show More
@@ -9,7 +9,7 b'' | |||||
9 | from node import * |
|
9 | from node import * | |
10 | from remoterepo import * |
|
10 | from remoterepo import * | |
11 | from i18n import _ |
|
11 | from i18n import _ | |
12 |
import |
|
12 | import repo, os, urllib, urllib2, urlparse, zlib, util, httplib | |
13 | import errno, keepalive, tempfile, socket, changegroup |
|
13 | import errno, keepalive, tempfile, socket, changegroup | |
14 |
|
14 | |||
15 | class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): |
|
15 | class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): | |
@@ -277,7 +277,7 b' class httprepository(remoterepository):' | |||||
277 | if self.caps is None: |
|
277 | if self.caps is None: | |
278 | try: |
|
278 | try: | |
279 | self.caps = self.do_read('capabilities').split() |
|
279 | self.caps = self.do_read('capabilities').split() | |
280 |
except |
|
280 | except repo.RepoError: | |
281 | self.caps = () |
|
281 | self.caps = () | |
282 | self.ui.debug(_('capabilities: %s\n') % |
|
282 | self.ui.debug(_('capabilities: %s\n') % | |
283 | (' '.join(self.caps or ['none']))) |
|
283 | (' '.join(self.caps or ['none']))) | |
@@ -329,7 +329,7 b' class httprepository(remoterepository):' | |||||
329 | proto.startswith('text/plain') or |
|
329 | proto.startswith('text/plain') or | |
330 | proto.startswith('application/hg-changegroup')): |
|
330 | proto.startswith('application/hg-changegroup')): | |
331 | self.ui.debug(_("Requested URL: '%s'\n") % cu) |
|
331 | self.ui.debug(_("Requested URL: '%s'\n") % cu) | |
332 |
raise |
|
332 | raise repo.RepoError(_("'%s' does not appear to be an hg repository") | |
333 | % self._url) |
|
333 | % self._url) | |
334 |
|
334 | |||
335 | if proto.startswith('application/mercurial-'): |
|
335 | if proto.startswith('application/mercurial-'): | |
@@ -337,10 +337,10 b' class httprepository(remoterepository):' | |||||
337 | version = proto.split('-', 1)[1] |
|
337 | version = proto.split('-', 1)[1] | |
338 | version_info = tuple([int(n) for n in version.split('.')]) |
|
338 | version_info = tuple([int(n) for n in version.split('.')]) | |
339 | except ValueError: |
|
339 | except ValueError: | |
340 |
raise |
|
340 | raise repo.RepoError(_("'%s' sent a broken Content-type " | |
341 | "header (%s)") % (self._url, proto)) |
|
341 | "header (%s)") % (self._url, proto)) | |
342 | if version_info > (0, 1): |
|
342 | if version_info > (0, 1): | |
343 |
raise |
|
343 | raise repo.RepoError(_("'%s' uses newer protocol %s") % | |
344 | (self._url, version)) |
|
344 | (self._url, version)) | |
345 |
|
345 | |||
346 | return resp |
|
346 | return resp | |
@@ -358,7 +358,7 b' class httprepository(remoterepository):' | |||||
358 | success, data = d[:-1].split(' ', 1) |
|
358 | success, data = d[:-1].split(' ', 1) | |
359 | if int(success): |
|
359 | if int(success): | |
360 | return bin(data) |
|
360 | return bin(data) | |
361 |
raise |
|
361 | raise repo.RepoError(data) | |
362 |
|
362 | |||
363 | def heads(self): |
|
363 | def heads(self): | |
364 | d = self.do_read("heads") |
|
364 | d = self.do_read("heads") |
@@ -8,7 +8,7 b'' | |||||
8 | from node import * |
|
8 | from node import * | |
9 | from remoterepo import * |
|
9 | from remoterepo import * | |
10 | from i18n import _ |
|
10 | from i18n import _ | |
11 |
import |
|
11 | import repo, os, re, stat, util | |
12 |
|
12 | |||
13 | class sshrepository(remoterepository): |
|
13 | class sshrepository(remoterepository): | |
14 | def __init__(self, ui, path, create=0): |
|
14 | def __init__(self, ui, path, create=0): | |
@@ -17,7 +17,7 b' class sshrepository(remoterepository):' | |||||
17 |
|
17 | |||
18 | m = re.match(r'^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$', path) |
|
18 | m = re.match(r'^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$', path) | |
19 | if not m: |
|
19 | if not m: | |
20 |
self.raise_( |
|
20 | self.raise_(repo.RepoError(_("couldn't parse location %s") % path)) | |
21 |
|
21 | |||
22 | self.user = m.group(2) |
|
22 | self.user = m.group(2) | |
23 | self.host = m.group(3) |
|
23 | self.host = m.group(3) | |
@@ -37,7 +37,7 b' class sshrepository(remoterepository):' | |||||
37 | ui.note('running %s\n' % cmd) |
|
37 | ui.note('running %s\n' % cmd) | |
38 | res = os.system(cmd) |
|
38 | res = os.system(cmd) | |
39 | if res != 0: |
|
39 | if res != 0: | |
40 |
self.raise_( |
|
40 | self.raise_(repo.RepoError(_("could not create remote repo"))) | |
41 |
|
41 | |||
42 | self.validate_repo(ui, sshcmd, args, remotecmd) |
|
42 | self.validate_repo(ui, sshcmd, args, remotecmd) | |
43 |
|
43 | |||
@@ -69,7 +69,7 b' class sshrepository(remoterepository):' | |||||
69 | lines.append(l) |
|
69 | lines.append(l) | |
70 | max_noise -= 1 |
|
70 | max_noise -= 1 | |
71 | else: |
|
71 | else: | |
72 |
self.raise_( |
|
72 | self.raise_(repo.RepoError(_("no suitable response from remote hg"))) | |
73 |
|
73 | |||
74 | self.capabilities = () |
|
74 | self.capabilities = () | |
75 | lines.reverse() |
|
75 | lines.reverse() | |
@@ -136,7 +136,7 b' class sshrepository(remoterepository):' | |||||
136 | if int(success): |
|
136 | if int(success): | |
137 | return bin(data) |
|
137 | return bin(data) | |
138 | else: |
|
138 | else: | |
139 |
self.raise_( |
|
139 | self.raise_(repo.RepoError(data)) | |
140 |
|
140 | |||
141 | def heads(self): |
|
141 | def heads(self): | |
142 | d = self.call("heads") |
|
142 | d = self.call("heads") | |
@@ -175,7 +175,7 b' class sshrepository(remoterepository):' | |||||
175 | def unbundle(self, cg, heads, source): |
|
175 | def unbundle(self, cg, heads, source): | |
176 | d = self.call("unbundle", heads=' '.join(map(hex, heads))) |
|
176 | d = self.call("unbundle", heads=' '.join(map(hex, heads))) | |
177 | if d: |
|
177 | if d: | |
178 |
self.raise_( |
|
178 | self.raise_(repo.RepoError(_("push refused: %s") % d)) | |
179 |
|
179 | |||
180 | while 1: |
|
180 | while 1: | |
181 | d = cg.read(4096) |
|
181 | d = cg.read(4096) | |
@@ -201,7 +201,7 b' class sshrepository(remoterepository):' | |||||
201 | def addchangegroup(self, cg, source, url): |
|
201 | def addchangegroup(self, cg, source, url): | |
202 | d = self.call("addchangegroup") |
|
202 | d = self.call("addchangegroup") | |
203 | if d: |
|
203 | if d: | |
204 |
self.raise_( |
|
204 | self.raise_(repo.RepoError(_("push refused: %s") % d)) | |
205 | while 1: |
|
205 | while 1: | |
206 | d = cg.read(4096) |
|
206 | d = cg.read(4096) | |
207 | if not d: break |
|
207 | if not d: break |
General Comments 0
You need to be logged in to leave comments.
Login now