~cjwatson/brz-svn/fix-http-probe

« back to all changes in this revision

Viewing changes to annotate.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-03 09:16:45 UTC
  • Revision ID: jelmer@jelmer.uk-20200203091645-q0f1yq77zkr1s3cz
More Python3 / formatting / breezy fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from __future__ import absolute_import
19
19
 
 
20
from io import BytesIO
 
21
 
20
22
import subvertpy
21
23
 
22
 
from cStringIO import (
23
 
    StringIO,
24
 
    )
25
24
from subvertpy.delta import (
26
25
    apply_txdelta_window,
27
26
    )
32
31
from breezy.annotate import (
33
32
    reannotate,
34
33
    )
35
 
from breezy.errors import (
36
 
    NoSuchId,
37
 
    )
38
34
 
39
 
from breezy.plugins.svn import (
 
35
from . import (
40
36
    changes,
41
37
    )
42
38
 
62
58
        self._text = ""
63
59
        path = urlutils.join(branch_path, relpath.encode("utf-8")).strip("/")
64
60
        try:
65
 
            self._repository.svn_transport.get_file_revs(path, -1, revnum,
66
 
                self._handler, include_merged_revisions=True)
 
61
            self._repository.svn_transport.get_file_revs(
 
62
                path, -1, revnum, self._handler, include_merged_revisions=True)
67
63
        except subvertpy.SubversionException as e:
68
64
            if e.args[1] == subvertpy.ERR_FS_NOT_FILE:
69
65
                return []
91
87
            # Related file in Subversion but not in Bazaar
92
88
            # We still apply the delta since we'll need the fulltext later
93
89
            fileid = None
94
 
        stream = StringIO()
 
90
        stream = BytesIO()
 
91
 
95
92
        def apply_window(window):
96
93
            if window is None:
97
94
                stream.seek(0)
98
95
                lines = stream.readlines()
99
 
                self._text = "".join(lines)
100
 
                self._annotated = self.check_file(lines, revid, [self._annotated])
 
96
                self._text = b"".join(lines)
 
97
                self._annotated = self.check_file(
 
98
                    lines, revid, [self._annotated])
101
99
                return
102
100
            stream.write(apply_txdelta_window(self._text, window))
103
101
        return apply_window
104
 
 
105