~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weavefile.py

  • Committer: Martin Pool
  • Date: 2005-07-18 13:38:13 UTC
  • Revision ID: mbp@sourcefrog.net-20050718133813-4343f0cde39537de
- refactor member names in Weave code

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, included in enumerate(weave._v):
 
55
    for version, included in enumerate(weave._parents):
56
56
        if included:
57
57
            # mininc = weave.minimal_parents(version)
58
58
            mininc = included
67
67
 
68
68
    print >>f, 'w'
69
69
 
70
 
    for l in weave._l:
 
70
    for l in weave._weave:
71
71
        if isinstance(l, tuple):
72
72
            assert l[0] in '{}[]'
73
73
            print >>f, '%s %d' % l
105
105
            ver += 1
106
106
 
107
107
            if len(l) > 2:
108
 
                w._v.append(frozenset(map(int, l[2:].split(' '))))
 
108
                w._parents.append(frozenset(map(int, l[2:].split(' '))))
109
109
            else:
110
 
                w._v.append(frozenset())
 
110
                w._parents.append(frozenset())
111
111
 
112
112
            l = f.readline()[:-1]
113
113
            assert l.startswith('1 ')
125
125
        if l == 'W\n':
126
126
            break
127
127
        elif l.startswith('. '):
128
 
            w._l.append(l[2:])  # include newline
 
128
            w._weave.append(l[2:])  # include newline
129
129
        elif l.startswith(', '):
130
 
            w._l.append(l[2:-1])        # exclude newline
 
130
            w._weave.append(l[2:-1])        # exclude newline
131
131
        else:
132
132
            assert l[0] in '{}[]', l
133
133
            assert l[1] == ' ', l
134
 
            w._l.append((intern(l[0]), int(l[2:])))
 
134
            w._weave.append((intern(l[0]), int(l[2:])))
135
135
 
136
136
    return w
137
137