~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Aaron Bentley
  • Date: 2006-09-19 16:17:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2162.
  • Revision ID: abentley@panoramicfeedback.com-20060919161731-4a099268251f858c
Implement specific file id and dangling id handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
            require_versioned=require_versioned,
84
84
            )
85
85
 
86
 
    def iter_changes(self, from_tree, include_unchanged=False):
87
 
        return InterTree.get(from_tree, self).iter_changes(from_tree, self,
88
 
                                                           include_unchanged)
 
86
    def iter_changes(self, from_tree, include_unchanged=False, 
 
87
                     specific_file_ids=None):
 
88
        intertree = InterTree.get(from_tree, self)
 
89
        return intertree.iter_changes(from_tree, self, include_unchanged, 
 
90
                                      specific_file_ids)
89
91
    
90
92
    def conflicts(self):
91
93
        """Get a list of the conflicts in the tree.
413
415
        return delta._compare_trees(self.source, self.target, want_unchanged,
414
416
            specific_file_ids)
415
417
 
416
 
    def iter_changes(self, from_tree, to_tree, include_unchanged):
 
418
    def iter_changes(self, from_tree, to_tree, include_unchanged, 
 
419
                     specific_file_ids):
417
420
        """Generate an iterator of changes between trees.
418
421
 
419
422
        A tuple is returned:
436
439
                return None
437
440
 
438
441
        to_paths = {}
 
442
        if specific_file_ids is not None:
 
443
            specific_file_ids = set(specific_file_ids)
439
444
        for path, to_entry in to_tree.iter_entries_by_dir():
440
445
            file_id = to_entry.file_id
441
446
            to_paths[file_id] = path
 
447
            if (specific_file_ids is not None and 
 
448
                file_id not in specific_file_ids):
 
449
                continue
442
450
            changed_content = False
443
451
            from_versioned = (file_id in from_tree)
444
452
            versioned = (from_versioned, True)
487
495
            file_id = from_entry.file_id
488
496
            if file_id in to_paths:
489
497
                continue
 
498
            to_path = osutils.pathjoin(to_paths[from_entry.parent_id],
 
499
                                       from_entry.name)
 
500
            to_paths[file_id] = to_path
 
501
            if (specific_file_ids is not None and 
 
502
                file_id not in specific_file_ids):
 
503
                continue
490
504
            versioned = (True, False)
491
505
            parent = (from_entry.parent_id, None)
492
506
            name = (from_entry.name, None)
493
507
            kind = (get_versioned_kind(from_tree, file_id), None)
494
 
            from_executable = (from_tree.is_executable(file_id) not in 
495
 
                               (False, None))
 
508
            if kind[0] is not None:
 
509
                from_executable = (from_tree.is_executable(file_id) not in 
 
510
                                   (False, None))
 
511
            else:
 
512
                from_executable = False
496
513
            executable = (from_executable, None)
497
514
            changed_content = True
498
515
            # the parent's path is necessarily known at this point.
499
 
            to_path = osutils.pathjoin(to_paths[from_entry.parent_id],
500
 
                                       from_entry.name)
501
 
            to_paths[file_id] = to_path
502
516
            yield(file_id, to_path, changed_content, versioned, parent,
503
517
                  name, kind, executable)