~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2007-11-14 15:03:18 UTC
  • mfrom: (2991 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2992.
  • Revision ID: john@arbash-meinel.com-20071114150318-j0yvbz7et36s005e
merge bzr.dev 2991

Show diffs side-by-side

added added

removed removed

Lines of Context:
771
771
        if lightweight:
772
772
            format = self._get_checkout_format()
773
773
            checkout = format.initialize_on_transport(t)
774
 
            BranchReferenceFormat().initialize(checkout, self)
 
774
            from_branch = BranchReferenceFormat().initialize(checkout, self)
775
775
        else:
776
776
            format = self._get_checkout_format()
777
777
            checkout_branch = bzrdir.BzrDir.create_branch_convenience(
781
781
            # pull up to the specified revision_id to set the initial 
782
782
            # branch tip correctly, and seed it with history.
783
783
            checkout_branch.pull(self, stop_revision=revision_id)
784
 
        tree = checkout.create_workingtree(revision_id)
 
784
            from_branch=None
 
785
        tree = checkout.create_workingtree(revision_id,
 
786
                                           from_branch=from_branch)
785
787
        basis_tree = tree.basis_tree()
786
788
        basis_tree.lock_read()
787
789
        try:
1191
1193
    def get_format_description(self):
1192
1194
        """See BranchFormat.get_format_description()."""
1193
1195
        return "Checkout reference format 1"
1194
 
        
 
1196
 
1195
1197
    def get_reference(self, a_bzrdir):
1196
1198
        """See BranchFormat.get_reference()."""
1197
1199
        transport = a_bzrdir.get_branch_transport(None)
1208
1210
        branch_transport.put_bytes('location',
1209
1211
            target_branch.bzrdir.root_transport.base)
1210
1212
        branch_transport.put_bytes('format', self.get_format_string())
1211
 
        return self.open(a_bzrdir, _found=True)
 
1213
        return self.open(
 
1214
            a_bzrdir, _found=True,
 
1215
            possible_transports=[target_branch.bzrdir.root_transport])
1212
1216
 
1213
1217
    def __init__(self):
1214
1218
        super(BranchReferenceFormat, self).__init__()
1224
1228
            # emit some sort of warning/error to the caller ?!
1225
1229
        return clone
1226
1230
 
1227
 
    def open(self, a_bzrdir, _found=False, location=None):
 
1231
    def open(self, a_bzrdir, _found=False, location=None,
 
1232
             possible_transports=None):
1228
1233
        """Return the branch that the branch reference in a_bzrdir points at.
1229
1234
 
1230
1235
        _found is a private parameter, do not use it. It is used to indicate
1235
1240
            assert format.__class__ == self.__class__
1236
1241
        if location is None:
1237
1242
            location = self.get_reference(a_bzrdir)
1238
 
        real_bzrdir = bzrdir.BzrDir.open(location)
 
1243
        real_bzrdir = bzrdir.BzrDir.open(
 
1244
            location, possible_transports=possible_transports)
1239
1245
        result = real_bzrdir.open_branch()
1240
1246
        # this changes the behaviour of result.clone to create a new reference
1241
1247
        # rather than a copy of the content of the branch.
1308
1314
    def get_root_id(self):
1309
1315
        """See Branch.get_root_id."""
1310
1316
        tree = self.repository.revision_tree(self.last_revision())
1311
 
        return tree.inventory.root.file_id
 
1317
        return tree.get_root_id()
1312
1318
 
1313
1319
    def is_locked(self):
1314
1320
        return self.control_files.is_locked()