~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-22 14:25:34 UTC
  • mto: This revision was merged to the branch mainline in revision 6404.
  • Revision ID: jelmer@samba.org-20111222142534-7kkkubpdqgywysq3
Drop feature bit, don't allow spaces.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1135
1135
 
1136
1136
        :param name: Name of the feature
1137
1137
        """
 
1138
        if " " in name:
 
1139
            raise ValueError("spaces are not allowed in feature names")
1138
1140
        if name in cls._present_features:
1139
1141
            raise errors.FeatureAlreadyRegistered(name)
1140
1142
        cls._present_features.add(name)
1172
1174
        lines = text[len(format_string):].splitlines()
1173
1175
        ret = cls()
1174
1176
        for lineno, line in enumerate(lines):
1175
 
            (necessity, command, feature) = line.split(" ", 2)
1176
 
            if command == "feature":
1177
 
                ret.features[feature] = necessity
1178
 
            elif necessity == "optional":
1179
 
                mutter("Invalid optional command %r on line %d" %
1180
 
                    (command, lineno))
1181
 
            else:
1182
 
                raise ValueError("Invalid command %r on line %d" %
1183
 
                    (command, lineno))
 
1177
            (necessity, feature) = line.split(" ", 1)
 
1178
            ret.features[feature] = necessity
1184
1179
        return ret
1185
1180
 
1186
1181
    def as_string(self):
1187
1182
        """Return the string representation of this format.
1188
1183
        """
1189
1184
        lines = [self.get_format_string()]
1190
 
        lines.extend([("%s feature %s\n" % (item[1], item[0])) for item in
 
1185
        lines.extend([("%s %s\n" % (item[1], item[0])) for item in
1191
1186
            self.features.iteritems()])
1192
1187
        return "".join(lines)
1193
1188