22
22
from bzrlib.smart.request import SmartServerRequest, SmartServerResponse
25
class SmartServerRequestRevisionHistory(SmartServerRequest):
25
class SmartServerBranchRequest(SmartServerRequest):
26
"""Base class for handling common branch request logic."""
27
28
def do(self, path):
28
"""Get the revision history for the branch at path.
29
"""Execute a request for a branch at path.
30
31
If the branch is a branch reference, NotBranchError is raised.
31
The revision list is returned as the body content,
32
with each revision utf8 encoded and \x00 joined.
34
33
transport = self._backing_transport.clone(path)
35
34
bzrdir = BzrDir.open_from_transport(transport)
36
35
if bzrdir.get_branch_reference() is not None:
37
36
raise errors.NotBranchError(transport.base)
38
37
branch = bzrdir.open_branch()
38
return self.do_with_branch(branch)
41
class SmartServerRequestRevisionHistory(SmartServerBranchRequest):
43
def do_with_branch(self, branch):
44
"""Get the revision history for the branch.
46
The revision list is returned as the body content,
47
with each revision utf8 encoded and \x00 joined.
39
49
return SmartServerResponse(('ok', ),
40
50
('\x00'.join(branch.revision_history())).encode('utf8'))