~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-19 12:08:42 UTC
  • mfrom: (6437.3.8 2.5)
  • mto: (6437.3.14 2.5)
  • mto: This revision was merged to the branch mainline in revision 6444.
  • Revision ID: jelmer@samba.org-20120119120842-xlq5ru2cqfcurnk9
MergeĀ lp:bzr/2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
829
829
 
830
830
    def destroy_branch(self, name=None):
831
831
        """See BzrDir.create_branch."""
832
 
        if name is not None:
 
832
        if name is None:
 
833
            name = self._get_selected_branch()
 
834
        if name != "":
833
835
            raise errors.NoColocatedBranchSupport(self)
834
836
        self.transport.delete_tree('branch')
835
837
 
887
889
 
888
890
    def get_branch_transport(self, branch_format, name=None):
889
891
        """See BzrDir.get_branch_transport()."""
890
 
        if name is not None:
 
892
        if name is None:
 
893
            name = self._get_selected_branch()
 
894
        if name != "":
891
895
            raise errors.NoColocatedBranchSupport(self)
892
896
        # XXX: this shouldn't implicitly create the directory if it's just
893
897
        # promising to get a transport -- mbp 20090727
1021
1025
        :param name: Optional branch name to use
1022
1026
        :return: Relative path to branch
1023
1027
        """
1024
 
        if name is None:
 
1028
        if name == "":
1025
1029
            return 'branch'
1026
1030
        return urlutils.join('branches', name.encode("utf-8"))
1027
1031
 
1056
1060
        if name is None:
1057
1061
            name = self._get_selected_branch()
1058
1062
        path = self._get_branch_path(name)
1059
 
        if name is not None:
 
1063
        if name != "":
1060
1064
            self.control_files.lock_write()
1061
1065
            try:
1062
1066
                branches = self._read_branch_list()
1073
1077
        """See ControlDir.get_branches."""
1074
1078
        ret = {}
1075
1079
        try:
1076
 
            ret[None] = self.open_branch()
 
1080
            ret[""] = self.open_branch(name="")
1077
1081
        except (errors.NotBranchError, errors.NoRepositoryPresent):
1078
1082
            pass
1079
1083
 
1080
1084
        for name in self._read_branch_list():
1081
 
            ret[name] = self.open_branch(name.decode('utf-8'))
 
1085
            ret[name] = self.open_branch(name=name.decode('utf-8'))
1082
1086
 
1083
1087
        return ret
1084
1088
 
1085
1089
    def get_branch_transport(self, branch_format, name=None):
1086
1090
        """See BzrDir.get_branch_transport()."""
 
1091
        if name is None:
 
1092
            name = self._get_selected_branch()
1087
1093
        path = self._get_branch_path(name)
1088
1094
        # XXX: this shouldn't implicitly create the directory if it's just
1089
1095
        # promising to get a transport -- mbp 20090727
1093
1099
            branch_format.get_format_string()
1094
1100
        except NotImplementedError:
1095
1101
            raise errors.IncompatibleFormat(branch_format, self._format)
1096
 
        if name is not None:
 
1102
        if name != "":
1097
1103
            try:
1098
1104
                self.transport.mkdir('branches', mode=self._get_mkdir_mode())
1099
1105
            except errors.FileExists: