/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/weave.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
399
399
 
400
400
        :param nostore_sha: See VersionedFile.add_lines.
401
401
        """
402
 
        assert isinstance(version_id, basestring)
403
402
        self._check_lines_not_unicode(lines)
404
403
        self._check_lines_are_lines(lines)
405
404
        if not sha1:
480
479
            #print 'raw match', tag, i1, i2, j1, j2
481
480
            if tag == 'equal':
482
481
                continue
483
 
 
484
482
            i1 = basis_lineno[i1]
485
483
            i2 = basis_lineno[i2]
486
 
 
487
 
            assert 0 <= j1 <= j2 <= len(lines)
488
 
 
489
 
            #print tag, i1, i2, j1, j2
490
 
 
491
484
            # the deletion and insertion are handled separately.
492
485
            # first delete the region.
493
486
            if i1 != i2:
594
587
                elif c == '}':
595
588
                    istack.pop()
596
589
                elif c == '[':
597
 
                    assert self._names[v] not in dset
598
590
                    dset.add(self._names[v])
599
591
                elif c == ']':
600
592
                    dset.remove(self._names[v])
601
593
                else:
602
594
                    raise WeaveFormatError('unexpected instruction %r' % v)
603
595
            else:
604
 
                assert l.__class__ in (str, unicode)
605
 
                assert istack
606
596
                yield lineno, istack[-1], frozenset(dset), l
607
597
            lineno += 1
608
598
 
718
708
                c, v = l
719
709
                isactive = None
720
710
                if c == '{':
721
 
                    assert v not in iset
722
711
                    istack.append(v)
723
712
                    iset.add(v)
724
713
                elif c == '}':
725
714
                    iset.remove(istack.pop())
726
715
                elif c == '[':
727
716
                    if v in included:
728
 
                        assert v not in dset
729
717
                        dset.add(v)
730
 
                else:
731
 
                    assert c == ']'
 
718
                elif c == ']':
732
719
                    if v in included:
733
 
                        assert v in dset
734
720
                        dset.remove(v)
 
721
                else:
 
722
                    raise AssertionError()
735
723
            else:
736
 
                assert l.__class__ in (str, unicode)
737
724
                if isactive is None:
738
725
                    isactive = (not dset) and istack and (istack[-1] in included)
739
726
                if isactive:
777
764
    def num_versions(self):
778
765
        """How many versions are in this weave?"""
779
766
        l = len(self._parents)
780
 
        assert l == len(self._sha1s)
781
767
        return l
782
768
 
783
769
    __len__ = num_versions
809
795
            for p in self._parents[i]:
810
796
                new_inc.update(inclusions[self._idx_to_name(p)])
811
797
 
812
 
            assert set(new_inc) == set(self.get_ancestry(name)), \
813
 
                'failed %s != %s' % (set(new_inc), set(self.get_ancestry(name)))
 
798
            if set(new_inc) != set(self.get_ancestry(name)):
 
799
                raise AssertionError(
 
800
                    'failed %s != %s' 
 
801
                    % (set(new_inc), set(self.get_ancestry(name))))
814
802
            inclusions[name] = new_inc
815
803
 
816
804
        nlines = len(self._weave)