~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 01:43:48 UTC
  • Revision ID: robertc@robertcollins.net-20051006014347-05deb4af2cc259a0
unify previous inventory entry parent logic in preparation for fixing the revision-thrashing bug

Show diffs side-by-side

added added

removed removed

Lines of Context:
340
340
            w = Weave(file_id)
341
341
            self.text_weaves[file_id] = w
342
342
        text_changed = False
343
 
        previous_revisions = {}
344
 
        for parent_inv in parent_invs:
345
 
            if parent_inv.has_id(file_id):
346
 
                previous_ie = parent_inv[file_id]
347
 
                if previous_ie.revision in previous_revisions:
348
 
                    assert previous_revisions[previous_ie.revision] == previous_ie
349
 
                else:
350
 
                    previous_revisions[previous_ie.revision] = previous_ie
351
 
                old_revision = previous_ie.revision
352
 
        for old_revision in previous_revisions:
 
343
        previous_entries = ie.find_previous_heads(parent_invs)
 
344
        for old_revision in previous_entries:
353
345
                # if this fails, its a ghost ?
354
346
                assert old_revision in self.converted_revs 
355
 
        self.snapshot_ie(previous_revisions, ie, w, rev_id)
 
347
        self.snapshot_ie(previous_entries, ie, w, rev_id)
356
348
        del ie.text_id
357
349
        assert getattr(ie, 'revision', None) is not None
358
350
 
359
351
    def snapshot_ie(self, previous_revisions, ie, w, rev_id):
360
352
        # TODO: convert this logic, which is ~= snapshot to
361
353
        # a call to:. This needs the path figured out. rather than a work_tree
362
 
        # a v4 revision_tree can be given, or something that can give the
363
 
        # text for the ie if it needs it.
 
354
        # a v4 revision_tree can be given, or something that looks enough like
 
355
        # one to give the file content to the entry if it needs it.
364
356
        # and we need something that looks like a weave store for snapshot to 
365
357
        # save against.
366
358
        #ie.snapshot(rev, PATH, previous_revisions, REVISION_TREE, InMemoryWeaveStore(self.text_weaves))