Rev 40: Compatibility with python 2.4 in http://people.ubuntu.com/~robertc/baz2.0/plugins/index2/trunk

Robert Collins robertc at robertcollins.net
Tue Jul 15 09:53:45 BST 2008


At http://people.ubuntu.com/~robertc/baz2.0/plugins/index2/trunk

------------------------------------------------------------
revno: 40
revision-id: robertc at robertcollins.net-20080715085345-9xos2vqqpfkmcb4p
parent: robertc at robertcollins.net-20080714174346-vb2vt10rx60ok0gr
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Tue 2008-07-15 18:53:45 +1000
message:
  Compatibility with python 2.4
modified:
  btree_index.py                 index.py-20080624222253-p0x5f92uyh5hw734-7
=== modified file 'btree_index.py'
--- a/btree_index.py	2008-07-14 17:43:46 +0000
+++ b/btree_index.py	2008-07-15 08:53:45 +0000
@@ -272,11 +272,14 @@
             return item[1][1]
         last = None
         while True:
-            candidates = [item for item
+            # Decorate candidates with the value to allow 2.4's min to be used.
+            candidates = [(item[1][1], item) for item
                 in enumerate(current_values) if item[1] is not None]
             if not len(candidates):
                 return
-            selected = min(candidates, key=getter)
+            selected = min(candidates)
+            # undecorate back to (pos, node)
+            selected = selected[1]
             if last == selected[1][1]:
                 raise bzrerrors.BadIndexDuplicateKey(last, self)
             last = selected[1][1]




More information about the bazaar-commits mailing list