~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to repofmt.py

Bring in the 'rabin' experiment.
Change the names and disk-strings for the various repository formats.
Make the CHK format repositories all 'rich-root' we can introduce non-rich-root later.
Make a couple other small tweaks, like copyright statements, etc.
Remove patch-delta.c, at this point, it was only a reference implementation,
as we have fully integrated the patching into pyrex, to allow nicer exception
handling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    inventory,
28
28
    pack,
29
29
    repository,
 
30
    trace,
30
31
    ui,
31
32
    )
32
33
from bzrlib.btree_index import (
45
46
    NewPack,
46
47
    KnitPackRepository,
47
48
    RepositoryPackCollection,
48
 
    RepositoryFormatPackDevelopment2,
49
 
    RepositoryFormatPackDevelopment2Subtree,
50
 
    RepositoryFormatKnitPack1,
51
 
    RepositoryFormatKnitPack3,
52
 
    RepositoryFormatKnitPack4,
 
49
    RepositoryFormatKnitPack6,
 
50
    RepositoryFormatKnitPack6RichRoot,
53
51
    Packer,
54
52
    ReconcilePacker,
55
53
    OptimisingPacker,
69
67
    chk_support = True
70
68
except ImportError:
71
69
    chk_support = False
72
 
from bzrlib.trace import mutter, note
73
70
 
74
71
 
75
72
def open_pack(self):
166
163
        self.write_stream = self.upload_transport.open_write_stream(
167
164
            self.random_name, mode=self._file_mode)
168
165
        if 'pack' in debug.debug_flags:
169
 
            mutter('%s: create_pack: pack stream open: %s%s t+%6.3fs',
 
166
            trace.mutter('%s: create_pack: pack stream open: %s%s t+%6.3fs',
170
167
                time.ctime(), self.upload_transport.base, self.random_name,
171
168
                time.time() - self.start_time)
172
169
        # A list of byte sequences to be written to the new pack, and the 
320
317
        for stream in _get_referenced_stream(p_id_roots):
321
318
            yield stream
322
319
        if remaining_keys:
323
 
            note('There were %d keys in the chk index, which were not'
324
 
                ' referenced from inventories', len(remaining_keys))
 
320
            trace.note('There were %d keys in the chk index, which were not'
 
321
                       ' referenced from inventories', len(remaining_keys))
325
322
            stream = source_vf.get_record_stream(remaining_keys, 'unordered',
326
323
                                                 True)
327
324
            yield stream
376
373
                    for pack in packs:
377
374
                        source_index = getattr(pack, index_name)
378
375
                        keys.update(e[1] for e in source_index.iter_all_entries())
 
376
                    trace.mutter('repacking %s with %d keys',
 
377
                                 vf_name, len(keys))
379
378
                    source_vf = getattr(self.repo, vf_name)
380
379
                    target_access = knit._DirectPackAccess({})
381
380
                    target_access.set_writer(new_pack._writer, new_index,
590
589
            self._fetch_uses_deltas = False
591
590
 
592
591
 
593
 
class RepositoryFormatPackGCPlain(RepositoryFormatPackDevelopment2):
 
592
class RepositoryFormatPackGCPlain(RepositoryFormatKnitPack6):
594
593
    """A B+Tree index using pack repository."""
595
594
 
596
595
    repository_class = GCPackRepository
 
596
    rich_root_data = False
597
597
 
598
598
    def get_format_string(self):
599
599
        """See RepositoryFormat.get_format_string()."""
600
600
        return ("Bazaar development format - btree+gc "
601
 
            "(needs bzr.dev from 1.6)\n")
 
601
            "(needs bzr.dev from 1.13)\n")
602
602
 
603
603
    def get_format_description(self):
604
604
        """See RepositoryFormat.get_format_description()."""
606
606
            ", interoperates with pack-0.92\n")
607
607
 
608
608
 
609
 
class RepositoryFormatPackGCRichRoot(RepositoryFormatKnitPack4):
610
 
    """A B+Tree index using pack repository."""
611
 
 
612
 
    repository_class = GCPackRepository
613
 
 
614
 
    def get_format_string(self):
615
 
        """See RepositoryFormat.get_format_string()."""
616
 
        return ("Bazaar development format - btree+gc-rich-root "
617
 
            "(needs bzr.dev from 1.6)\n")
618
 
 
619
 
    def get_format_description(self):
620
 
        """See RepositoryFormat.get_format_description()."""
621
 
        return ("Development repository format - btree+groupcompress "
622
 
            ", interoperates with rich-root-pack\n")
623
 
 
624
 
 
625
 
class RepositoryFormatPackGCSubtrees(RepositoryFormatPackDevelopment2Subtree):
626
 
    """A B+Tree index using pack repository."""
627
 
 
628
 
    repository_class = GCPackRepository
629
 
 
630
 
    def get_format_string(self):
631
 
        """See RepositoryFormat.get_format_string()."""
632
 
        return ("Bazaar development format - btree+gc-subtrees "
633
 
            "(needs bzr.dev from 1.6)\n")
634
 
 
635
 
    def get_format_description(self):
636
 
        """See RepositoryFormat.get_format_description()."""
637
 
        return ("Development repository format - btree+groupcompress "
638
 
            ", interoperates with pack-0.92-subtrees\n")
639
 
 
640
609
if chk_support:
641
 
    class RepositoryFormatPackGCPlainCHK(RepositoryFormatPackDevelopment5):
642
 
        """A CHK+group compress pack repository."""
643
 
 
644
 
        repository_class = GCCHKPackRepository
645
 
 
646
 
        def get_format_string(self):
647
 
            """See RepositoryFormat.get_format_string()."""
648
 
            return ('Bazaar development format - chk+gc'
649
 
                    ' (needs bzr.dev from 1.13)\n')
650
 
 
651
 
        def get_format_description(self):
652
 
            """See RepositoryFormat.get_format_description()."""
653
 
            return ("Development repository format - chk+groupcompress")
654
 
 
655
 
 
656
 
    class RepositoryFormatPackGCPlainCHK16(RepositoryFormatPackDevelopment5Hash16):
 
610
    class RepositoryFormatPackGCCHK16(RepositoryFormatPackDevelopment5Hash16):
657
611
        """A hashed CHK+group compress pack repository."""
658
612
 
659
613
        repository_class = GCCHKPackRepository
 
614
        rich_root_data = True
660
615
 
661
616
        def get_format_string(self):
662
617
            """See RepositoryFormat.get_format_string()."""
663
 
            return ('Bazaar development format - hash16chk+gc'
 
618
            return ('Bazaar development format - hash16chk+gc rich-root'
664
619
                    ' (needs bzr.dev from 1.13)\n')
665
620
 
666
621
        def get_format_description(self):
668
623
            return ("Development repository format - hash16chk+groupcompress")
669
624
 
670
625
 
671
 
##    class RepositoryFormatPackGCPlainCHK16b(RepositoryFormatPackDevelopment5Hash16b):
672
 
##        """A hashed CHK+group compress pack repository."""
673
 
##
674
 
##        repository_class = GCCHKPackRepository
675
 
##
676
 
##        def get_format_string(self):
677
 
##            """See RepositoryFormat.get_format_string()."""
678
 
##            return ('Bazaar development format - hash16bchk+gc'
679
 
##                    ' (needs bzr.dev from 1.13)\n')
680
 
##
681
 
##        def get_format_description(self):
682
 
##            """See RepositoryFormat.get_format_description()."""
683
 
##            return ("Development repository format - hash16bchk+groupcompress")
684
 
##
685
 
##
686
 
##    class RepositoryFormatPackGCPlainCHK63(RepositoryFormatPackDevelopment5Hash63):
687
 
##        """A hashed CHK+group compress pack repository."""
688
 
##
689
 
##        repository_class = GCCHKPackRepository
690
 
##
691
 
##        def get_format_string(self):
692
 
##            """See RepositoryFormat.get_format_string()."""
693
 
##            return ('Bazaar development format - hash63+gc'
694
 
##                    ' (needs bzr.dev from 1.13)\n')
695
 
##
696
 
##        def get_format_description(self):
697
 
##            """See RepositoryFormat.get_format_description()."""
698
 
##            return ("Development repository format - hash63+groupcompress")
699
 
##
700
 
##
701
 
##    class RepositoryFormatPackGCPlainCHK127a(RepositoryFormatPackDevelopment5Hash127a):
702
 
##        """A hashed CHK+group compress pack repository."""
703
 
##
704
 
##        repository_class = GCCHKPackRepository
705
 
##
706
 
##        def get_format_string(self):
707
 
##            """See RepositoryFormat.get_format_string()."""
708
 
##            return ('Bazaar development format - hash127a+gc'
709
 
##                    ' (needs bzr.dev from 1.13)\n')
710
 
##
711
 
##        def get_format_description(self):
712
 
##            """See RepositoryFormat.get_format_description()."""
713
 
##            return ("Development repository format - hash127a+groupcompress")
714
 
##
715
 
##
716
 
##    class RepositoryFormatPackGCPlainCHK127b(RepositoryFormatPackDevelopment5Hash127b):
717
 
##        """A hashed CHK+group compress pack repository."""
718
 
##
719
 
##        repository_class = GCCHKPackRepository
720
 
##
721
 
##        def get_format_string(self):
722
 
##            """See RepositoryFormat.get_format_string()."""
723
 
##            return ('Bazaar development format - hash127b+gc'
724
 
##                    ' (needs bzr.dev from 1.13)\n')
725
 
##
726
 
##        def get_format_description(self):
727
 
##            """See RepositoryFormat.get_format_description()."""
728
 
##            return ("Development repository format - hash127b+groupcompress")
729
 
 
730
 
 
731
 
    class RepositoryFormatPackGCPlainCHK255(RepositoryFormatPackDevelopment5Hash255):
 
626
    class RepositoryFormatPackGCCHK255(RepositoryFormatPackDevelopment5Hash255):
732
627
        """A hashed CHK+group compress pack repository."""
733
628
 
734
629
        repository_class = GCCHKPackRepository
 
630
        rich_root_data = True
735
631
 
736
632
        def get_format_string(self):
737
633
            """See RepositoryFormat.get_format_string()."""
738
 
            return ('Bazaar development format - hash255chk+gc'
 
634
            return ('Bazaar development format - hash255chk+gc rich-root'
739
635
                    ' (needs bzr.dev from 1.13)\n')
740
636
 
741
637
        def get_format_description(self):
745
641
 
746
642
def pack_incompatible(source, target, orig_method=InterPackRepo.is_compatible):
747
643
    """Be incompatible with the regular fetch code."""
748
 
    formats = (RepositoryFormatPackGCPlain, RepositoryFormatPackGCRichRoot,
749
 
        RepositoryFormatPackGCSubtrees)
 
644
    formats = (RepositoryFormatPackGC,)
750
645
    if chk_support:
751
 
        formats = formats + (RepositoryFormatPackGCPlainCHK,
752
 
                             RepositoryFormatPackGCPlainCHK16,
753
 
                             ## RepositoryFormatPackGCPlainCHK16b,
754
 
                             ## RepositoryFormatPackGCPlainCHK63,
755
 
                             ## RepositoryFormatPackGCPlainCHK127a,
756
 
                             ## RepositoryFormatPackGCPlainCHK127b,
757
 
                             RepositoryFormatPackGCPlainCHK255)
 
646
        formats = formats + (RepositoryFormatPackGCCHK16,
 
647
                             RepositoryFormatPackGCCHK255)
758
648
    if isinstance(source._format, formats) or isinstance(target._format, formats):
759
649
        return False
760
650
    else: