~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Aaron Bentley
  • Date: 2008-08-12 06:14:38 UTC
  • mto: This revision was merged to the branch mainline in revision 3623.
  • Revision ID: aaron@aaronbentley.com-20080812061438-bc1hxhxz0fd829qw
Reduce set tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
478
478
            new_ids.update(id_set)
479
479
        return sorted(FinalPaths(self).get_paths(new_ids))
480
480
 
 
481
    def _inv_new_paths(self):
 
482
        """Determine the paths of all new and changed files.
 
483
 
 
484
        :param filesystem_only: if True, only calculate values for files
 
485
            that require renames or execute bit changes.
 
486
        """
 
487
        new_ids = set()
 
488
        id_sets = (self._new_name, self._new_parent,
 
489
                   self._new_id, self._new_executability)
 
490
        for id_set in id_sets:
 
491
            new_ids.update(id_set)
 
492
        changed_kind = set(self._removed_contents)
 
493
        changed_kind.intersection_update(self._new_contents)
 
494
        changed_kind.difference_update(new_ids)
 
495
        changed_kind = (t for t in changed_kind if self.tree_kind(t) !=
 
496
                        self.final_kind(t))
 
497
        new_ids.update(changed_kind)
 
498
        return sorted(FinalPaths(self).get_paths(new_ids))
 
499
 
 
500
 
481
501
    def tree_kind(self, trans_id):
482
502
        """Determine the file kind in the working tree.
483
503
 
1247
1267
                inventory_delta.append((path, None, file_id, None))
1248
1268
        finally:
1249
1269
            child_pb.finished()
1250
 
        new_paths = self.new_paths(filesystem_only=False)
 
1270
        new_paths = self._inv_new_paths()
1251
1271
        new_path_file_ids = dict((t, self.final_file_id(t)) for p, t in
1252
1272
                                 new_paths)
1253
1273
        entries = self._tree.iter_entries_by_dir(
1263
1283
                if file_id is None:
1264
1284
                    continue
1265
1285
                needs_entry = False
1266
 
                if (trans_id not in self._new_id and
1267
 
                    trans_id not in self._new_name and
1268
 
                    trans_id not in self._new_parent and
1269
 
                    trans_id not in self._new_executability):
1270
 
                    if (trans_id in self._removed_contents and
1271
 
                        trans_id in self._new_contents):
1272
 
                            final_kind = self.final_kind(trans_id)
1273
 
                            final_kinds[trans_id] = final_kind
1274
 
                            if (self.tree_kind(trans_id) == final_kind):
1275
 
                                continue
1276
 
                kind = final_kinds.get(trans_id)
1277
 
                if kind is None:
1278
 
                    try:
1279
 
                        kind = self.final_kind(trans_id)
1280
 
                    except NoSuchFile:
1281
 
                        kind = self._tree.stored_kind(file_id)
 
1286
                try:
 
1287
                    kind = self.final_kind(trans_id)
 
1288
                except NoSuchFile:
 
1289
                    kind = self._tree.stored_kind(file_id)
1282
1290
                parent_trans_id = self.final_parent(trans_id)
1283
1291
                parent_file_id = new_path_file_ids.get(parent_trans_id)
1284
1292
                if parent_file_id is None: