/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-22 16:47:20 UTC
  • mto: (3697.7.4 1.7)
  • mto: This revision was merged to the branch mainline in revision 3748.
  • Revision ID: john@arbash-meinel.com-20080722164720-h66kbfwehfpcpyis
Initial work on _entries_lca.

At least get the basic API working, and track when a file is modified.

I'm going to need a better test setup if I'm going to handle all the test cases in
a way that can be actually understood.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    patiencediff,
28
28
    registry,
29
29
    revision as _mod_revision,
 
30
    tree as _mod_tree,
30
31
    )
31
32
from bzrlib.branch import Branch
32
33
from bzrlib.conflicts import ConflictList, Conflict
638
639
            result.append((file_id, changed, parents3, names3, executable3))
639
640
        return result
640
641
 
 
642
    def _entries_lca(self):
 
643
        """Gather data about files modified between multiple trees.
 
644
 
 
645
        This compares OTHER versus all LCA trees, and for interesting entries,
 
646
        it then compares with THIS and BASE.
 
647
 
 
648
        For the multi-valued entries, the format will be (BASE, [lca1, lca2])
 
649
        :return: [(file_id, changed, parents, names, executable)]
 
650
            file_id     Simple file_id of the entry
 
651
            changed     Boolean, True if the kind or contents changed
 
652
                        else False
 
653
            parents     ((base, [parent_id, in, lcas]), parent_id_other,
 
654
                         parent_id_this)
 
655
            names       ((base, [name, in, lcas]), name_in_other, name_in_this)
 
656
            executable  ((base, [exec, in, lcas]), exec_in_other, exec_in_this)
 
657
        """
 
658
        result = []
 
659
        walker = _mod_tree.MultiWalker(self.other_tree,
 
660
                                       self._lca_trees.values())
 
661
 
 
662
        for path, file_id, other_ie, lca_values in walker.iter_all():
 
663
            # Is this modified at all from any of the other trees?
 
664
            last_rev = other_ie.revision
 
665
            for lca_path, ie in lca_values:
 
666
                if ie.revision != last_rev:
 
667
                    break
 
668
            else: # Identical in all trees
 
669
                continue
 
670
            base_ie = self.base_tree.inventory[file_id]
 
671
            this_ie = self.this_tree.inventory[file_id]
 
672
            result.append((file_id, True,
 
673
                           ((base_ie.parent_id,
 
674
                            [ie.parent_id for path, ie in lca_values]),
 
675
                            other_ie.parent_id, this_ie.parent_id),
 
676
                           ((base_ie.name,
 
677
                            [ie.name for path, ie in lca_values]),
 
678
                            other_ie.name, this_ie.name),
 
679
                           ((base_ie.executable,
 
680
                            [ie.executable for path, ie in lca_values]),
 
681
                            other_ie.executable, this_ie.executable)
 
682
                          ))
 
683
        return result
 
684
 
 
685
 
641
686
    def fix_root(self):
642
687
        try:
643
688
            self.tt.final_kind(self.tt.root)