~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

todo

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
 
88
88
from bzrlib.branch import Branch, find_branch
89
89
from bzrlib.branch import BZR_BRANCH_FORMAT_5, BZR_BRANCH_FORMAT_6
90
 
import bzrlib.hashcache as hashcache
91
90
from bzrlib.revfile import Revfile
92
91
from bzrlib.weave import Weave
93
92
from bzrlib.weavefile import read_weave, write_weave
123
122
            note('starting upgrade from format 5 to 6')
124
123
            self._convert_to_prefixed()
125
124
            self._open_branch()
126
 
        cache = hashcache.HashCache(os.path.abspath(self.base))
127
 
        cache.clear()
128
 
        cache.write()
129
125
        note("finished")
130
126
 
131
127
 
160
156
        # to_read is a stack holding the revisions we still need to process;
161
157
        # appending to it adds new highest-priority revisions
162
158
        self.known_revisions = set(rev_history)
163
 
        self.to_read = rev_history[-1:]
 
159
        self.to_read = [rev_history[-1]]
164
160
        while self.to_read:
165
161
            rev_id = self.to_read.pop()
166
162
            if (rev_id not in self.revisions
263
259
        self.pb.update('loading revision',
264
260
                       len(self.revisions),
265
261
                       len(self.known_revisions))
266
 
        if not self.branch.revision_store.has_id(rev_id):
 
262
        if rev_id not in self.branch.revision_store:
267
263
            self.pb.clear()
268
264
            note('revision {%s} not present in branch; '
269
265
                 'will be converted as a ghost',
270
266
                 rev_id)
271
267
            self.absent_revisions.add(rev_id)
272
268
        else:
273
 
            rev_xml = self.branch.revision_store.get(rev_id).read()
 
269
            rev_xml = self.branch.revision_store[rev_id].read()
274
270
            rev = serializer_v4.read_revision_from_string(rev_xml)
275
271
            for parent_id in rev.parent_ids:
276
272
                self.known_revisions.add(parent_id)
280
276
 
281
277
    def _load_old_inventory(self, rev_id):
282
278
        assert rev_id not in self.converted_revs
283
 
        old_inv_xml = self.branch.inventory_store.get(rev_id).read()
 
279
        old_inv_xml = self.branch.inventory_store[rev_id].read()
284
280
        inv = serializer_v4.read_inventory_from_string(old_inv_xml)
285
281
        rev = self.revisions[rev_id]
286
282
        if rev.inventory_sha1:
375
371
                return
376
372
        parent_indexes = map(w.lookup, previous_revisions)
377
373
        if ie.has_text():
378
 
            file_lines = self.branch.text_store.get(ie.text_id).readlines()
 
374
            file_lines = self.branch.text_store[ie.text_id].readlines()
379
375
            assert sha_strings(file_lines) == ie.text_sha1
380
376
            assert sum(map(len, file_lines)) == ie.text_size
381
377
            w.add(rev_id, parent_indexes, file_lines, ie.text_sha1)