~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.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:
106
106
        url = url[:idx]        
107
107
        
108
108
 
109
 
 
110
109
class RemoteBranch(Branch):
 
110
 
111
111
    def __init__(self, baseurl, find_root=True):
112
112
        """Create new proxy for a remote branch."""
 
113
        # circular import protection
 
114
        from bzrlib.store import RemoteStore
113
115
        if find_root:
114
116
            self.baseurl = _find_remote_root(baseurl)
115
117
        else:
116
118
            self.baseurl = baseurl
117
119
            self._check_format()
118
 
 
119
120
        self.inventory_store = RemoteStore(baseurl + '/.bzr/inventory-store/')
120
121
        self.text_store = RemoteStore(baseurl + '/.bzr/text-store/')
121
122
        self.revision_store = RemoteStore(baseurl + '/.bzr/revision-store/')
166
167
                                % (revision_id, r.revision_id))
167
168
        return r
168
169
 
169
 
 
170
 
class RemoteStore(object):
171
 
    def __init__(self, baseurl):
172
 
        self._baseurl = baseurl
173
 
        
174
 
 
175
 
    def _path(self, name):
176
 
        if '/' in name:
177
 
            raise ValueError('invalid store id', name)
178
 
        return self._baseurl + '/' + name
179
 
        
180
 
    def __getitem__(self, fileid):
181
 
        p = self._path(fileid)
182
 
        try:
183
 
            return get_url(p, compressed=True)
184
 
        except:
185
 
            raise KeyError(fileid)
186
 
    
187
 
 
188