~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Ian Clatworthy
  • Date: 2008-05-16 12:55:25 UTC
  • mto: (4171.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 4173.
  • Revision ID: ian.clatworthy@canonical.com-20080516125525-wyi4op2se2onu4r9
add real implementation of Tree.get_filter_stack

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import bzrlib
25
25
from bzrlib import (
26
26
    delta,
 
27
    filters,
27
28
    osutils,
28
29
    revision as _mod_revision,
29
30
    conflicts as _mod_conflicts,
31
32
    )
32
33
from bzrlib.decorators import needs_read_lock
33
34
from bzrlib.errors import BzrError, BzrCheckError
34
 
from bzrlib.filters import filtered_output_lines
35
35
from bzrlib import errors
36
36
from bzrlib.inventory import Inventory, InventoryFile
37
37
from bzrlib.inter import InterObject
436
436
    def print_file(self, file_id):
437
437
        """Print file with id `file_id` to stdout."""
438
438
        import sys
439
 
        sys.stdout.writelines(filtered_output_lines(
 
439
        sys.stdout.writelines(filters.filtered_output_lines(
440
440
            self.get_file_lines(file_id),
441
441
            self._content_filter_stack(file_id=file_id)))
442
442
 
524
524
        :param file_id: file_id or None if unknown
525
525
        :return: the list of filters - [] if there are none
526
526
        """
527
 
        return []
 
527
        filter_pref_names = filters._get_registered_names()
 
528
        if len(filter_pref_names) == 0:
 
529
            return []
 
530
        if path is None:
 
531
            path = self.id2path(file_id)
 
532
        prefs = None
 
533
        # TODO: Replace the line above with the line below
 
534
        # (when the rule-based preferences branch is merged)
 
535
        #prefs = rules.iter_search_rules(self.branch, [path],
 
536
        #    filter_pref_names).next()
 
537
        return filters._get_filter_stack_for(prefs)
528
538
 
529
539
 
530
540
class EmptyTree(Tree):