80
# Note: jam 20130519 This function was added in 2.4 as part of
81
# 6068 Patch Queue Manager 2012-03-27 [merge]
82
# (jelmer) Add support for feature flags. (Jelmer Vernooij)
84
# However, it doesn't seem to be needed or called in 2.5, which has
85
# different support for how it handles feature flags in format strings.
86
# It might be prudent to remove it to avoid confusion.
87
def extract_format_string(text):
88
"""Read a format string from a file.
90
The first line is returned. The other lines can contain
91
optional features. An exception is raised when a
92
required feature is present.
94
lines = text.splitlines(True)
96
firstline = lines.pop(0)
98
raise errors.UnknownFormatError(format=text, kind='')
99
for lineno, line in enumerate(lines):
101
(necessity, feature) = line.split(" ", 1)
103
raise errors.ParseFormatError(lineno=lineno+2,
104
line=line, text=text)
106
if necessity == "optional":
107
mutter("Ignoring optional feature %s", feature)
109
raise errors.MissingFeature(feature)
80
113
class BzrDir(controldir.ControlDir):
81
114
"""A .bzr control diretory.