~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: John Arbash Meinel
  • Date: 2013-05-19 13:38:07 UTC
  • mfrom: (6015.57.4 2.4)
  • mto: (6437.63.10 2.5)
  • mto: This revision was merged to the branch mainline in revision 6575.
  • Revision ID: john@arbash-meinel.com-20130519133807-69kfoe85gw2va4y2
Try merging 2.4 into 2.5 and resolving the conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
    )
78
78
 
79
79
 
 
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)
 
83
#
 
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.
 
89
 
 
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.
 
93
    """
 
94
    lines = text.splitlines(True)
 
95
    try:
 
96
        firstline = lines.pop(0)
 
97
    except IndexError:
 
98
        raise errors.UnknownFormatError(format=text, kind='')
 
99
    for lineno, line in enumerate(lines):
 
100
        try:
 
101
            (necessity, feature) = line.split(" ", 1)
 
102
        except ValueError:
 
103
            raise errors.ParseFormatError(lineno=lineno+2,
 
104
                line=line, text=text)
 
105
        else:
 
106
            if necessity == "optional":
 
107
                mutter("Ignoring optional feature %s", feature)
 
108
            else:
 
109
                raise errors.MissingFeature(feature)
 
110
    return firstline
 
111
 
 
112
 
80
113
class BzrDir(controldir.ControlDir):
81
114
    """A .bzr control diretory.
82
115