Mercurial > hg
changeset 6045:012ad48a07fa
merge with crew-stable
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 08 Feb 2008 11:55:17 +0100 |
parents | 9360a58a09e6 (current diff) 6605a03cbf87 (diff) |
children | 588ad9227b63 |
files | |
diffstat | 3 files changed, 38 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/statichttprepo.py Thu Feb 07 12:31:29 2008 +0100 +++ b/mercurial/statichttprepo.py Fri Feb 08 11:55:17 2008 +0100 @@ -9,14 +9,16 @@ from i18n import _ import changelog, filelog, httprangereader -import repo, localrepo, manifest, os, urllib, urllib2, util +import repo, localrepo, manifest, util +import urllib, urllib2, errno class rangereader(httprangereader.httprangereader): def read(self, size=None): try: return httprangereader.httprangereader.read(self, size) except urllib2.HTTPError, inst: - raise IOError(None, inst) + num = inst.code == 404 and errno.ENOENT or None + raise IOError(num, inst) except urllib2.URLError, inst: raise IOError(None, inst.reason[1]) @@ -35,11 +37,17 @@ self.path = path.rstrip('/') + "/.hg" self.opener = opener(self.path) + # find requirements try: requirements = self.opener("requires").read().splitlines() - except IOError: - requirements = [] + except IOError, inst: + if inst.errno == errno.ENOENT: + msg = _("'%s' does not appear to be an hg repository") % path + raise repo.RepoError(msg) + else: + requirements = [] + # check them for r in requirements: if r not in self.supported:
--- a/tests/test-static-http Thu Feb 07 12:31:29 2008 +0100 +++ b/tests/test-static-http Fri Feb 08 11:55:17 2008 +0100 @@ -63,4 +63,19 @@ cat a hg paths | sed -e 's,:[0-9][0-9]*/,/,' +echo '% test with empty repo (issue965)' +cd .. +hg init remotempty + +http_proxy= hg clone static-http://localhost:$HGPORT/remotempty local3 | sed -e 's,:[0-9][0-9]*/,/,' + +cd local3 +hg verify +hg paths | sed -e 's,:[0-9][0-9]*/,/,' + +echo '% test with non-repo' +cd .. +mkdir notarepo +http_proxy= hg clone static-http://localhost:$HGPORT/notarepo local3 2>&1 | sed -e 's,:[0-9][0-9]*/,/,' + kill $!
--- a/tests/test-static-http.out Thu Feb 07 12:31:29 2008 +0100 +++ b/tests/test-static-http.out Fri Feb 08 11:55:17 2008 +0100 @@ -42,3 +42,14 @@ 1 files, 1 changesets, 1 total revisions a default = static-http://localhost/ +% test with empty repo (issue965) +no changes found +0 files updated, 0 files merged, 0 files removed, 0 files unresolved +checking changesets +checking manifests +crosschecking files in changesets and manifests +checking files +0 files, 0 changesets, 0 total revisions +default = static-http://localhost/remotempty +% test with non-repo +abort: 'http://localhost/notarepo' does not appear to be an hg repository!