# # # patch "tracvc/mtn/automate.py" # from [da1af6f02cfe87924a0439d49ae48598940fad11] # to [b9dea1f617b549efdb8bb2ceeb414fb5c31668d0] # # patch "tracvc/mtn/backend.py" # from [38dc2821c10d201350acbdd7bb320db47f144d29] # to [a33b8861f9b69e4070166e3351a3962d5aa99d20] # # patch "tracvc/mtn/basic_io.py" # from [d4749eacd44c037360f74b8f1405eef48a357993] # to [51f9f6dc5f0a1893ac8c53d8b2b9822a2f56c968] # ============================================================ --- tracvc/mtn/automate.py da1af6f02cfe87924a0439d49ae48598940fad11 +++ tracvc/mtn/automate.py b9dea1f617b549efdb8bb2ceeb414fb5c31668d0 @@ -209,7 +209,7 @@ class MTN(object): return manifest # stanzas have variable length, trigger on next 'path' or eof - path, kind, content, attrs = (None,) *4 + path, kind, content, attrs = None, None, None, {} for key, values in basic_io.items(result): if key == 'dir' or key == 'file': if path: ============================================================ --- tracvc/mtn/backend.py 38dc2821c10d201350acbdd7bb320db47f144d29 +++ tracvc/mtn/backend.py a33b8861f9b69e4070166e3351a3962d5aa99d20 @@ -378,7 +378,11 @@ class MonotoneNode(Node): class MonotoneNode(Node): - + """ + Represents a directory or file in the repository at a given + revision. + """ + def __init__(self, mtn, rev, path, manifest = None): self.mtn = mtn self.manifest = manifest or self.mtn.manifest(rev) ============================================================ --- tracvc/mtn/basic_io.py d4749eacd44c037360f74b8f1405eef48a357993 +++ tracvc/mtn/basic_io.py 51f9f6dc5f0a1893ac8c53d8b2b9822a2f56c968 @@ -23,6 +23,7 @@ USA }}} """ + import re TOKEN = re.compile(r''' @@ -33,20 +34,28 @@ def items(raw): ''', re.VERBOSE) def items(raw): + ''' + Parses Monotone basic_io into (key, value) pairs, thereby ignoring + all whitespace. + + "value" is a list of all values found for "key". Text values are + dequoted properly, i.e. all occurences of \" and \\ are replaced + with " and \, respectively. + ''' # we yield when we find a new key or hit end of input - key = None + key, values = None, [] - for m in TOKEN.finditer(raw): - if m.lastgroup == 'key': + for match in TOKEN.finditer(raw): + if match.lastgroup == 'key': if key: yield key, values - key = m.group('key') + key = match.group('key') values = [] - elif m.lastgroup == 'id': - values.append(m.group('id')) - elif m.lastgroup == 'str': - value = m.group('str') + elif match.lastgroup == 'id': + values.append(match.group('id')) + elif match.lastgroup == 'str': + value = match.group('str') # dequote: replace \" with " value = re.sub(r'\\"', '"', value) # dequote: replace \\ with \