~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
27
27
 
28
28
import bzrlib
29
29
import bzrlib.errors as errors
30
 
from bzrlib.lockable_files import LockableFiles
 
30
from bzrlib.lockable_files import LockableFiles, TransportLock
31
31
from bzrlib.osutils import safe_unicode
32
32
from bzrlib.osutils import (
33
33
                            abspath,
525
525
            source_branch.sprout(result, revision_id=revision_id)
526
526
        else:
527
527
            result.create_branch()
528
 
        try:
529
 
            self.open_workingtree().clone(result,
530
 
                                          revision_id=revision_id, 
531
 
                                          basis=basis_tree)
532
 
        except (errors.NoWorkingTree, errors.NotLocalUrl):
533
 
            result.create_workingtree()
 
528
        result.create_workingtree()
534
529
        return result
535
530
 
536
531
 
541
536
        """See BzrDir.__init__."""
542
537
        super(BzrDirPreSplitOut, self).__init__(_transport, _format)
543
538
        self._control_files = LockableFiles(self.get_branch_transport(None),
544
 
                                            'branch-lock')
 
539
                                            'branch-lock',
 
540
                                            TransportLock)
545
541
 
546
542
    def clone(self, url, revision_id=None, basis=None, force_new_repo=False):
547
543
        """See BzrDir.clone()."""
641
637
            self.open_branch().sprout(result, revision_id=revision_id)
642
638
        except errors.NotBranchError:
643
639
            pass
644
 
        try:
645
 
            self.open_workingtree().clone(result, basis=basis_tree)
646
 
        except (errors.NotBranchError, errors.NotLocalUrl):
647
 
            # we always want a working tree
648
 
            WorkingTreeFormat2().initialize(result)
 
640
        # we always want a working tree
 
641
        WorkingTreeFormat2().initialize(result)
649
642
        return result
650
643
 
651
644
 
872
865
        # Since we don't have a .bzr directory, inherit the
873
866
        # mode from the root directory
874
867
        t = get_transport(url)
875
 
        temp_control = LockableFiles(t, '')
 
868
        temp_control = LockableFiles(t, '', TransportLock)
876
869
        temp_control._transport.mkdir('.bzr',
877
870
                                      # FIXME: RBC 20060121 dont peek under
878
871
                                      # the covers
888
881
                      ('branch-format', self.get_format_string()),
889
882
                      ]
890
883
        # NB: no need to escape relative paths that are url safe.
891
 
        control.put(lock_file, StringIO(), mode=file_mode)
892
 
        control_files = LockableFiles(control, lock_file)
 
884
        control_files = LockableFiles(control, lock_file, TransportLock)
 
885
        control_files.create_lock()
893
886
        control_files.lock_write()
894
887
        try:
895
888
            for file, content in utf8_files: