Show More
@@ -1,45 +1,47 b'' | |||||
1 | # statichttprepo.py - simple http repository class for mercurial |
|
1 | # statichttprepo.py - simple http repository class for mercurial | |
2 | # |
|
2 | # | |
3 | # This provides read-only repo access to repositories exported via static http |
|
3 | # This provides read-only repo access to repositories exported via static http | |
4 | # |
|
4 | # | |
5 | # Copyright 2005 Matt Mackall <mpm@selenic.com> |
|
5 | # Copyright 2005 Matt Mackall <mpm@selenic.com> | |
6 | # |
|
6 | # | |
7 | # This software may be used and distributed according to the terms |
|
7 | # This software may be used and distributed according to the terms | |
8 | # of the GNU General Public License, incorporated herein by reference. |
|
8 | # of the GNU General Public License, incorporated herein by reference. | |
9 |
|
9 | |||
10 | from demandload import demandload |
|
10 | from demandload import demandload | |
11 | demandload(globals(), "changelog filelog httprangereader") |
|
11 | demandload(globals(), "changelog filelog httprangereader") | |
12 | demandload(globals(), "localrepo manifest os urllib urllib2") |
|
12 | demandload(globals(), "localrepo manifest os urllib urllib2") | |
13 |
|
13 | |||
14 | class rangereader(httprangereader.httprangereader): |
|
14 | class rangereader(httprangereader.httprangereader): | |
15 | def read(self, size=None): |
|
15 | def read(self, size=None): | |
16 | try: |
|
16 | try: | |
17 | return httprangereader.httprangereader.read(self, size) |
|
17 | return httprangereader.httprangereader.read(self, size) | |
|
18 | except urllib2.HTTPError, inst: | |||
|
19 | raise IOError(None, inst) | |||
18 | except urllib2.URLError, inst: |
|
20 | except urllib2.URLError, inst: | |
19 |
raise IOError(None, |
|
21 | raise IOError(None, inst.reason[1]) | |
20 |
|
22 | |||
21 | def opener(base): |
|
23 | def opener(base): | |
22 | """return a function that opens files over http""" |
|
24 | """return a function that opens files over http""" | |
23 | p = base |
|
25 | p = base | |
24 | def o(path, mode="r"): |
|
26 | def o(path, mode="r"): | |
25 | f = os.path.join(p, urllib.quote(path)) |
|
27 | f = os.path.join(p, urllib.quote(path)) | |
26 | return rangereader(f) |
|
28 | return rangereader(f) | |
27 | return o |
|
29 | return o | |
28 |
|
30 | |||
29 | class statichttprepository(localrepo.localrepository): |
|
31 | class statichttprepository(localrepo.localrepository): | |
30 | def __init__(self, ui, path): |
|
32 | def __init__(self, ui, path): | |
31 | self.path = (path + "/.hg") |
|
33 | self.path = (path + "/.hg") | |
32 | self.ui = ui |
|
34 | self.ui = ui | |
33 | self.opener = opener(self.path) |
|
35 | self.opener = opener(self.path) | |
34 | self.manifest = manifest.manifest(self.opener) |
|
36 | self.manifest = manifest.manifest(self.opener) | |
35 | self.changelog = changelog.changelog(self.opener) |
|
37 | self.changelog = changelog.changelog(self.opener) | |
36 | self.tagscache = None |
|
38 | self.tagscache = None | |
37 | self.nodetagscache = None |
|
39 | self.nodetagscache = None | |
38 | self.encodepats = None |
|
40 | self.encodepats = None | |
39 | self.decodepats = None |
|
41 | self.decodepats = None | |
40 |
|
42 | |||
41 | def dev(self): |
|
43 | def dev(self): | |
42 | return -1 |
|
44 | return -1 | |
43 |
|
45 | |||
44 | def local(self): |
|
46 | def local(self): | |
45 | return False |
|
47 | return False |
@@ -1,23 +1,23 b'' | |||||
1 |
abort: |
|
1 | abort: Connection refused | |
2 | 255 |
|
2 | 255 | |
3 | ls: copy: No such file or directory |
|
3 | ls: copy: No such file or directory | |
4 | changeset: 0:61c9426e69fe |
|
4 | changeset: 0:61c9426e69fe | |
5 | tag: tip |
|
5 | tag: tip | |
6 | user: test |
|
6 | user: test | |
7 | date: Thu Jan 1 00:00:00 1970 +0000 |
|
7 | date: Thu Jan 1 00:00:00 1970 +0000 | |
8 | summary: test |
|
8 | summary: test | |
9 |
|
9 | |||
10 | requesting all changes |
|
10 | requesting all changes | |
11 | adding changesets |
|
11 | adding changesets | |
12 | adding manifests |
|
12 | adding manifests | |
13 | adding file changes |
|
13 | adding file changes | |
14 | added 1 changesets with 1 changes to 1 files |
|
14 | added 1 changesets with 1 changes to 1 files | |
15 | checking changesets |
|
15 | checking changesets | |
16 | checking manifests |
|
16 | checking manifests | |
17 | crosschecking files in changesets and manifests |
|
17 | crosschecking files in changesets and manifests | |
18 | checking files |
|
18 | checking files | |
19 | 1 files, 1 changesets, 1 total revisions |
|
19 | 1 files, 1 changesets, 1 total revisions | |
20 | foo |
|
20 | foo | |
21 | pulling from old-http://localhost:20059/remote |
|
21 | pulling from old-http://localhost:20059/remote | |
22 | searching for changes |
|
22 | searching for changes | |
23 | no changes found |
|
23 | no changes found |
General Comments 0
You need to be logged in to leave comments.
Login now