~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 21:07:17 UTC
  • mfrom: (1393.1.6)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: abentley@panoramicfeedback.com-20050929210717-cd73981590f17017
Merged the weave changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import urlparse
30
30
 
31
31
from bzrlib.errors import BzrError, BzrCheckError
32
 
from bzrlib.branch import Branch, LocalBranch, BZR_BRANCH_FORMAT
 
32
from bzrlib.branch import Branch, LocalBranch, BZR_BRANCH_FORMAT_5
33
33
from bzrlib.trace import mutter
34
 
from bzrlib.xml import serializer_v4
 
34
from bzrlib.weavestore import WeaveStore
 
35
from bzrlib.xml5 import serializer_v5
 
36
 
 
37
 
 
38
# velocitynet.com.au transparently proxies connections and thereby
 
39
# breaks keep-alive -- sucks!
35
40
 
36
41
 
37
42
ENABLE_URLGRABBER = False
87
92
            fmt = ff.read()
88
93
            ff.close()
89
94
 
90
 
            fmt = fmt.rstrip('\r\n')
91
 
            if fmt != BZR_BRANCH_FORMAT.rstrip('\r\n'):
 
95
            if fmt != BZR_BRANCH_FORMAT_5:
92
96
                raise BzrError("sorry, branch format %r not supported at url %s"
93
97
                               % (fmt, url))
94
98
            
117
121
            self.base = _find_remote_root(baseurl)
118
122
        else:
119
123
            self.base = baseurl
120
 
            self._check_format()
 
124
        self._check_format(False)
 
125
        # is guaranteed to be a v5 store
121
126
 
122
 
        self.inventory_store = RemoteStore(baseurl + '/.bzr/inventory-store/')
123
 
        self.text_store = RemoteStore(baseurl + '/.bzr/text-store/')
124
 
        self.revision_store = RemoteStore(baseurl + '/.bzr/revision-store/')
 
127
        cfn = self.controlfilename
 
128
        assert self._branch_format == 5
 
129
        self.control_weaves = WeaveStore(cfn([]), get_url)
 
130
        self.weave_store = WeaveStore(cfn('weaves'), get_url)
 
131
        self.revision_store = RemoteStore(cfn('revision-store'))
125
132
 
126
133
    def __str__(self):
127
134
        b = getattr(self, 'baseurl', 'undefined')
171
178
            revf = self.revision_store[revision_id]
172
179
        except KeyError:
173
180
            raise NoSuchRevision(self, revision_id)
174
 
        r = serializer_v4.read_revision(revf)
 
181
        r = serializer_v5.read_revision(revf)
175
182
        if r.revision_id != revision_id:
176
183
            raise BzrCheckError('revision stored as {%s} actually contains {%s}'
177
184
                                % (revision_id, r.revision_id))
187
194
        if '/' in name:
188
195
            raise ValueError('invalid store id', name)
189
196
        return self._baseurl + '/' + name
 
197
 
 
198
    def __contains__(self, fileid):
 
199
        try:
 
200
            self[fileid]
 
201
            return True
 
202
        except KeyError:
 
203
            return False
190
204
        
191
205
    def __getitem__(self, fileid):
192
206
        p = self._path(fileid)