~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Robert Collins
  • Date: 2005-10-06 06:31:33 UTC
  • Revision ID: robertc@robertcollins.net-20051006063133-5e9bf4c7570cae6c
remove the ancestry weave file

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
from bzrlib.xml5 import serializer_v5
96
96
from bzrlib.trace import mutter, note, warning, enable_default_logging
97
97
from bzrlib.osutils import sha_strings, sha_string
98
 
from bzrlib.commit import merge_ancestry_lines
99
98
 
100
99
 
101
100
class Convert(object):
119
118
        if not os.path.isdir(self.base + '/.bzr/weaves'):
120
119
            os.mkdir(self.base + '/.bzr/weaves')
121
120
        self.inv_weave = Weave('inventory')
122
 
        self.anc_weave = Weave('ancestry')
123
 
        self.ancestries = {}
124
121
        # holds in-memory weaves for all files
125
122
        self.text_weaves = {}
126
123
        os.remove(self.branch.controlfilename('branch-format'))
197
194
 
198
195
    def _write_all_weaves(self):
199
196
        write_a_weave(self.inv_weave, self.base + '/.bzr/inventory.weave')
200
 
        write_a_weave(self.anc_weave, self.base + '/.bzr/ancestry.weave')
201
197
        i = 0
202
198
        try:
203
199
            for file_id, file_weave in self.text_weaves.items():
273
269
                           if p not in self.absent_revisions]
274
270
        self._convert_revision_contents(rev, inv, present_parents)
275
271
        self._store_new_weave(rev, inv, present_parents)
276
 
        self._make_rev_ancestry(rev, present_parents)
277
272
        self.converted_revs.add(rev_id)
278
273
 
279
274
 
295
290
                           new_inv_sha1)
296
291
        rev.inventory_sha1 = new_inv_sha1
297
292
 
298
 
 
299
 
    def _make_rev_ancestry(self, rev, present_parents):
300
 
        rev_id = rev.revision_id
301
 
        for parent_id in present_parents:
302
 
            assert parent_id in self.converted_revs
303
 
        if present_parents:
304
 
            lines = list(self.anc_weave.mash_iter(present_parents))
305
 
        else:
306
 
            lines = []
307
 
        lines.append(rev_id + '\n')
308
 
        if __debug__:
309
 
            parent_ancestries = [self.ancestries[p] for p in present_parents]
310
 
            new_lines = merge_ancestry_lines(rev_id, parent_ancestries)
311
 
            assert set(lines) == set(new_lines)
312
 
            self.ancestries[rev_id] = new_lines
313
 
        self.anc_weave.add(rev_id, present_parents, lines)
314
 
 
315
 
 
316
293
    def _convert_revision_contents(self, rev, inv, present_parents):
317
294
        """Convert all the files within a revision.
318
295