~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Robert Collins
  • Date: 2007-03-02 03:47:56 UTC
  • mto: (2255.11.3 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070302034756-kkqil9dftr9t14sv
Add unversioned path reporting to TreeDelta.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    """
59
59
    
60
60
    def changes_from(self, other, want_unchanged=False, specific_files=None,
61
 
        extra_trees=None, require_versioned=False, include_root=False):
 
61
        extra_trees=None, require_versioned=False, include_root=False,
 
62
        want_unversioned=False):
62
63
        """Return a TreeDelta of the changes from other to this tree.
63
64
 
64
65
        :param other: A tree to compare with.
73
74
        :param require_versioned: An optional boolean (defaults to False). When
74
75
            supplied and True all the 'specific_files' must be versioned, or
75
76
            a PathsNotVersionedError will be thrown.
 
77
        :param want_unversioned: Scan for unversioned paths.
76
78
 
77
79
        The comparison will be performed by an InterTree object looked up on 
78
80
        self and other.
85
87
            specific_files=specific_files,
86
88
            extra_trees=extra_trees,
87
89
            require_versioned=require_versioned,
88
 
            include_root=include_root
 
90
            include_root=include_root,
 
91
            want_unversioned=want_unversioned,
89
92
            )
90
93
 
91
94
    def _iter_changes(self, from_tree, include_unchanged=False,
93
96
                     require_versioned=True, want_unversioned=False):
94
97
        intertree = InterTree.get(from_tree, self)
95
98
        return intertree._iter_changes(include_unchanged, specific_files, pb,
96
 
            extra_trees, require_versioned)
 
99
            extra_trees, require_versioned, want_unversioned=want_unversioned)
97
100
    
98
101
    def conflicts(self):
99
102
        """Get a list of the conflicts in the tree.
525
528
 
526
529
    @needs_read_lock
527
530
    def compare(self, want_unchanged=False, specific_files=None,
528
 
        extra_trees=None, require_versioned=False, include_root=False):
 
531
        extra_trees=None, require_versioned=False, include_root=False,
 
532
        want_unversioned=False):
529
533
        """Return the changes from source to target.
530
534
 
531
535
        :return: A TreeDelta.
540
544
        :param require_versioned: An optional boolean (defaults to False). When
541
545
            supplied and True all the 'specific_files' must be versioned, or
542
546
            a PathsNotVersionedError will be thrown.
 
547
        :param want_unversioned: Scan for unversioned paths.
543
548
        """
544
549
        # NB: show_status depends on being able to pass in non-versioned files
545
550
        # and report them as unknown
552
557
        if specific_files and not specific_file_ids:
553
558
            # All files are unversioned, so just return an empty delta
554
559
            # _compare_trees would think we want a complete delta
555
 
            return delta.TreeDelta()
 
560
            result = delta.TreeDelta()
 
561
            result.unversioned = list(specific_files)
 
562
            return result
556
563
        return delta._compare_trees(self.source, self.target, want_unchanged,
557
 
            specific_files, include_root, extra_trees=extra_trees)
 
564
            specific_files, include_root, extra_trees=extra_trees,
 
565
            want_unversioned=want_unversioned)
558
566
 
559
567
    def _iter_changes(self, include_unchanged=False,
560
568
                      specific_files=None, pb=None, extra_trees=[],