~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Aaron Bentley
  • Date: 2007-02-08 22:18:50 UTC
  • mto: This revision was merged to the branch mainline in revision 2288.
  • Revision ID: abentley@panoramicfeedback.com-20070208221850-zkmikxazj7n8suc6
Get kind change detection working for iter_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
906
906
    def _iter_changes(self):
907
907
        """Produce output in the same format as Tree._iter_changes.
908
908
 
 
909
        Will produce nonsensical results if invoked while conflicts are
 
910
        present.
 
911
 
909
912
        This reads the Transform, but only reproduces changes involving a
910
913
        file_id.  Files that are not versioned in either of the FROM or TO
911
914
        states are not reflected.
913
916
        final_paths = FinalPaths(self)
914
917
        trans_ids = set(self._removed_id)
915
918
        trans_ids.update(self._new_id.keys())
 
919
        trans_ids.update(self._removed_contents)
 
920
        trans_ids.update(self._new_contents.keys())
 
921
        trans_ids.update(self._new_executability.keys())
 
922
        trans_ids.update(self._new_name.keys())
 
923
        trans_ids.update(self._new_parent.keys())
916
924
        from_trans_ids = {}
917
925
        to_trans_ids = {}
918
926
        modified = False
966
974
                from_kind = None
967
975
                from_executable = False
968
976
            to_name = self.final_name(to_trans_id)
969
 
            to_kind = self.final_kind(to_trans_id)
970
 
            to_parent = self.final_parent(to_trans_id)
 
977
            try:
 
978
                to_kind = self.final_kind(to_trans_id)
 
979
            except NoSuchFile:
 
980
                to_kind = None
 
981
            to_parent = self.final_file_id(self.final_parent(to_trans_id))
971
982
            if to_trans_id in self._new_executability:
972
983
                to_executable = self._new_executability[to_trans_id]
973
984
            elif to_trans_id == from_trans_id:
977
988
            to_path = final_paths.get_path(to_trans_id)
978
989
            if from_kind != to_kind:
979
990
                modified = True
 
991
            elif to_kind in ('file' or 'symlink') and (
 
992
                to_trans_id != from_trans_id or
 
993
                to_trans_id in self._new_contents):
 
994
                modified = True
 
995
            if (not modified and from_versioned == to_versioned and
 
996
                from_parent==to_parent and from_name == to_name and
 
997
                from_executable == to_executable):
 
998
                continue
980
999
            yield (file_id, to_path, modified,
981
1000
                   (from_versioned, to_versioned),
982
 
                   (from_parent, from_parent),
 
1001
                   (from_parent, to_parent),
983
1002
                   (from_name, to_name),
984
1003
                   (from_kind, to_kind),
985
1004
                   (from_executable, to_executable))