/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/registry.py

Merge with stacked-fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
167
167
        """
168
168
        return self._dict[self._get_key_or_default(key)].get_obj()
169
169
 
 
170
    def get_prefix(self, fullname):
 
171
        """Return an object whose key is a prefix of the supplied value.
 
172
 
 
173
        :fullname: The name to find a prefix for
 
174
        :return: a tuple of (object, remainder), where the remainder is the
 
175
            portion of the name that did not match the key.
 
176
        """
 
177
        for key, value in self.iteritems():
 
178
            if fullname.startswith(key):
 
179
                return value, fullname[len(key):]
 
180
 
170
181
    def _get_key_or_default(self, key=None):
171
182
        """Return either 'key' or the default key if key is None"""
172
183
        if key is not None: