~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/rules.py

  • Committer: Ian Clatworthy
  • Date: 2008-07-18 08:40:57 UTC
  • mto: (3564.2.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3565.
  • Revision ID: ian.clatworthy@canonical.com-20080718084057-0gxsxkfb5eco0wh2
RuleSearchers need to return () instead of []

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        """Return the preferences for a path as name,value tuples.
44
44
 
45
45
        :param path: tree relative path
46
 
        :return: [] if no rule matched, otherwise a sequence of name,value
 
46
        :return: () if no rule matched, otherwise a sequence of name,value
47
47
          tuples.
48
48
        """
49
49
        raise NotImplementedError(self.get_items)
53
53
 
54
54
        :param path: tree relative path
55
55
        :param names: the list of preferences to lookup
56
 
        :return: [] if no rule matched, otherwise a sequence of name,value
 
56
        :return: () if no rule matched, otherwise a sequence of name,value
57
57
          tuples. The sequence is the same length as names,
58
58
          tuple order matches the order in names, and
59
59
          undefined preferences are given the value None.
87
87
    def get_items(self, path):
88
88
        """See _RulesSearcher.get_items."""
89
89
        if self._globster is None:
90
 
            return []
 
90
            return ()
91
91
        pat = self._globster.match(path)
92
92
        if pat is None:
93
 
            return []
 
93
            return ()
94
94
        else:
95
95
            all = self._cfg[FILE_PREFS_PREFIX + pat]
96
96
            return tuple(all.items())
98
98
    def get_selected_items(self, path, names):
99
99
        """See _RulesSearcher.get_selected_items."""
100
100
        if self._globster is None:
101
 
            return []
 
101
            return ()
102
102
        pat = self._globster.match(path)
103
103
        if pat is None:
104
 
            return []
 
104
            return ()
105
105
        else:
106
106
            all = self._cfg[FILE_PREFS_PREFIX + pat]
107
107
            return tuple((k, all.get(k)) for k in names)
122
122
            result = searcher.get_items(path)
123
123
            if result:
124
124
                return result
125
 
        return []
 
125
        return ()
126
126
 
127
127
    def get_selected_items(self, path, names):
128
128
        """See _RulesSearcher.get_selected_items."""
130
130
            result = searcher.get_selected_items(path, names)
131
131
            if result:
132
132
                return result
133
 
        return []
 
133
        return ()
134
134
 
135
135
 
136
136
def rules_filename():