~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/repository.py

Fix some test failures caused by the switch from unicode to UTF-8-encoded strs for revision IDs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        :return: A smart server response where the body contains an utf8
52
52
            encoded flattened list of the revision graph.
53
53
        """
54
 
        decoded_revision_id = revision_id.decode('utf8')
55
 
        if not decoded_revision_id:
56
 
            decoded_revision_id = None
 
54
        if not revision_id:
 
55
            revision_id = None
57
56
 
58
57
        lines = []
59
58
        try:
60
 
            revision_graph = repository.get_revision_graph(decoded_revision_id)
 
59
            revision_graph = repository.get_revision_graph(revision_id)
61
60
        except errors.NoSuchRevision:
62
61
            # Note that we return an empty body, rather than omitting the body.
63
62
            # This way the client knows that it can always expect to find a body
67
66
        for revision, parents in revision_graph.items():
68
67
            lines.append(' '.join([revision,] + parents))
69
68
 
70
 
        return SmartServerResponse(('ok', ), '\n'.join(lines).encode('utf8'))
 
69
        return SmartServerResponse(('ok', ), '\n'.join(lines))
71
70
 
72
71
 
73
72
class SmartServerRequestHasRevision(SmartServerRepositoryRequest):
80
79
        :return: A smart server response of ('ok', ) if the revision is
81
80
            present.
82
81
        """
83
 
        decoded_revision_id = revision_id.decode('utf8')
84
 
        if repository.has_revision(decoded_revision_id):
 
82
        if repository.has_revision(revision_id):
85
83
            return SmartServerResponse(('ok', ))
86
84
        else:
87
85
            return SmartServerResponse(('no', ))
108
106
        if revid == '':
109
107
            decoded_revision_id = None
110
108
        else:
111
 
            decoded_revision_id = revid.decode('utf8')
 
109
            decoded_revision_id = revid
112
110
        if committers == 'yes':
113
111
            decoded_committers = True
114
112
        else: