/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/transform.py

  • Committer: Aaron Bentley
  • Date: 2007-07-17 13:27:14 UTC
  • mfrom: (2624 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070717132714-tmzx9khmg9501k51
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
717
717
    def _duplicate_entries(self, by_parent):
718
718
        """No directory may have two entries with the same name."""
719
719
        conflicts = []
 
720
        if (self._new_name, self._new_parent) == ({}, {}):
 
721
            return conflicts
720
722
        for children in by_parent.itervalues():
721
723
            name_ids = [(self.final_name(t), t) for t in children]
722
724
            name_ids.sort()
783
785
            return True
784
786
        return False
785
787
            
786
 
    def apply(self):
 
788
    def apply(self, no_conflicts=False):
787
789
        """Apply all changes to the inventory and filesystem.
788
790
        
789
791
        If filesystem or inventory conflicts are present, MalformedTransform
790
792
        will be thrown.
791
793
 
792
794
        If apply succeeds, finalize is not necessary.
 
795
 
 
796
        :param no_conflicts: if True, the caller guarantees there are no
 
797
            conflicts, so no check is made.
793
798
        """
794
 
        conflicts = self.find_conflicts()
795
 
        if len(conflicts) != 0:
796
 
            raise MalformedTransform(conflicts=conflicts)
 
799
        if not no_conflicts:
 
800
            conflicts = self.find_conflicts()
 
801
            if len(conflicts) != 0:
 
802
                raise MalformedTransform(conflicts=conflicts)
797
803
        inv = self._tree.inventory
798
804
        inventory_delta = []
799
805
        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
1645
1651
        pb.clear()
1646
1652
 
1647
1653
 
1648
 
def conflict_pass(tt, conflicts):
1649
 
    """Resolve some classes of conflicts."""
 
1654
def conflict_pass(tt, conflicts, path_tree=None):
 
1655
    """Resolve some classes of conflicts.
 
1656
 
 
1657
    :param tt: The transform to resolve conflicts in
 
1658
    :param conflicts: The conflicts to resolve
 
1659
    :param path_tree: A Tree to get supplemental paths from
 
1660
    """
1650
1661
    new_conflicts = set()
1651
1662
    for c_type, conflict in ((c[0], c) for c in conflicts):
1652
1663
        if c_type == 'duplicate id':
1683
1694
            except KeyError:
1684
1695
                tt.create_directory(trans_id)
1685
1696
                new_conflicts.add((c_type, 'Created directory', trans_id))
 
1697
                try:
 
1698
                    tt.final_name(trans_id)
 
1699
                except NoFinalPath:
 
1700
                    file_id = tt.final_file_id(trans_id)
 
1701
                    entry = path_tree.inventory[file_id]
 
1702
                    parent_trans_id = tt.trans_id_file_id(entry.parent_id)
 
1703
                    tt.adjust_path(entry.name, parent_trans_id, trans_id)
1686
1704
        elif c_type == 'unversioned parent':
1687
1705
            tt.version_file(tt.inactive_file_id(conflict[1]), conflict[1])
1688
1706
            new_conflicts.add((c_type, 'Versioned directory', conflict[1]))