Show More
@@ -9,14 +9,16 b'' | |||
|
9 | 9 | |
|
10 | 10 | from i18n import _ |
|
11 | 11 | import changelog, filelog, httprangereader |
|
12 |
import repo, localrepo, manifest, |
|
|
12 | import repo, localrepo, manifest, util | |
|
13 | import urllib, urllib2, errno | |
|
13 | 14 | |
|
14 | 15 | class rangereader(httprangereader.httprangereader): |
|
15 | 16 | def read(self, size=None): |
|
16 | 17 | try: |
|
17 | 18 | return httprangereader.httprangereader.read(self, size) |
|
18 | 19 | except urllib2.HTTPError, inst: |
|
19 | raise IOError(None, inst) | |
|
20 | num = inst.code == 404 and errno.ENOENT or None | |
|
21 | raise IOError(num, inst) | |
|
20 | 22 | except urllib2.URLError, inst: |
|
21 | 23 | raise IOError(None, inst.reason[1]) |
|
22 | 24 | |
@@ -35,11 +37,17 b' class statichttprepository(localrepo.loc' | |||
|
35 | 37 | |
|
36 | 38 | self.path = path.rstrip('/') + "/.hg" |
|
37 | 39 | self.opener = opener(self.path) |
|
40 | ||
|
38 | 41 | # find requirements |
|
39 | 42 | try: |
|
40 | 43 | requirements = self.opener("requires").read().splitlines() |
|
41 | except IOError: | |
|
42 | requirements = [] | |
|
44 | except IOError, inst: | |
|
45 | if inst.errno == errno.ENOENT: | |
|
46 | msg = _("'%s' does not appear to be an hg repository") % path | |
|
47 | raise repo.RepoError(msg) | |
|
48 | else: | |
|
49 | requirements = [] | |
|
50 | ||
|
43 | 51 | # check them |
|
44 | 52 | for r in requirements: |
|
45 | 53 | if r not in self.supported: |
@@ -63,4 +63,19 b' hg verify' | |||
|
63 | 63 | cat a |
|
64 | 64 | hg paths | sed -e 's,:[0-9][0-9]*/,/,' |
|
65 | 65 | |
|
66 | echo '% test with empty repo (issue965)' | |
|
67 | cd .. | |
|
68 | hg init remotempty | |
|
69 | ||
|
70 | http_proxy= hg clone static-http://localhost:$HGPORT/remotempty local3 | sed -e 's,:[0-9][0-9]*/,/,' | |
|
71 | ||
|
72 | cd local3 | |
|
73 | hg verify | |
|
74 | hg paths | sed -e 's,:[0-9][0-9]*/,/,' | |
|
75 | ||
|
76 | echo '% test with non-repo' | |
|
77 | cd .. | |
|
78 | mkdir notarepo | |
|
79 | http_proxy= hg clone static-http://localhost:$HGPORT/notarepo local3 2>&1 | sed -e 's,:[0-9][0-9]*/,/,' | |
|
80 | ||
|
66 | 81 | kill $! |
@@ -42,3 +42,14 b' checking files' | |||
|
42 | 42 | 1 files, 1 changesets, 1 total revisions |
|
43 | 43 | a |
|
44 | 44 | default = static-http://localhost/ |
|
45 | % test with empty repo (issue965) | |
|
46 | no changes found | |
|
47 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
48 | checking changesets | |
|
49 | checking manifests | |
|
50 | crosschecking files in changesets and manifests | |
|
51 | checking files | |
|
52 | 0 files, 0 changesets, 0 total revisions | |
|
53 | default = static-http://localhost/remotempty | |
|
54 | % test with non-repo | |
|
55 | abort: 'http://localhost/notarepo' does not appear to be an hg repository! |
General Comments 0
You need to be logged in to leave comments.
Login now