25
25
from bzrlib import (
26
conflicts as _mod_conflicts,
28
29
revision as _mod_revision,
29
conflicts as _mod_conflicts,
32
33
from bzrlib.decorators import needs_read_lock
513
514
raise NotImplementedError(self.walkdirs)
516
def iter_search_rules(self, path_names, pref_names=None,
517
_default_searcher=rules._per_user_searcher):
518
"""Find the preferences for filenames in a tree.
520
:param path_names: an iterable of paths to find attributes for.
521
Paths are given relative to the root of the tree.
522
:param pref_names: the list of preferences to lookup - None for all
523
:param _default_searcher: private parameter to assist testing - don't use
524
:return: an iterator of tuple sequences, one per path-name.
525
See _RulesSearcher.get_items for details on the tuple sequence.
527
searcher = self._get_rules_searcher(_default_searcher)
528
if searcher is not None:
529
if pref_names is not None:
530
for path in path_names:
531
yield searcher.get_selected_items(path, pref_names)
533
for path in path_names:
534
yield searcher.get_items(path)
537
def _get_rules_searcher(self, default_searcher):
538
"""Get the RulesSearcher for this tree given the default one."""
539
searcher = default_searcher
540
file_id = self.path2id(rules.RULES_TREE_FILENAME)
541
if file_id is not None:
542
ini_file = self.get_file(file_id)
543
searcher = rules._StackedRulesSearcher(
544
[rules._IniBasedRulesSearcher(ini_file), default_searcher])
516
548
class EmptyTree(Tree):