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

  • Committer: Martin
  • Date: 2017-06-10 01:57:00 UTC
  • mto: This revision was merged to the branch mainline in revision 6679.
  • Revision ID: gzlist@googlemail.com-20170610015700-o3xeuyaqry2obiay
Go back to native str for urls and many other py3 changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1180
1180
        lines = [self.get_format_string()]
1181
1181
        lines.extend([("%s %s\n" % (item[1], item[0])) for item in
1182
1182
            self.features.items()])
1183
 
        return "".join(lines)
 
1183
        # GZ 2016-07-09: Should push byte-ness up a level perhaps?
 
1184
        return "".join(lines).encode('ascii')
1184
1185
 
1185
1186
    @classmethod
1186
1187
    def _find_format(klass, registry, kind, format_string):
1231
1232
        """Return the .bzrdir style format present in a directory."""
1232
1233
        try:
1233
1234
            format_string = transport.get_bytes(".bzr/branch-format")
 
1235
            # GZ 2017-06-09: Where should format strings get decoded...
 
1236
            format_text = format_string.decode("ascii")
1234
1237
        except errors.NoSuchFile:
1235
1238
            raise errors.NotBranchError(path=transport.base)
1236
1239
        try:
1237
 
            first_line = format_string[:format_string.index("\n")+1]
 
1240
            first_line = format_text[:format_text.index("\n")+1]
1238
1241
        except ValueError:
1239
 
            first_line = format_string
 
1242
            first_line = format_text
1240
1243
        try:
1241
1244
            cls = klass.formats.get(first_line)
1242
1245
        except KeyError:
1243
1246
            raise errors.UnknownFormatError(format=first_line, kind='bzrdir')
1244
 
        return cls.from_string(format_string)
 
1247
        return cls.from_string(format_text)
1245
1248
 
1246
1249
    @classmethod
1247
1250
    def known_formats(cls):
1447
1450
        del temp_control
1448
1451
        bzrdir_transport = transport.clone('.bzr')
1449
1452
        utf8_files = [('README',
1450
 
                       "This is a Bazaar control directory.\n"
1451
 
                       "Do not change any files in this directory.\n"
1452
 
                       "See http://bazaar.canonical.com/ for more information about Bazaar.\n"),
 
1453
                       b"This is a Bazaar control directory.\n"
 
1454
                       b"Do not change any files in this directory.\n"
 
1455
                       b"See http://bazaar.canonical.com/ for more information about Bazaar.\n"),
1453
1456
                      ('branch-format', self.as_string()),
1454
1457
                      ]
1455
1458
        # NB: no need to escape relative paths that are url safe.