/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/bzrbranch.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:
370
370
 
371
371
    def _read_last_revision_info(self):
372
372
        revision_string = self._transport.get_bytes('last-revision')
373
 
        revno, revision_id = revision_string.rstrip('\n').split(' ', 1)
 
373
        revno, revision_id = revision_string.rstrip(b'\n').split(b' ', 1)
374
374
        revision_id = cache_utf8.get_cached_utf8(revision_id)
375
375
        revno = int(revno)
376
376
        return revno, revision_id
670
670
            raise errors.NotBranchError(path=name, bzrdir=controldir)
671
671
        try:
672
672
            format_string = transport.get_bytes("format")
 
673
            # GZ 2017-06-09: Where should format strings get decoded...
 
674
            format_text = format_string.decode("ascii")
673
675
        except errors.NoSuchFile:
674
676
            raise errors.NotBranchError(path=transport.base, bzrdir=controldir)
675
 
        return klass._find_format(format_registry, 'branch', format_string)
 
677
        return klass._find_format(format_registry, 'branch', format_text)
676
678
 
677
679
    def _branch_class(self):
678
680
        """What class to instantiate on open calls."""
680
682
 
681
683
    def _get_initial_config(self, append_revisions_only=None):
682
684
        if append_revisions_only:
683
 
            return "append_revisions_only = True\n"
 
685
            return b"append_revisions_only = True\n"
684
686
        else:
685
687
            # Avoid writing anything if append_revisions_only is disabled,
686
688
            # as that is the default.
687
 
            return ""
 
689
            return b""
688
690
 
689
691
    def _initialize_helper(self, a_bzrdir, utf8_files, name=None,
690
692
                           repository=None):
856
858
    def initialize(self, a_bzrdir, name=None, repository=None,
857
859
                   append_revisions_only=None):
858
860
        """Create a branch of this format in a_bzrdir."""
859
 
        utf8_files = [('last-revision', '0 null:\n'),
 
861
        utf8_files = [('last-revision', b'0 null:\n'),
860
862
                      ('branch.conf',
861
863
                          self._get_initial_config(append_revisions_only)),
862
 
                      ('tags', ''),
 
864
                      ('tags', b''),
863
865
                      ]
864
866
        return self._initialize_helper(a_bzrdir, utf8_files, name, repository)
865
867