/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/branch.py

  • Committer: Andrew Bennetts
  • Date: 2008-01-04 03:12:11 UTC
  • mfrom: (3164 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3320.
  • Revision ID: andrew.bennetts@canonical.com-20080104031211-wy4uxo2j4elvip1j
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
757
757
        return format
758
758
 
759
759
    def create_checkout(self, to_location, revision_id=None,
760
 
                        lightweight=False):
 
760
                        lightweight=False, accelerator_tree=None):
761
761
        """Create a checkout of a branch.
762
762
        
763
763
        :param to_location: The url to produce the checkout at
764
764
        :param revision_id: The revision to check out
765
765
        :param lightweight: If True, produce a lightweight checkout, otherwise,
766
766
        produce a bound branch (heavyweight checkout)
 
767
        :param accelerator_tree: A tree which can be used for retrieving file
 
768
            contents more quickly than the revision tree, i.e. a workingtree.
 
769
            The revision tree will be used for cases where accelerator_tree's
 
770
            content is different.
767
771
        :return: The tree of the created checkout
768
772
        """
769
773
        t = transport.get_transport(to_location)
783
787
            checkout_branch.pull(self, stop_revision=revision_id)
784
788
            from_branch=None
785
789
        tree = checkout.create_workingtree(revision_id,
786
 
                                           from_branch=from_branch)
 
790
                                           from_branch=from_branch,
 
791
                                           accelerator_tree=accelerator_tree)
787
792
        basis_tree = tree.basis_tree()
788
793
        basis_tree.lock_read()
789
794
        try:
868
873
        """
869
874
        return None
870
875
 
 
876
    @classmethod
 
877
    def set_reference(self, a_bzrdir, to_branch):
 
878
        """Set the target reference of the branch in a_bzrdir.
 
879
 
 
880
        format probing must have been completed before calling
 
881
        this method - it is assumed that the format of the branch
 
882
        in a_bzrdir is correct.
 
883
 
 
884
        :param a_bzrdir: The bzrdir to set the branch reference for.
 
885
        :param to_branch: branch that the checkout is to reference
 
886
        """
 
887
        raise NotImplementedError(self.set_reference)
 
888
 
871
889
    def get_format_string(self):
872
890
        """Return the ASCII format string that identifies this format."""
873
891
        raise NotImplementedError(self.get_format_string)
1198
1216
        transport = a_bzrdir.get_branch_transport(None)
1199
1217
        return transport.get('location').read()
1200
1218
 
 
1219
    def set_reference(self, a_bzrdir, to_branch):
 
1220
        """See BranchFormat.set_reference()."""
 
1221
        transport = a_bzrdir.get_branch_transport(None)
 
1222
        location = transport.put_bytes('location', to_branch.base)
 
1223
 
1201
1224
    def initialize(self, a_bzrdir, target_branch=None):
1202
1225
        """Create a branch of this format in a_bzrdir."""
1203
1226
        if target_branch is None:
1776
1799
        # last_rev is not in the other_last_rev history, AND
1777
1800
        # other_last_rev is not in our history, and do it without pulling
1778
1801
        # history around
1779
 
        last_rev = _mod_revision.ensure_null(self.last_revision())
1780
 
        if last_rev != _mod_revision.NULL_REVISION:
1781
 
            other.lock_read()
1782
 
            try:
1783
 
                other_last_rev = other.last_revision()
1784
 
                if not _mod_revision.is_null(other_last_rev):
1785
 
                    # neither branch is new, we have to do some work to
1786
 
                    # ascertain diversion.
1787
 
                    remote_graph = other.repository.get_revision_graph(
1788
 
                        other_last_rev)
1789
 
                    local_graph = self.repository.get_revision_graph(last_rev)
1790
 
                    if (last_rev not in remote_graph and
1791
 
                        other_last_rev not in local_graph):
1792
 
                        raise errors.DivergedBranches(self, other)
1793
 
            finally:
1794
 
                other.unlock()
1795
1802
        self.set_bound_location(other.base)
1796
1803
 
1797
1804
    @needs_write_lock
1860
1867
        return None
1861
1868
 
1862
1869
    @classmethod
 
1870
    def set_reference(self, a_bzrdir, to_branch):
 
1871
        """Set the target reference of the branch in a_bzrdir.
 
1872
 
 
1873
        format probing must have been completed before calling
 
1874
        this method - it is assumed that the format of the branch
 
1875
        in a_bzrdir is correct.
 
1876
 
 
1877
        :param a_bzrdir: The bzrdir to set the branch reference for.
 
1878
        :param to_branch: branch that the checkout is to reference
 
1879
        """
 
1880
        raise NotImplementedError(self.set_reference)
 
1881
 
 
1882
    @classmethod
1863
1883
    def _initialize_control_files(cls, a_bzrdir, utf8_files, lock_filename,
1864
1884
            lock_class):
1865
1885
        branch_transport = a_bzrdir.get_branch_transport(cls)