~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/vf_repository.py

  • Committer: Jelmer Vernooij
  • Date: 2011-09-26 11:00:20 UTC
  • mfrom: (6167 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6169.
  • Revision ID: jelmer@samba.org-20110926110020-g86tgisgnuajlc2n
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
from bzrlib.recordcounter import RecordCounter
44
44
from bzrlib.revisiontree import InventoryRevisionTree
45
45
from bzrlib.testament import Testament
 
46
from bzrlib.i18n import gettext
46
47
""")
47
48
 
48
49
from bzrlib import (
918
919
        """
919
920
        if not self._format.supports_external_lookups:
920
921
            raise errors.UnstackableRepositoryFormat(self._format, self.base)
 
922
        # This can raise an exception, so should be done before we lock the
 
923
        # fallback repository.
 
924
        self._check_fallback_repository(repository)
921
925
        if self.is_locked():
922
926
            # This repository will call fallback.unlock() when we transition to
923
927
            # the unlocked state, so we make sure to increment the lock count
924
928
            repository.lock_read()
925
 
        self._check_fallback_repository(repository)
926
929
        self._fallback_repositories.append(repository)
927
930
        self.texts.add_fallback_versioned_files(repository.texts)
928
931
        self.inventories.add_fallback_versioned_files(repository.inventories)
1085
1088
        keys = {'chk_bytes':set(), 'inventories':set(), 'texts':set()}
1086
1089
        kinds = ['chk_bytes', 'texts']
1087
1090
        count = len(checker.pending_keys)
1088
 
        bar.update("inventories", 0, 2)
 
1091
        bar.update(gettext("inventories"), 0, 2)
1089
1092
        current_keys = checker.pending_keys
1090
1093
        checker.pending_keys = {}
1091
1094
        # Accumulate current checks.
1111
1114
            del keys['inventories']
1112
1115
        else:
1113
1116
            return
1114
 
        bar.update("texts", 1)
 
1117
        bar.update(gettext("texts"), 1)
1115
1118
        while (checker.pending_keys or keys['chk_bytes']
1116
1119
            or keys['texts']):
1117
1120
            # Something to check.
1204
1207
        # this construct will accept instances of those things.
1205
1208
        super(VersionedFileRepository, self).__init__(_format, a_bzrdir,
1206
1209
            control_files)
 
1210
        self._transport = control_files._transport
 
1211
        self.base = self._transport.base
1207
1212
        # for tests
1208
1213
        self._reconcile_does_inventory_gc = True
1209
1214
        self._reconcile_fixes_text_parents = False
1566
1571
        batch_size = 10 # should be ~150MB on a 55K path tree
1567
1572
        batch_count = len(revision_order) / batch_size + 1
1568
1573
        processed_texts = 0
1569
 
        pb.update("Calculating text parents", processed_texts, text_count)
 
1574
        pb.update(gettext("Calculating text parents"), processed_texts, text_count)
1570
1575
        for offset in xrange(batch_count):
1571
1576
            to_query = revision_order[offset * batch_size:(offset + 1) *
1572
1577
                batch_size]
1575
1580
            for revision_id in to_query:
1576
1581
                parent_ids = ancestors[revision_id]
1577
1582
                for text_key in revision_keys[revision_id]:
1578
 
                    pb.update("Calculating text parents", processed_texts)
 
1583
                    pb.update(gettext("Calculating text parents"), processed_texts)
1579
1584
                    processed_texts += 1
1580
1585
                    candidate_parents = []
1581
1586
                    for parent_id in parent_ids:
1651
1656
        num_file_ids = len(file_ids)
1652
1657
        for file_id, altered_versions in file_ids.iteritems():
1653
1658
            if pb is not None:
1654
 
                pb.update("Fetch texts", count, num_file_ids)
 
1659
                pb.update(gettext("Fetch texts"), count, num_file_ids)
1655
1660
            count += 1
1656
1661
            yield ("file", file_id, altered_versions)
1657
1662
 
2462
2467
            self.text_index.iterkeys()])
2463
2468
        # text keys is now grouped by file_id
2464
2469
        n_versions = len(self.text_index)
2465
 
        progress_bar.update('loading text store', 0, n_versions)
 
2470
        progress_bar.update(gettext('loading text store'), 0, n_versions)
2466
2471
        parent_map = self.repository.texts.get_parent_map(self.text_index)
2467
2472
        # On unlistable transports this could well be empty/error...
2468
2473
        text_keys = self.repository.texts.keys()
2469
2474
        unused_keys = frozenset(text_keys) - set(self.text_index)
2470
2475
        for num, key in enumerate(self.text_index.iterkeys()):
2471
 
            progress_bar.update('checking text graph', num, n_versions)
 
2476
            progress_bar.update(gettext('checking text graph'), num, n_versions)
2472
2477
            correct_parents = self.calculate_file_version_parents(key)
2473
2478
            try:
2474
2479
                knit_parents = parent_map[key]
2918
2923
        for offset in range(0, len(revision_ids), batch_size):
2919
2924
            self.target.start_write_group()
2920
2925
            try:
2921
 
                pb.update('Transferring revisions', offset,
 
2926
                pb.update(gettext('Transferring revisions'), offset,
2922
2927
                          len(revision_ids))
2923
2928
                batch = revision_ids[offset:offset+batch_size]
2924
2929
                basis_id = self._fetch_batch(batch, basis_id, cache)
2932
2937
                    hints.extend(hint)
2933
2938
        if hints and self.target._format.pack_compresses:
2934
2939
            self.target.pack(hint=hints)
2935
 
        pb.update('Transferring revisions', len(revision_ids),
 
2940
        pb.update(gettext('Transferring revisions'), len(revision_ids),
2936
2941
                  len(revision_ids))
2937
2942
 
2938
2943
    @needs_write_lock
3047
3052
            _install_revision(repository, revision, revision_tree, signature,
3048
3053
                inventory_cache)
3049
3054
            if pb is not None:
3050
 
                pb.update('Transferring revisions', n + 1, num_revisions)
 
3055
                pb.update(gettext('Transferring revisions'), n + 1, num_revisions)
3051
3056
    except:
3052
3057
        repository.abort_write_group()
3053
3058
        raise