~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Martin Pool
  • Date: 2005-07-11 04:08:33 UTC
  • Revision ID: mbp@sourcefrog.net-20050711040832-b516f622d7e5d1f3
- fix up refactoring of weave

Show diffs side-by-side

added added

removed removed

Lines of Context:
326
326
        dset = set()
327
327
 
328
328
        lineno = 0         # line of weave, 0-based
 
329
 
329
330
        isactive = False
330
331
 
331
332
        WFE = WeaveFormatError
333
334
        for l in self._l:
334
335
            if isinstance(l, tuple):
335
336
                c, v = l
336
 
                if v in included:       # only active blocks are interesting
337
 
                    if c == '{':
338
 
                        assert v not in istack
339
 
                        istack.append(v)
340
 
                        isactive = not dset
341
 
                    elif c == '}':
342
 
                        oldv = istack.pop()
343
 
                        assert oldv == v
344
 
                        isactive = istack and not dset
345
 
                    elif c == '[':
 
337
                if c == '{':
 
338
                    assert v not in istack
 
339
                    istack.append(v)
 
340
                    if not dset:
 
341
                        isactive = (v in included)
 
342
                elif c == '}':
 
343
                    oldv = istack.pop()
 
344
                    assert oldv == v
 
345
                    isactive = (not dset) and (istack and istack[-1] in included)
 
346
                elif c == '[':
 
347
                    if v in included:
346
348
                        assert v not in dset
347
349
                        dset.add(v)
348
350
                        isactive = False
349
 
                    else:
350
 
                        assert c == ']'
 
351
                else:
 
352
                    assert c == ']'
 
353
                    if v in included:
351
354
                        assert v in dset
352
355
                        dset.remove(v)
353
 
                        isactive = istack and not dset
 
356
                        isactive = (not dset) and (istack and istack[-1] in included)
354
357
            else:
355
358
                assert isinstance(l, basestring)
356
359
                if isactive: