mercurial/patch.py
changeset 9032 1fa80c5428b8
parent 9031 3b76321aa0de
child 9139 6d1f9238824e
--- a/mercurial/patch.py	Sun Jul 05 11:01:30 2009 +0200
+++ b/mercurial/patch.py	Sun Jul 05 11:02:00 2009 +0200
@@ -325,10 +325,6 @@
         # looks through the hash and finds candidate lines.  The
         # result is a list of line numbers sorted based on distance
         # from linenum
-        def sorter(a, b):
-            vala = abs(a - linenum)
-            valb = abs(b - linenum)
-            return cmp(vala, valb)
 
         try:
             cand = self.hash[l]
@@ -337,7 +333,7 @@
 
         if len(cand) > 1:
             # resort our list of potentials forward then back.
-            cand.sort(sorter)
+            cand.sort(key=lambda x: abs(x - linenum))
         return cand
 
     def hashlines(self):