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

merge dirstate

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
            return True
135
135
        return self.inventory.has_id(file_id)
136
136
 
 
137
    def is_ignored(self, filename):
 
138
        """Check whether the filename is ignored by this tree.
 
139
 
 
140
        :param filename: The relative filename within the tree.
 
141
        :return: True if the filename is ignored.
 
142
        """
 
143
        return False
 
144
 
137
145
    def __iter__(self):
138
146
        return iter(self.inventory)
139
147
 
140
148
    def id2path(self, file_id):
 
149
        """Return the path for a file id.
 
150
 
 
151
        :raises NoSuchId:
 
152
        """
141
153
        file_id = osutils.safe_file_id(file_id)
142
154
        return self.inventory.id2path(file_id)
143
155
 
588
600
        """Generate an iterator of changes between trees.
589
601
 
590
602
        A tuple is returned:
591
 
        (file_id, path, changed_content, versioned, parent, name, kind,
 
603
        (file_id, (path_in_source, path_in_target),
 
604
         changed_content, versioned, parent, name, kind,
592
605
         executable)
593
606
 
594
 
        Path is relative to the target tree.  changed_content is True if the
595
 
        file's content has changed.  This includes changes to its kind, and to
596
 
        a symlink's target.
 
607
        Changed_content is True if the file's content has changed.  This
 
608
        includes changes to its kind, and to a symlink's target.
597
609
 
598
610
        versioned, parent, name, kind, executable are tuples of (from, to).
599
611
        If a file is missing in a tree, its kind is None.
650
662
                unversioned_path = all_unversioned.popleft()
651
663
                to_kind, to_executable, to_stat = \
652
664
                    self.target._comparison_data(fake_entry, unversioned_path[1])
653
 
                yield (None, unversioned_path[1], True, (False, False),
 
665
                yield (None, (None, unversioned_path[1]), True, (False, False),
654
666
                    (None, None),
655
667
                    (None, unversioned_path[0][-1]),
656
668
                    (None, to_kind),
704
716
            if (changed_content is not False or versioned[0] != versioned[1]
705
717
                or parent[0] != parent[1] or name[0] != name[1] or 
706
718
                executable[0] != executable[1] or include_unchanged):
707
 
                yield (file_id, to_path, changed_content, versioned, parent,
708
 
                       name, kind, executable)
 
719
                yield (file_id, (from_path, to_path), changed_content,
 
720
                    versioned, parent, name, kind, executable)
 
721
 
709
722
        while all_unversioned:
710
723
            # yield any trailing unversioned paths
711
724
            unversioned_path = all_unversioned.popleft()
712
725
            to_kind, to_executable, to_stat = \
713
726
                self.target._comparison_data(fake_entry, unversioned_path[1])
714
 
            yield (None, unversioned_path[1], True, (False, False),
 
727
            yield (None, (None, unversioned_path[1]), True, (False, False),
715
728
                (None, None),
716
729
                (None, unversioned_path[0][-1]),
717
730
                (None, to_kind),
718
731
                (None, to_executable))
719
732
 
720
 
        def get_to_path(from_entry):
721
 
            if from_entry.parent_id is None:
722
 
                to_path = ''
 
733
        def get_to_path(to_entry):
 
734
            if to_entry.parent_id is None:
 
735
                to_path = '' # the root
723
736
            else:
724
 
                if from_entry.parent_id not in to_paths:
725
 
                    get_to_path(self.source.inventory[from_entry.parent_id])
726
 
                to_path = osutils.pathjoin(to_paths[from_entry.parent_id],
727
 
                                           from_entry.name)
728
 
            to_paths[from_entry.file_id] = to_path
 
737
                if to_entry.parent_id not in to_paths:
 
738
                    # recurse up
 
739
                    return get_to_path(self.target.inventory[to_entry.parent_id])
 
740
                to_path = osutils.pathjoin(to_paths[to_entry.parent_id],
 
741
                                           to_entry.name)
 
742
            to_paths[to_entry.file_id] = to_path
729
743
            return to_path
730
744
 
731
745
        for path, from_entry in from_entries_by_dir:
732
746
            file_id = from_entry.file_id
733
747
            if file_id in to_paths:
 
748
                # already returned
734
749
                continue
735
 
            to_path = get_to_path(from_entry)
 
750
            if not file_id in self.target.inventory:
 
751
                # common case - paths we have not emitted are not present in
 
752
                # target.
 
753
                to_path = None
 
754
            else:
 
755
                to_path = get_to_path(self.target.inventory[file_id])
736
756
            entry_count += 1
737
757
            if pb is not None:
738
758
                pb.update('comparing files', entry_count, num_entries)
745
765
            executable = (from_executable, None)
746
766
            changed_content = True
747
767
            # the parent's path is necessarily known at this point.
748
 
            yield(file_id, to_path, changed_content, versioned, parent,
 
768
            yield(file_id, (path, to_path), changed_content, versioned, parent,
749
769
                  name, kind, executable)
750
770
 
751
771