Rev 3881: Add a comment about what data we are sorting by. in http://bzr.arbash-meinel.com/branches/bzr/1.11/sorted_get_record_stream
John Arbash Meinel
john at arbash-meinel.com
Fri Dec 5 13:11:16 GMT 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.11/sorted_get_record_stream
------------------------------------------------------------
revno: 3881
revision-id: john at arbash-meinel.com-20081205131110-lslaoi77c0l6cepq
parent: john at arbash-meinel.com-20081204205915-0ubzh41iryx4f0t1
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: sorted_get_record_stream
timestamp: Fri 2008-12-05 07:11:10 -0600
message:
Add a comment about what data we are sorting by.
-------------- next part --------------
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py 2008-12-04 20:59:15 +0000
+++ b/bzrlib/knit.py 2008-12-05 13:11:10 +0000
@@ -2139,14 +2139,14 @@
_get_components_positions()
:return: None
"""
- def get_index_memo(key):
+ def get_sort_key(key):
index_memo = positions[key][1]
# Group by prefix and position. index_memo[0] is the key, so it is
# (file_id, revision_id) and we don't want to sort on revision_id,
# index_memo[1] is the position, and index_memo[2] is the size,
# which doesn't matter for the sort
return index_memo[0][:-1], index_memo[1]
- return keys.sort(key=get_index_memo)
+ return keys.sort(key=get_sort_key)
def _split_key(self, key):
"""Split key into a prefix and suffix."""
@@ -2419,6 +2419,11 @@
:return: None
"""
def get_index_memo(key):
+ # index_memo is at offset [1]. It is made up of (GraphIndex,
+ # position, size). GI is an object, which will be unique for each
+ # pack file. This causes us to group by pack file, then sort by
+ # position. Size doesn't matter, but it isn't worth breaking up the
+ # tuple.
return positions[key][1]
return keys.sort(key=get_index_memo)
More information about the bazaar-commits
mailing list