~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

(gz) Fix deprecations of win32utils path function unicode wrappers (Martin
 Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
See MutableTree for more details.
20
20
"""
21
21
 
 
22
from __future__ import absolute_import
22
23
 
23
24
from bzrlib.lazy_import import lazy_import
24
25
lazy_import(globals(), """
71
72
    conformance tests for - rather we are testing MemoryTree specifically, and
72
73
    interface testing implementations of WorkingTree.
73
74
 
74
 
    A mutable tree always has an associated Branch and BzrDir object - the
 
75
    A mutable tree always has an associated Branch and ControlDir object - the
75
76
    branch and bzrdir attributes.
76
77
    """
77
78
    def __init__(self, *args, **kw):
260
261
        :param more_warning: Details about what is happening.
261
262
        """
262
263
        if strict is None:
263
 
            strict = self.branch.get_config().get_user_option_as_bool(opt_name)
 
264
            strict = self.branch.get_config_stack().get(opt_name)
264
265
        if strict is not False:
265
266
            err_class = None
266
267
            if (self.has_changes()):
582
583
        :param parent_ie: Parent inventory entry if known, or None.  If
583
584
            None, the parent is looked up by name and used if present, otherwise it
584
585
            is recursively added.
 
586
        :param path: 
585
587
        :param kind: Kind of new entry (file, directory, etc)
586
 
        :param action: callback(tree, parent_ie, path, kind); can return file_id
 
588
        :param inv_path:
587
589
        :return: Inventory entry for path and a list of paths which have been added.
588
590
        """
589
591
        # Nothing to do if path is already versioned.
628
630
            if (prev_dir is None or not is_inside([prev_dir], path)):
629
631
                yield (path, inv_path, this_ie, None)
630
632
            prev_dir = path
631
 
 
 
633
        
632
634
    def __init__(self, tree, action, conflicts_related=None):
633
635
        self.tree = tree
634
636
        if action is None:
695
697
 
696
698
            # get the contents of this directory.
697
699
 
698
 
            # find the kind of the path being added.
 
700
            # find the kind of the path being added, and save stat_value
 
701
            # for reuse
 
702
            stat_value = None
699
703
            if this_ie is None:
700
 
                kind = osutils.file_kind(abspath)
 
704
                stat_value = osutils.file_stat(abspath)
 
705
                kind = osutils.file_kind_from_stat_mode(stat_value.st_mode)
701
706
            else:
702
707
                kind = this_ie.kind
703
 
 
 
708
            
 
709
            # allow AddAction to skip this file
 
710
            if self.action.skip_file(self.tree,  abspath,  kind,  stat_value):
 
711
                continue
704
712
            if not InventoryEntry.versionable_kind(kind):
705
713
                trace.warning("skipping %s (can't add file of kind '%s')",
706
714
                              abspath, kind)
718
726
 
719
727
            if kind == 'directory' and directory != '':
720
728
                try:
721
 
                    transport = _mod_transport.get_transport(abspath)
 
729
                    transport = _mod_transport.get_transport_from_path(abspath)
722
730
                    controldir.ControlDirFormat.find_format(transport)
723
731
                    sub_tree = True
724
732
                except errors.NotBranchError:
739
747
                # which is perhaps reasonable: adding a new reference is a
740
748
                # special operation and can have a special behaviour.  mbp
741
749
                # 20070306
742
 
                trace.mutter("%r is a nested bzr tree", abspath)
 
750
                trace.warning("skipping nested tree %r", abspath)
743
751
            else:
744
 
                this_ie = self._add_one_and_parent(parent_ie, directory, kind, inv_path)
 
752
                this_ie = self._add_one_and_parent(parent_ie, directory, kind,
 
753
                    inv_path)
745
754
 
746
755
            if kind == 'directory' and not sub_tree:
747
756
                if this_ie.kind != 'directory':
769
778
                        # recurse into this already versioned subdir.
770
779
                        things_to_add.append((subp, sub_invp, sub_ie, this_ie))
771
780
                    else:
772
 
                        # user selection overrides ignoes
 
781
                        # user selection overrides ignores
773
782
                        # ignore while selecting files - if we globbed in the
774
783
                        # outer loop we would ignore user files.
775
784
                        ignore_glob = self.tree.is_ignored(subp)