/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 bzrlib/weavefile.py

  • Committer: Martin Pool
  • Date: 2008-04-24 07:22:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080424072253-opmjij7xfy38w27f
Remove every assert statement from bzrlib!

Depending on the context they are:

 * turned into an explicit if/raise of either AssertionError 
   or something more specific -- particularly where they protect
   programming interfaces, complex invariants, or data file integrity
 * removed, if they're redundant with a later check, not protecting
   a meaningful invariant
 * turned into a selftest method on tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
 
73
73
    for l in weave._weave:
74
74
        if isinstance(l, tuple):
75
 
            assert l[0] in '{}[]'
76
75
            if l[0] == '}':
77
76
                f.write('}\n')
78
77
            else:
81
80
            if not l:
82
81
                f.write(', \n')
83
82
            elif l[-1] == '\n':
84
 
                assert l.find('\n', 0, -1) == -1
85
83
                f.write('. ' + l)
86
84
            else:
87
 
                assert l.find('\n') == -1
88
85
                f.write(', ' + l + '\n')
89
86
 
90
87
    f.write('W\n')
140
137
                w._parents.append(map(int, l[2:].split(' ')))
141
138
            else:
142
139
                w._parents.append([])
143
 
 
144
140
            l = lines.next()[:-1]
145
 
            assert '1 ' == l[0:2]
146
141
            w._sha1s.append(l[2:])
147
 
                
148
142
            l = lines.next()
149
 
            assert 'n ' == l[0:2]
150
143
            name = l[2:-1]
151
 
            assert name not in w._name_map
152
144
            w._names.append(name)
153
145
            w._name_map[name] = ver
154
 
                
155
146
            l = lines.next()
156
 
            assert l == '\n'
157
 
 
158
147
            ver += 1
159
148
        elif l == 'w\n':
160
149
            break
173
162
        elif l == '}\n':
174
163
            w._weave.append(('}', None))
175
164
        else:
176
 
            assert l[0] in '{[]', l
177
 
            assert l[1] == ' ', l
178
165
            w._weave.append((intern(l[0]), int(l[2:])))
179
 
 
180
166
    return w
181