/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Vincent Ladeuil
  • Date: 2007-11-01 21:02:36 UTC
  • mto: (2990.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2991.
  • Revision ID: v.ladeuil+lp@free.fr-20071101210236-iv2k87h4g2dmig3t
Fix second unwanted connection by providing the right branch to create_checkout.

* bzrlib/branch.py:
(Branch.create_checkout): Keep the lightweight branch to create
the checkout from.

* bzrlib/bzrdir.py:
(BzrDir.create_workingtree, BzrDir.open_workingtree,
BzrDirMeta1.create_workingtree): Add a from_branch parameter for
lightweight checkouts purposes.

* bzrlib/workingtree.py:
(WorkingTreeFormat2.initialize, WorkingTreeFormat3.initialize):
Use from_branch if provided or default to bzrdir branch.

* bzrlib/workingtree_4.py:
(WorkingTreeFormat4.initialize): Use from_branch if provided or
default to bzrdir branch.

* bzrlib/tests/test_workingtree.py:
(SampleTreeFormat.initialize): Update the signature.

* bzrlib/remote.py:
(RemoteBzrDir.create_workingtree): Update the signature.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2709
2709
        control_files.put_bytes('pending-merges', '')
2710
2710
        
2711
2711
 
2712
 
    def initialize(self, a_bzrdir, revision_id=None):
 
2712
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None):
2713
2713
        """See WorkingTreeFormat.initialize()."""
2714
2714
        if not isinstance(a_bzrdir.transport, LocalTransport):
2715
2715
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
2716
 
        branch = a_bzrdir.open_branch()
 
2716
        if from_branch is not None:
 
2717
            branch = from_branch
 
2718
        else:
 
2719
            branch = a_bzrdir.open_branch()
2717
2720
        if revision_id is None:
2718
2721
            revision_id = _mod_revision.ensure_null(branch.last_revision())
2719
2722
        branch.lock_write()
2798
2801
        return LockableFiles(transport, self._lock_file_name, 
2799
2802
                             self._lock_class)
2800
2803
 
2801
 
    def initialize(self, a_bzrdir, revision_id=None):
 
2804
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None):
2802
2805
        """See WorkingTreeFormat.initialize().
2803
2806
        
2804
2807
        revision_id allows creating a working tree at a different
2811
2814
        control_files.create_lock()
2812
2815
        control_files.lock_write()
2813
2816
        control_files.put_utf8('format', self.get_format_string())
2814
 
        branch = a_bzrdir.open_branch()
 
2817
        if from_branch is not None:
 
2818
            branch = from_branch
 
2819
        else:
 
2820
            branch = a_bzrdir.open_branch()
2815
2821
        if revision_id is None:
2816
2822
            revision_id = _mod_revision.ensure_null(branch.last_revision())
2817
2823
        # WorkingTree3 can handle an inventory which has a unique root id.