/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 breezy/testament.py

  • Committer: Jelmer Vernooij
  • Date: 2018-06-21 23:03:42 UTC
  • mto: This revision was merged to the branch mainline in revision 6996.
  • Revision ID: jelmer@jelmer.uk-20180621230342-yl9vbifwc2x4ltvt
Avoid text_type()

Show diffs side-by-side

added added

removed removed

Lines of Context:
163
163
    def _escape_path(self, path):
164
164
        if contains_linebreaks(path):
165
165
            raise ValueError(path)
166
 
        return text_type(path.replace('\\', '/').replace(' ', '\\ '))
 
166
        if not isinstance(path, text_type):
 
167
            raise TypeError(path)
 
168
        return path.replace(u'\\', u'/').replace(u' ', u'\\ ')
167
169
 
168
170
    def _entry_to_line(self, path, ie):
169
171
        """Turn an inventory entry into a testament line"""
241
243
    def _escape_path(self, path):
242
244
        if contains_linebreaks(path):
243
245
            raise ValueError(path)
244
 
        if path == '':
245
 
            path = '.'
246
 
        return text_type(path.replace('\\', '/').replace(' ', '\\ '))
 
246
        if not isinstance(path, text_type):
 
247
            # TODO(jelmer): Clean this up for pad.lv/1696545
 
248
            path = path.decode('ascii')
 
249
        if path == u'':
 
250
            path = u'.'
 
251
        return path.replace(u'\\', u'/').replace(u' ', u'\\ ')