~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/test_iter_search_rules.py

  • Committer: Ian Clatworthy
  • Date: 2008-06-25 11:22:03 UTC
  • mto: (3515.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3516.
  • Revision ID: ian.clatworthy@canonical.com-20080625112203-4gu1q0lqmxobmfzw
add namespace for rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.tests.tree_implementations import TestCaseWithTree
24
24
 
25
25
 
 
26
def _patch_in_namespace(lines):
 
27
    lines_with_prefix = []
 
28
    if lines:
 
29
        for line in lines:
 
30
            if line.startswith('['):
 
31
                line = '[%s%s' % (rules.FILE_PREFS_PREFIX, line[1:])
 
32
            lines_with_prefix.append(line)
 
33
    return lines_with_prefix
 
34
 
 
35
 
26
36
class TestIterSearchRules(TestCaseWithTree):
27
37
 
28
38
    def make_per_user_searcher(self, lines):
29
39
        """Make a _RulesSearcher from a list of strings"""
30
 
        return rules._IniBasedRulesSearcher(lines)
 
40
        return rules._IniBasedRulesSearcher(_patch_in_namespace(lines))
31
41
 
32
42
    def make_tree_with_rules(self, text):
33
43
        tree = self.make_branch_and_tree('.')
34
44
        if text is not None:
 
45
            text = ''.join(_patch_in_namespace(text.splitlines(True)))
35
46
            text_utf8 = text.encode('utf-8')
36
47
            self.build_tree_contents([(rules.RULES_TREE_FILENAME, text_utf8)])
37
48
            tree.add(rules.RULES_TREE_FILENAME)