~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/rules.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-28 17:11:50 UTC
  • mto: (5193.6.1 texinfo)
  • mto: This revision was merged to the branch mainline in revision 5356.
  • Revision ID: v.ladeuil+lp@free.fr-20100428171150-hrjit8iqn3cjjucc
Rename sphinx related files into a better namespace.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from __future__ import absolute_import
18
 
 
19
17
"""Rule-based definition of preferences for selected files in selected branches.
20
18
 
21
19
See ``bzr help rules`` for details.
66
64
        """
67
65
        raise NotImplementedError(self.get_selected_items)
68
66
 
69
 
    def get_single_value(self, path, preference_name):
70
 
        """Get a single preference for a single file.
71
 
        
72
 
        :returns: The string preference value, or None.
73
 
        """
74
 
        for key, value in self.get_selected_items(path, [preference_name]):
75
 
            return value
76
 
        return None
77
 
 
78
67
 
79
68
class _IniBasedRulesSearcher(_RulesSearcher):
80
69
 
85
74
 
86
75
        :param inifile: the name of the file or a sequence of lines.
87
76
        """
88
 
        self._cfg = configobj.ConfigObj(inifile, encoding='utf-8')
 
77
        options = {'encoding': 'utf-8'}
 
78
        self._cfg = configobj.ConfigObj(inifile, options=options)
89
79
        sections = self._cfg.keys()
90
80
        patterns = []
91
81
        self.pattern_to_section = {}