~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/vf_repository.py

(jr) Add gettext() to progress bar text
 (Jonathan Riddell)

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 (
1087
1088
        keys = {'chk_bytes':set(), 'inventories':set(), 'texts':set()}
1088
1089
        kinds = ['chk_bytes', 'texts']
1089
1090
        count = len(checker.pending_keys)
1090
 
        bar.update("inventories", 0, 2)
 
1091
        bar.update(gettext("inventories"), 0, 2)
1091
1092
        current_keys = checker.pending_keys
1092
1093
        checker.pending_keys = {}
1093
1094
        # Accumulate current checks.
1113
1114
            del keys['inventories']
1114
1115
        else:
1115
1116
            return
1116
 
        bar.update("texts", 1)
 
1117
        bar.update(gettext("texts"), 1)
1117
1118
        while (checker.pending_keys or keys['chk_bytes']
1118
1119
            or keys['texts']):
1119
1120
            # Something to check.
1568
1569
        batch_size = 10 # should be ~150MB on a 55K path tree
1569
1570
        batch_count = len(revision_order) / batch_size + 1
1570
1571
        processed_texts = 0
1571
 
        pb.update("Calculating text parents", processed_texts, text_count)
 
1572
        pb.update(gettext("Calculating text parents"), processed_texts, text_count)
1572
1573
        for offset in xrange(batch_count):
1573
1574
            to_query = revision_order[offset * batch_size:(offset + 1) *
1574
1575
                batch_size]
1577
1578
            for revision_id in to_query:
1578
1579
                parent_ids = ancestors[revision_id]
1579
1580
                for text_key in revision_keys[revision_id]:
1580
 
                    pb.update("Calculating text parents", processed_texts)
 
1581
                    pb.update(gettext("Calculating text parents"), processed_texts)
1581
1582
                    processed_texts += 1
1582
1583
                    candidate_parents = []
1583
1584
                    for parent_id in parent_ids:
1653
1654
        num_file_ids = len(file_ids)
1654
1655
        for file_id, altered_versions in file_ids.iteritems():
1655
1656
            if pb is not None:
1656
 
                pb.update("Fetch texts", count, num_file_ids)
 
1657
                pb.update(gettext("Fetch texts"), count, num_file_ids)
1657
1658
            count += 1
1658
1659
            yield ("file", file_id, altered_versions)
1659
1660
 
2464
2465
            self.text_index.iterkeys()])
2465
2466
        # text keys is now grouped by file_id
2466
2467
        n_versions = len(self.text_index)
2467
 
        progress_bar.update('loading text store', 0, n_versions)
 
2468
        progress_bar.update(gettext('loading text store'), 0, n_versions)
2468
2469
        parent_map = self.repository.texts.get_parent_map(self.text_index)
2469
2470
        # On unlistable transports this could well be empty/error...
2470
2471
        text_keys = self.repository.texts.keys()
2471
2472
        unused_keys = frozenset(text_keys) - set(self.text_index)
2472
2473
        for num, key in enumerate(self.text_index.iterkeys()):
2473
 
            progress_bar.update('checking text graph', num, n_versions)
 
2474
            progress_bar.update(gettext('checking text graph'), num, n_versions)
2474
2475
            correct_parents = self.calculate_file_version_parents(key)
2475
2476
            try:
2476
2477
                knit_parents = parent_map[key]
2920
2921
        for offset in range(0, len(revision_ids), batch_size):
2921
2922
            self.target.start_write_group()
2922
2923
            try:
2923
 
                pb.update('Transferring revisions', offset,
 
2924
                pb.update(gettext('Transferring revisions'), offset,
2924
2925
                          len(revision_ids))
2925
2926
                batch = revision_ids[offset:offset+batch_size]
2926
2927
                basis_id = self._fetch_batch(batch, basis_id, cache)
2934
2935
                    hints.extend(hint)
2935
2936
        if hints and self.target._format.pack_compresses:
2936
2937
            self.target.pack(hint=hints)
2937
 
        pb.update('Transferring revisions', len(revision_ids),
 
2938
        pb.update(gettext('Transferring revisions'), len(revision_ids),
2938
2939
                  len(revision_ids))
2939
2940
 
2940
2941
    @needs_write_lock
3049
3050
            _install_revision(repository, revision, revision_tree, signature,
3050
3051
                inventory_cache)
3051
3052
            if pb is not None:
3052
 
                pb.update('Transferring revisions', n + 1, num_revisions)
 
3053
                pb.update(gettext('Transferring revisions'), n + 1, num_revisions)
3053
3054
    except:
3054
3055
        repository.abort_write_group()
3055
3056
        raise