~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/branch.py

  • Committer: Andrew Bennetts
  • Date: 2008-05-22 07:49:06 UTC
  • mto: (3452.2.9 inter-remote-pack)
  • mto: This revision was merged to the branch mainline in revision 3511.
  • Revision ID: andrew.bennetts@canonical.com-20080522074906-dcdk44d7y8cdn4no
Greatly simplify RemoteBranch.update_revisions.  Still needs more tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        return SuccessfulSmartServerResponse(('ok',))
129
129
 
130
130
 
 
131
class SmartServerBranchRequestSetLastRevisionDescendant(SmartServerLockedBranchRequest):
 
132
    """New in 1.6."""
 
133
    
 
134
    def do_with_locked_branch(self, branch, new_last_revision_id):
 
135
        try:
 
136
            last_rev = branch.last_revision()
 
137
            branch.generate_revision_history(new_last_revision_id, last_rev)
 
138
        except errors.DivergedBranches:
 
139
            return FailedSmartServerResponse(('NotDescendant',))
 
140
        except errors.NoSuchRevision:
 
141
            return FailedSmartServerResponse(
 
142
                ('NoSuchRevision', new_last_revision_id))
 
143
        return SuccessfulSmartServerResponse(('ok', branch.revno()))
 
144
 
 
145
 
131
146
class SmartServerBranchRequestSetLastRevisionInfo(
132
147
    SmartServerLockedBranchRequest):
133
148
    """Branch.set_last_revision_info.  Sets the revno and the revision ID of