~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/rules.py

  • Committer: Marius Kruger
  • Date: 2009-05-02 21:26:05 UTC
  • mto: (4332.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4334.
  • Revision ID: amanic@gmail.com-20090502212605-xw6027quavhmbl4v
Make it possible to blackboxtest rules
* extract rules.reset_rules()
* tree.iter_search_rules now uses the default parameter differently
  to ensure that if we change our rules._per_user_searcher
  after tree.py loaded, that the new one will get used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
FILE_PREFS_PREFIX = 'name '
37
37
FILE_PREFS_PREFIX_LEN = len(FILE_PREFS_PREFIX)
38
38
 
 
39
# The object providing default rules
 
40
_per_user_searcher = None
 
41
 
39
42
 
40
43
class _RulesSearcher(object):
41
44
    """An object that provides rule-based preferences."""
146
149
    return osutils.pathjoin(config.config_dir(), 'rules')
147
150
 
148
151
 
149
 
# The object providing default rules
150
 
_per_user_searcher = _IniBasedRulesSearcher(rules_filename())
 
152
def reset_rules():
 
153
    global _per_user_searcher
 
154
    _per_user_searcher = _IniBasedRulesSearcher(rules_filename())
 
155
 
 
156
reset_rules()