~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: John Arbash Meinel
  • Date: 2009-02-25 20:23:04 UTC
  • mto: This revision was merged to the branch mainline in revision 4051.
  • Revision ID: john@arbash-meinel.com-20090225202304-j52lrdrx8aw101uh
Turn _split_by_prefix into a classmethod, and add direct tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
818
818
        as returned by _get_components_positions)
819
819
    :return: Number of bytes to build those keys
820
820
    """
821
 
    index_memos = set()
822
821
    all_build_index_memos = {}
823
822
    build_keys = keys
824
823
    while build_keys:
1223
1222
            except errors.RetryWithNewPacks, e:
1224
1223
                self._access.reload_or_raise(e)
1225
1224
 
1226
 
    def _split_by_prefix(self, keys):
 
1225
    @classmethod
 
1226
    def _split_by_prefix(cls, keys):
1227
1227
        """For the given keys, split them up based on their prefix.
1228
1228
 
1229
1229
        To keep memory pressure somewhat under control, split the
1232
1232
        This should be revisited if _get_content_maps() can ever cross
1233
1233
        file-id boundaries.
1234
1234
 
1235
 
        Note that the keys are generally kept in the same order, so if you
1236
 
        present them in a sorted order, the sorting will generally be
1237
 
        preserved.
 
1235
        The keys for a given file_id are kept in the same relative order.
 
1236
        Ordering between file_ids is not, though prefix_order will return the
 
1237
        order that the key was first seen.
1238
1238
 
1239
1239
        :param keys: An iterable of key tuples
1240
1240
        :return: (split_map, prefix_order)