128
128
return SuccessfulSmartServerResponse(('ok',))
131
class SmartServerBranchRequestSetLastRevisionDescendant(SmartServerLockedBranchRequest):
131
class SmartServerBranchRequestSetLastRevisionEx(SmartServerLockedBranchRequest):
134
133
def do_with_locked_branch(self, branch, new_last_revision_id,
135
134
allow_divergence, do_not_overwrite_descendant):
135
"""Set the last revision of the branch.
139
:param new_last_revision_id: the revision ID to set as the last
140
revision of the branch.
141
:param allow_divergence: A flag. If non-zero, change the revision ID
142
even if the new_last_revision_id's ancestry has diverged from the
143
current last revision. If zero, a 'Diverged' error will be
144
returned if new_last_revision_id is not a descendant of the current
146
:param do_not_overwrite_descendant: A flag. If non-zero and
147
new_last_revision_id is not a descendant of the current last
148
revision, then the last revision will not be changed.
150
:returns: on success, a tuple of ('ok', revno, revision_id), where
151
revno and revision_id are the new values of the current last
152
revision info. The revision_id might be different to the
153
new_last_revision_id if do_not_overwrite_descendant was set.
137
156
last_revno, last_rev = branch.last_revision_info()
138
157
graph = branch.repository.get_graph()