~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Robert Collins
  • Date: 2005-09-06 15:39:59 UTC
  • mto: (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050906153959-c79d671a510ca2fc
move RemoteStore to store.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.errors import BzrError
28
28
from bzrlib.trace import mutter
29
29
import bzrlib.ui
 
30
from bzrlib.remotebranch import get_url
30
31
 
31
32
######################################################################
32
33
# stores
281
282
 
282
283
    def __iter__(self):
283
284
        return iter(self._contents.keys())
 
285
 
 
286
 
 
287
class RemoteStore(object):
 
288
 
 
289
    def __init__(self, baseurl):
 
290
        self._baseurl = baseurl
 
291
 
 
292
    def _path(self, name):
 
293
        if '/' in name:
 
294
            raise ValueError('invalid store id', name)
 
295
        return self._baseurl + '/' + name
 
296
        
 
297
    def __getitem__(self, fileid):
 
298
        p = self._path(fileid)
 
299
        try:
 
300
            return get_url(p, compressed=True)
 
301
        except:
 
302
            raise KeyError(fileid)