~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Alexander Belchenko
  • Date: 2007-11-19 22:54:30 UTC
  • mfrom: (3006 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3008.
  • Revision ID: bialix@ukr.net-20071119225430-x0ewosrsagis0yno
merge bzr.dev

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:
1146
1148
    def initialize(self, a_bzrdir):
1147
1149
        """Create a branch of this format in a_bzrdir."""
1148
1150
        utf8_files = [('last-revision', '0 null:\n'),
1149
 
                      ('branch-name', ''),
1150
1151
                      ('branch.conf', ''),
1151
1152
                      ('tags', ''),
1152
1153
                      ]
1191
1192
    def get_format_description(self):
1192
1193
        """See BranchFormat.get_format_description()."""
1193
1194
        return "Checkout reference format 1"
1194
 
        
 
1195
 
1195
1196
    def get_reference(self, a_bzrdir):
1196
1197
        """See BranchFormat.get_reference()."""
1197
1198
        transport = a_bzrdir.get_branch_transport(None)
1208
1209
        branch_transport.put_bytes('location',
1209
1210
            target_branch.bzrdir.root_transport.base)
1210
1211
        branch_transport.put_bytes('format', self.get_format_string())
1211
 
        return self.open(a_bzrdir, _found=True)
 
1212
        return self.open(
 
1213
            a_bzrdir, _found=True,
 
1214
            possible_transports=[target_branch.bzrdir.root_transport])
1212
1215
 
1213
1216
    def __init__(self):
1214
1217
        super(BranchReferenceFormat, self).__init__()
1224
1227
            # emit some sort of warning/error to the caller ?!
1225
1228
        return clone
1226
1229
 
1227
 
    def open(self, a_bzrdir, _found=False, location=None):
 
1230
    def open(self, a_bzrdir, _found=False, location=None,
 
1231
             possible_transports=None):
1228
1232
        """Return the branch that the branch reference in a_bzrdir points at.
1229
1233
 
1230
1234
        _found is a private parameter, do not use it. It is used to indicate
1235
1239
            assert format.__class__ == self.__class__
1236
1240
        if location is None:
1237
1241
            location = self.get_reference(a_bzrdir)
1238
 
        real_bzrdir = bzrdir.BzrDir.open(location)
 
1242
        real_bzrdir = bzrdir.BzrDir.open(
 
1243
            location, possible_transports=possible_transports)
1239
1244
        result = real_bzrdir.open_branch()
1240
1245
        # this changes the behaviour of result.clone to create a new reference
1241
1246
        # rather than a copy of the content of the branch.
1308
1313
    def get_root_id(self):
1309
1314
        """See Branch.get_root_id."""
1310
1315
        tree = self.repository.revision_tree(self.last_revision())
1311
 
        return tree.inventory.root.file_id
 
1316
        return tree.get_root_id()
1312
1317
 
1313
1318
    def is_locked(self):
1314
1319
        return self.control_files.is_locked()