~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

Add a Branch.set_last_revision smart method, and make RemoteBranch.set_revision_history use it.  Also some test tweaks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
422
422
        return result
423
423
 
424
424
    def set_revision_history(self, rev_history):
425
 
        self._ensure_real()
426
 
        return self._real_branch.set_revision_history(rev_history)
 
425
        # Send just the tip revision of the history; the server will generate
 
426
        # the full history from that.  If the revision doesn't exist in this
 
427
        # branch, NoSuchRevision will be raised.
 
428
        path = self.bzrdir._path_for_remote_call(self._client)
 
429
        if rev_history == []:
 
430
            rev_id = ''
 
431
        else:
 
432
            rev_id = rev_history[-1]
 
433
        response = self._client.call('Branch.set_last_revision', path, rev_id)
 
434
        if response[0] == 'NoSuchRevision':
 
435
            raise NoSuchRevision(self, rev_id)
 
436
        else:
 
437
            assert response == ('ok',), (
 
438
                'unexpected response code %r' % (response,))
427
439
 
428
440
    def get_parent(self):
429
441
        self._ensure_real()