~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/branch.py

  • Committer: Patch Queue Manager
  • Date: 2011-10-06 08:34:03 UTC
  • mfrom: (6191.2.1 843900-url-nameerror)
  • Revision ID: pqm@pqm.ubuntu.com-20111006083403-jnsw0exlirg01aed
(mbp) error message without traceback on invalid ubuntu/debian url (bug
 843900) (Martin Pool)

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,
24
23
    )
25
 
from bzrlib.controldir import ControlDir
 
24
from bzrlib.bzrdir import BzrDir
26
25
from bzrlib.smart.request import (
27
26
    FailedSmartServerResponse,
28
27
    SmartServerRequest,
46
45
        :return: A SmartServerResponse from self.do_with_branch().
47
46
        """
48
47
        transport = self.transport_from_client_path(path)
49
 
        controldir = ControlDir.open_from_transport(transport)
50
 
        if controldir.get_branch_reference() is not None:
 
48
        bzrdir = BzrDir.open_from_transport(transport)
 
49
        if bzrdir.get_branch_reference() is not None:
51
50
            raise errors.NotBranchError(transport.base)
52
 
        branch = controldir.open_branch(ignore_fallbacks=True)
 
51
        branch = bzrdir.open_branch(ignore_fallbacks=True)
53
52
        return self.do_with_branch(branch, *args)
54
53
 
55
54
 
172
171
        The revision list is returned as the body content,
173
172
        with each revision utf8 encoded and \x00 joined.
174
173
        """
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()
183
174
        return SuccessfulSmartServerResponse(
184
 
            ('ok', ), ('\x00'.join(reversed(history))))
 
175
            ('ok', ), ('\x00'.join(branch.revision_history())))
185
176
 
186
177
 
187
178
class SmartServerBranchRequestLastRevisionInfo(SmartServerBranchRequest):