~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.py

  • Committer: Robert Collins
  • Date: 2005-09-30 02:54:51 UTC
  • mfrom: (1395)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050930025451-47b9e412202be44b
symlink and weaves, whaddya know

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
86
91
            fmt = ff.read()
87
92
            ff.close()
88
93
 
89
 
            fmt = fmt.rstrip('\r\n')
90
 
            if fmt != BZR_BRANCH_FORMAT.rstrip('\r\n'):
 
94
            if fmt != BZR_BRANCH_FORMAT_5:
91
95
                raise BzrError("sorry, branch format %r not supported at url %s"
92
96
                               % (fmt, url))
93
97
            
119
123
            self.base = _find_remote_root(baseurl)
120
124
        else:
121
125
            self.base = baseurl
122
 
            self._check_format()
123
 
        self.inventory_store = RemoteStore(baseurl + '/.bzr/inventory-store/')
124
 
        self.text_store = RemoteStore(baseurl + '/.bzr/text-store/')
125
 
        self.revision_store = RemoteStore(baseurl + '/.bzr/revision-store/')
 
126
        self._check_format(False)
 
127
        # is guaranteed to be a v5 store
 
128
 
 
129
        cfn = self.controlfilename
 
130
        assert self._branch_format == 5
 
131
        self.control_weaves = WeaveStore(cfn([]), get_url)
 
132
        self.weave_store = WeaveStore(cfn('weaves'), get_url)
 
133
        self.revision_store = RemoteStore(cfn('revision-store'))
126
134
 
127
135
    def __str__(self):
128
136
        b = getattr(self, 'baseurl', 'undefined')
133
141
    def setup_caching(self, cache_root):
134
142
        """Set up cached stores located under cache_root"""
135
143
        from bzrlib.meta_store import CachedStore
136
 
        for store_name in ('inventory_store', 'text_store', 'revision_store'):
 
144
        for store_name in ('revision_store',):
137
145
            if not isinstance(getattr(self, store_name), CachedStore):
138
146
                cache_path = os.path.join(cache_root, store_name)
139
147
                os.mkdir(cache_path)
172
180
            revf = self.revision_store[revision_id]
173
181
        except KeyError:
174
182
            raise NoSuchRevision(self, revision_id)
175
 
        r = serializer_v4.read_revision(revf)
 
183
        r = serializer_v5.read_revision(revf)
176
184
        if r.revision_id != revision_id:
177
185
            raise BzrCheckError('revision stored as {%s} actually contains {%s}'
178
186
                                % (revision_id, r.revision_id))
179
187
        return r
180
 
 
181