~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.py

  • Committer: Martin Pool
  • Date: 2005-08-04 21:39:23 UTC
  • Revision ID: mbp@sourcefrog.net-20050804213923-aaf986c9c9a29506
- merge bzrlib.revision.is_ancestor from aaron

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
ENABLE_URLGRABBER = True
40
40
 
 
41
from bzrlib.errors import BzrError
 
42
 
 
43
class GetFailed(BzrError):
 
44
    def __init__(self, url, status):
 
45
        BzrError.__init__(self, "Get %s failed with status %s" % (url, status))
 
46
        self.url = url
 
47
        self.status = status
41
48
 
42
49
if ENABLE_URLGRABBER:
43
50
    import urlgrabber
50
57
                url += '.gz'
51
58
            mutter("grab url %s" % url)
52
59
            url_f = urlgrabber.urlopen(url, keepalive=1, close_connection=0)
 
60
            if url_f.status != 200:
 
61
                raise GetFailed(url, url_f.status)
53
62
            if not compressed:
54
63
                return url_f
55
64
            else:
167
176
        
168
177
    def __getitem__(self, fileid):
169
178
        p = self._path(fileid)
170
 
        return get_url(p, compressed=True)
 
179
        try:
 
180
            return get_url(p, compressed=True)
 
181
        except:
 
182
            raise KeyError(fileid)
171
183
    
172
184
 
173
185