~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/branch.py

  • Committer: Shannon Weyrick
  • Date: 2011-11-04 13:40:04 UTC
  • mfrom: (6238 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6256.
  • Revision ID: weyrick@mozek.us-20111104134004-033t2wqhc3ydzm0a
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from bzrlib import (
21
21
    bencode,
22
22
    errors,
 
23
    revision as _mod_revision,
23
24
    )
24
 
from bzrlib.bzrdir import BzrDir
 
25
from bzrlib.controldir import ControlDir
25
26
from bzrlib.smart.request import (
26
27
    FailedSmartServerResponse,
27
28
    SmartServerRequest,
45
46
        :return: A SmartServerResponse from self.do_with_branch().
46
47
        """
47
48
        transport = self.transport_from_client_path(path)
48
 
        bzrdir = BzrDir.open_from_transport(transport)
49
 
        if bzrdir.get_branch_reference() is not None:
 
49
        controldir = ControlDir.open_from_transport(transport)
 
50
        if controldir.get_branch_reference() is not None:
50
51
            raise errors.NotBranchError(transport.base)
51
 
        branch = bzrdir.open_branch(ignore_fallbacks=True)
 
52
        branch = controldir.open_branch(ignore_fallbacks=True)
52
53
        return self.do_with_branch(branch, *args)
53
54
 
54
55
 
171
172
        The revision list is returned as the body content,
172
173
        with each revision utf8 encoded and \x00 joined.
173
174
        """
 
175
        branch.lock_read()
 
176
        try:
 
177
            graph = branch.repository.get_graph()
 
178
            stop_revisions = (None, _mod_revision.NULL_REVISION)
 
179
            history = list(graph.iter_lefthand_ancestry(
 
180
                branch.last_revision(), stop_revisions))
 
181
        finally:
 
182
            branch.unlock()
174
183
        return SuccessfulSmartServerResponse(
175
 
            ('ok', ), ('\x00'.join(branch.revision_history())))
 
184
            ('ok', ), ('\x00'.join(reversed(history))))
176
185
 
177
186
 
178
187
class SmartServerBranchRequestLastRevisionInfo(SmartServerBranchRequest):