~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-06-28 07:08:27 UTC
  • mfrom: (2553.1.3 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070628070827-h5s313dg5tnag9vj
(robertc) Show the names of commit hooks during commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from bzrlib.osutils import (file_kind, supports_executable, pathjoin, lexists,
35
35
                            delete_any)
36
36
from bzrlib.progress import DummyProgress, ProgressPhase
37
 
from bzrlib.symbol_versioning import deprecated_function, zero_fifteen, \
38
 
        zero_nineteen
 
37
from bzrlib.symbol_versioning import deprecated_function, zero_fifteen
39
38
from bzrlib.trace import mutter, warning
40
39
from bzrlib import tree
41
40
import bzrlib.ui
718
717
    def _duplicate_entries(self, by_parent):
719
718
        """No directory may have two entries with the same name."""
720
719
        conflicts = []
721
 
        if (self._new_name, self._new_parent) == ({}, {}):
722
 
            return conflicts
723
720
        for children in by_parent.itervalues():
724
721
            name_ids = [(self.final_name(t), t) for t in children]
725
722
            name_ids.sort()
786
783
            return True
787
784
        return False
788
785
            
789
 
    def apply(self, no_conflicts=False):
 
786
    def apply(self):
790
787
        """Apply all changes to the inventory and filesystem.
791
788
        
792
789
        If filesystem or inventory conflicts are present, MalformedTransform
793
790
        will be thrown.
794
791
 
795
792
        If apply succeeds, finalize is not necessary.
796
 
 
797
 
        :param no_conflicts: if True, the caller guarantees there are no
798
 
            conflicts, so no check is made.
799
793
        """
800
 
        if not no_conflicts:
801
 
            conflicts = self.find_conflicts()
802
 
            if len(conflicts) != 0:
803
 
                raise MalformedTransform(conflicts=conflicts)
 
794
        conflicts = self.find_conflicts()
 
795
        if len(conflicts) != 0:
 
796
            raise MalformedTransform(conflicts=conflicts)
804
797
        inv = self._tree.inventory
805
798
        inventory_delta = []
806
799
        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
1425
1418
        working_tree.unlock()
1426
1419
 
1427
1420
 
1428
 
@deprecated_function(zero_nineteen)
1429
1421
def change_entry(tt, file_id, working_tree, target_tree, 
1430
1422
                 trans_id_file_id, backups, trans_id, by_parent):
1431
1423
    """Replace a file_id's contents with those from a target tree."""
1432
 
    if file_id is None and target_tree is None:
1433
 
        # skip the logic altogether in the deprecation test
1434
 
        return
1435
1424
    e_trans_id = trans_id_file_id(file_id)
1436
1425
    entry = target_tree.inventory[file_id]
1437
1426
    has_contents, contents_mod, meta_mod, = _entry_changes(file_id, entry, 
1656
1645
        pb.clear()
1657
1646
 
1658
1647
 
1659
 
def conflict_pass(tt, conflicts, path_tree=None):
1660
 
    """Resolve some classes of conflicts.
1661
 
 
1662
 
    :param tt: The transform to resolve conflicts in
1663
 
    :param conflicts: The conflicts to resolve
1664
 
    :param path_tree: A Tree to get supplemental paths from
1665
 
    """
 
1648
def conflict_pass(tt, conflicts):
 
1649
    """Resolve some classes of conflicts."""
1666
1650
    new_conflicts = set()
1667
1651
    for c_type, conflict in ((c[0], c) for c in conflicts):
1668
1652
        if c_type == 'duplicate id':
1699
1683
            except KeyError:
1700
1684
                tt.create_directory(trans_id)
1701
1685
                new_conflicts.add((c_type, 'Created directory', trans_id))
1702
 
                try:
1703
 
                    tt.final_name(trans_id)
1704
 
                except NoFinalPath:
1705
 
                    file_id = tt.final_file_id(trans_id)
1706
 
                    entry = path_tree.inventory[file_id]
1707
 
                    parent_trans_id = tt.trans_id_file_id(entry.parent_id)
1708
 
                    tt.adjust_path(entry.name, parent_trans_id, trans_id)
1709
1686
        elif c_type == 'unversioned parent':
1710
1687
            tt.version_file(tt.inactive_file_id(conflict[1]), conflict[1])
1711
1688
            new_conflicts.add((c_type, 'Versioned directory', conflict[1]))