/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/_rio_py.py

Merge test-run support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    )
26
26
 
27
27
_tag_re = re.compile(r'^[-a-zA-Z0-9_]+$')
28
 
 
29
 
 
30
28
def _valid_tag(tag):
31
29
    if not isinstance(tag, str):
32
30
        raise TypeError(tag)
57
55
        if line == u'\n':
58
56
            break       # end of stanza
59
57
        real_l = line
60
 
        if line[0] == u'\t':  # continues previous value
 
58
        if line[0] == u'\t': # continues previous value
61
59
            if tag is None:
62
60
                raise ValueError('invalid continuation line %r' % real_l)
63
61
            accum_value.append(u'\n' + line[1:-1])
64
 
        else:  # new tag:value line
 
62
        else: # new tag:value line
65
63
            if tag is not None:
66
64
                stanza.add(tag, u''.join(accum_value))
67
65
            try:
72
70
            tag = str(line[:colon_index])
73
71
            if not _valid_tag(tag):
74
72
                raise ValueError("invalid rio tag %r" % (tag,))
75
 
            accum_value = [line[colon_index + 2:-1]]
 
73
            accum_value = [line[colon_index+2:-1]]
76
74
 
77
 
    if tag is not None:  # add last tag-value
 
75
    if tag is not None: # add last tag-value
78
76
        stanza.add(tag, u''.join(accum_value))
79
77
        return stanza
80
78
    else:     # didn't see any content