~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Ian Clatworthy
  • Date: 2008-07-18 15:00:08 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-20080718150008-mjjaa5c60kncqd80
access rules via get_special_file to fix recursion bug

Show diffs side-by-side

added added

removed removed

Lines of Context:
284
284
    def get_file_by_path(self, path):
285
285
        return self.get_file(self._inventory.path2id(path), path)
286
286
 
 
287
    def get_special_file(self, type):
 
288
        """Get a file special to Bazaar.
 
289
 
 
290
        :type: a type of XXX maps to a file path .bzrXXX
 
291
        :return: a file-like object or None if the file does not exist
 
292
        """
 
293
        path = ".bzr" + type
 
294
        file_id = self.path2id(path)
 
295
        if file_id is None:
 
296
            return None
 
297
        else:
 
298
            return self.get_file(file_id, path)
 
299
 
287
300
    def iter_files_bytes(self, desired_files):
288
301
        """Iterate through file contents.
289
302
 
547
560
            return []
548
561
        if path is None:
549
562
            path = self.id2path(file_id)
550
 
        prefs = rules.iter_search_rules(self.branch, [path],
551
 
            filter_pref_names).next()
 
563
        prefs = self.iter_search_rules([path], filter_pref_names).next()
552
564
        return filters._get_filter_stack_for(prefs)
553
565
 
554
566
    def iter_search_rules(self, path_names, pref_names=None,
575
587
    def _get_rules_searcher(self, default_searcher):
576
588
        """Get the RulesSearcher for this tree given the default one."""
577
589
        searcher = default_searcher
578
 
        file_id = self.path2id(rules.RULES_TREE_FILENAME)
579
 
        if file_id is not None:
580
 
            ini_file = self.get_file(file_id)
 
590
        ini_file = self.get_special_file("rules")
 
591
        if ini_file is not None:
581
592
            searcher = rules._StackedRulesSearcher(
582
593
                [rules._IniBasedRulesSearcher(ini_file), default_searcher])
583
594
        return searcher