~jelmer/bzr-loom/lp-pqm

« back to all changes in this revision

Viewing changes to branch.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-01 14:32:03 UTC
  • mfrom: (34.20.55 trunk)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: jelmer@samba.org-20120201143203-xlbhfpkesj5uhi4u
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
780
780
    def initialize(self, a_bzrdir, name=None, repository=None,
781
781
                   append_revisions_only=None):
782
782
        """Create a branch of this format in a_bzrdir."""
783
 
        if name is not None:
784
 
            raise errors.NoColocatedBranchSupport(self)
785
783
        if repository is None and append_revisions_only is None:
786
 
            super(LoomFormatMixin, self).initialize(a_bzrdir, name=None)
 
784
            super(LoomFormatMixin, self).initialize(a_bzrdir, name=name)
787
785
        elif append_revisions_only is None:
788
786
            # The 'repository' optional keyword arg is new in bzr 2.3, so don't
789
787
            # pass it unless it was passed in.
790
 
            super(LoomFormatMixin, self).initialize(a_bzrdir, name=None,
 
788
            super(LoomFormatMixin, self).initialize(a_bzrdir, name=name,
791
789
                    repository=repository)
792
790
        else:
793
791
            # The 'append_revisions_only' optional keyword arg is new in bzr 
794
792
            # 2.4, so don't  pass it unless it was passed in.
795
 
            super(LoomFormatMixin, self).initialize(a_bzrdir, name=None,
 
793
            super(LoomFormatMixin, self).initialize(a_bzrdir, name=name,
796
794
                    repository=repository,
797
795
                    append_revisions_only=append_revisions_only)
798
796
 
808
806
            branch_transport, 'lock', bzrlib.lockdir.LockDir)
809
807
        control_files.lock_write()
810
808
        try:
811
 
            for name, stream in files:
812
 
                branch_transport.put_file(name, stream)
 
809
            for filename, stream in files:
 
810
                branch_transport.put_file(filename, stream)
813
811
        finally:
814
812
            control_files.unlock()
815
 
        return self.open(a_bzrdir, _found=True, )
 
813
        return self.open(a_bzrdir, _found=True, name=name)
816
814
 
817
815
    def open(self, a_bzrdir, name=None, _found=False, ignore_fallbacks=False,
818
816
            found_repository=None, possible_transports=None):
822
820
               if format probing has already be done.
823
821
 
824
822
        :param name: The 'colocated branches' name for the branch to open.
825
 
            in future, Loom may use that to return a Thread, but for now
826
 
            it is unused.
827
823
        """
 
824
        if name is None:
 
825
            name = a_bzrdir._get_selected_branch()
828
826
        if not _found:
829
 
            format = bzrlib.branch.BranchFormat.find_format(a_bzrdir)
 
827
            format = bzrlib.branch.BranchFormat.find_format(a_bzrdir, name=name)
830
828
            assert format.__class__ == self.__class__
831
 
        if name is not None:
832
 
            raise errors.NoColocatedBranchSupport(self)
833
 
        transport = a_bzrdir.get_branch_transport(None)
 
829
        transport = a_bzrdir.get_branch_transport(None, name=name)
834
830
        control_files = bzrlib.lockable_files.LockableFiles(
835
831
            transport, 'lock', bzrlib.lockdir.LockDir)
836
832
        if found_repository is None:
839
835
                          _control_files=control_files,
840
836
                          a_bzrdir=a_bzrdir,
841
837
                          _repository=found_repository,
842
 
                          ignore_fallbacks=ignore_fallbacks)
 
838
                          ignore_fallbacks=ignore_fallbacks,
 
839
                          name=name)
843
840
 
844
841
    def take_over(self, branch):
845
842
        """Take an existing bzrlib branch over into Loom format.
877
874
 
878
875
    _parent_classs = bzrlib.branch.BzrBranchFormat5
879
876
 
880
 
    def get_format_string(self):
 
877
    @classmethod
 
878
    def get_format_string(cls):
881
879
        """See BranchFormat.get_format_string()."""
882
880
        return "Bazaar-NG Loom branch format 1\n"
883
881
 
906
904
 
907
905
    _parent_classs = bzrlib.branch.BzrBranchFormat6
908
906
 
909
 
    def get_format_string(self):
 
907
    @classmethod
 
908
    def get_format_string(cls):
910
909
        """See BranchFormat.get_format_string()."""
911
910
        return "Bazaar-NG Loom branch format 6\n"
912
911
 
935
934
 
936
935
    _parent_classs = bzrlib.branch.BzrBranchFormat7
937
936
 
938
 
    def get_format_string(self):
 
937
    @classmethod
 
938
    def get_format_string(cls):
939
939
        """See BranchFormat.get_format_string()."""
940
940
        return "Bazaar-NG Loom branch format 7\n"
941
941