/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/rules.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from __future__ import absolute_import
23
23
 
24
 
import configobj
25
 
 
26
 
from . import (
 
24
from bzrlib import (
27
25
    config,
28
26
    cmdline,
29
27
    errors,
30
28
    globbing,
31
29
    osutils,
32
30
    )
 
31
from bzrlib.util.configobj import configobj
33
32
 
34
33
 
35
34
# Name of the file holding rules in a tree
43
42
_per_user_searcher = None
44
43
 
45
44
 
46
 
class UnknownRules(errors.BzrError):
47
 
 
48
 
    _fmt = ('Unknown rules detected: %(unknowns_str)s.')
49
 
 
50
 
    def __init__(self, unknowns):
51
 
        errors.BzrError.__init__(self, unknowns_str=", ".join(unknowns))
52
 
 
53
 
 
54
45
class _RulesSearcher(object):
55
46
    """An object that provides rule-based preferences."""
56
47
 
77
68
 
78
69
    def get_single_value(self, path, preference_name):
79
70
        """Get a single preference for a single file.
80
 
 
 
71
        
81
72
        :returns: The string preference value, or None.
82
73
        """
83
74
        for key, value in self.get_selected_items(path, [preference_name]):
107
98
        if len(patterns) < len(sections):
108
99
            unknowns = [s for s in sections
109
100
                if not s.startswith(FILE_PREFS_PREFIX)]
110
 
            raise UnknownRules(unknowns)
 
101
            raise errors.UnknownRules(unknowns)
111
102
        elif patterns:
112
103
            self._globster = globbing._OrderedGlobster(patterns)
113
104
        else: