~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/branch.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:
81
81
        The revision list is returned as the body content,
82
82
        with each revision utf8 encoded and \x00 joined.
83
83
        """
84
 
        return SmartServerResponse(('ok', ),
85
 
            ('\x00'.join(branch.revision_history())).encode('utf8'))
 
84
        return SmartServerResponse(
 
85
            ('ok', ), ('\x00'.join(branch.revision_history())))
86
86
 
87
87
 
88
88
class SmartServerBranchRequestLastRevisionInfo(SmartServerBranchRequest):
95
95
        revno, last_revision = branch.last_revision_info()
96
96
        if last_revision == NULL_REVISION:
97
97
            last_revision = ''
98
 
        return SmartServerResponse(
99
 
            ('ok', str(revno), last_revision.encode('utf8')))
 
98
        return SmartServerResponse(('ok', str(revno), last_revision))
100
99
 
101
100
 
102
101
class SmartServerBranchRequestSetLastRevision(SmartServerLockedBranchRequest):
103
102
    
104
103
    def do_with_locked_branch(self, branch, new_last_revision_id):
105
 
        unicode_new_last_revision_id = new_last_revision_id.decode('utf-8')  # XXX test
106
104
        if new_last_revision_id == '':
107
105
            branch.set_revision_history([])
108
106
        else:
109
 
            if not branch.repository.has_revision(unicode_new_last_revision_id):
 
107
            if not branch.repository.has_revision(new_last_revision_id):
110
108
                return SmartServerResponse(
111
109
                    ('NoSuchRevision', new_last_revision_id))
112
 
            branch.generate_revision_history(unicode_new_last_revision_id)
 
110
            branch.generate_revision_history(new_last_revision_id)
113
111
        return SmartServerResponse(('ok',))
114
112
 
115
113