~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to groupcompress.py

  • Committer: John Arbash Meinel
  • Date: 2009-02-27 03:54:42 UTC
  • mto: (0.23.4 groupcompress_rabin)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: john@arbash-meinel.com-20090227035442-4sk2vcl343hg9afv
Add a progress indicator for chk pages.
Fix a bug with handling signatures, which don't have a parent graph

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
    """
111
111
    # gc-optimal ordering is approximately reverse topological,
112
112
    # properly grouped by file-id.
113
 
    per_prefix_map = {'': []}
 
113
    per_prefix_map = {}
114
114
    present_keys = []
115
115
    for item in parent_map.iteritems():
116
116
        key = item[0]
117
117
        if isinstance(key, str) or len(key) == 1:
118
 
            per_prefix_map[''].append(item)
 
118
            prefix = ''
119
119
        else:
120
 
            try:
121
 
                per_prefix_map[key[0]].append(item)
122
 
            except KeyError:
123
 
                per_prefix_map[key[0]] = [item]
 
120
            prefix = key[0]
 
121
        try:
 
122
            per_prefix_map[prefix].append(item)
 
123
        except KeyError:
 
124
            per_prefix_map[prefix] = [item]
124
125
 
125
126
    for prefix in sorted(per_prefix_map):
126
127
        present_keys.extend(reversed(topo_sort(per_prefix_map[prefix])))
585
586
        keys = set(orig_keys)
586
587
        if not keys:
587
588
            return
588
 
        if not self._index.has_graph and ordering == 'topological':
 
589
        if (not self._index.has_graph
 
590
            and ordering in ('topological', 'gc-optimal')):
589
591
            # Cannot topological order when no graph has been stored.
590
592
            ordering = 'unordered'
591
593
        # Cheap: iterate
604
606
            # Now group by source:
605
607
        elif ordering == 'gc-optimal':
606
608
            parent_map = dict((key, details[2]) for key, details in
607
 
                locations.iteritems())
 
609
                              locations.iteritems())
608
610
            for key in local_keys:
609
611
                parent_map[key] = self._unadded_refs[key]
610
612
            # XXX: This only optimizes for the target ordering. We may need to