~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to weavefile.py

  • Committer: Martin Pool
  • Date: 2005-06-30 07:58:00 UTC
  • mto: This revision was merged to the branch mainline in revision 852.
  • Revision ID: mbp@sourcefrog.net-20050630075800-9af4341e177e121a
Remove VerInfo class; just store sets directly in the list of  
versions.

Add tests for serialize/deserialize.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    """Write weave to file f."""
53
53
    print >>f, FORMAT_1,
54
54
 
55
 
    for version, verinfo in enumerate(weave._v):
 
55
    for version, included in enumerate(weave._v):
56
56
        print >>f, 'v', version
57
 
        if verinfo.included:
58
 
            included = list(verinfo.included)
 
57
        if included:
 
58
            included = list(included)
59
59
            included.sort()
60
60
            assert included[0] >= 0
61
61
            assert included[-1] < version
92
92
 
93
93
 
94
94
def read_weave_v1(f):
95
 
    from weave import Weave, VerInfo, WeaveFormatError
 
95
    from weave import Weave, WeaveFormatError
96
96
    w = Weave()
97
97
 
98
98
    wfe = WeaveFormatError
115
115
                raise WeaveFormatError('unexpected line %r' % l)
116
116
            if len(l) > 2:
117
117
                included = map(int, l[2:].split(' '))
118
 
                w._v.append(VerInfo(included))
 
118
                w._addversion(included)
119
119
            else:
120
 
                w._v.append(VerInfo())
 
120
                w._addversion(None)
121
121
            assert f.readline() == '\n'
122
122
        elif l == 'w\n':
123
123
            break