/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.py

  • Committer: Aaron Bentley
  • Date: 2005-07-27 16:44:44 UTC
  • mto: (1092.1.41) (1185.3.4) (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 1020.
  • Revision ID: abentley@panoramicfeedback.com-20050727164443-b5aa44851803207b
Added unit tests

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
48
41
 
49
42
if ENABLE_URLGRABBER:
50
43
    import urlgrabber
57
50
                url += '.gz'
58
51
            mutter("grab url %s" % url)
59
52
            url_f = urlgrabber.urlopen(url, keepalive=1, close_connection=0)
60
 
            if url_f.status != 200:
61
 
                raise GetFailed(url, url_f.status)
62
53
            if not compressed:
63
54
                return url_f
64
55
            else:
176
167
        
177
168
    def __getitem__(self, fileid):
178
169
        p = self._path(fileid)
179
 
        try:
180
 
            return get_url(p, compressed=True)
181
 
        except:
182
 
            raise KeyError(fileid)
 
170
        return get_url(p, compressed=True)
183
171
    
184
172
 
185
173