diff -r 3b76321aa0de -r 1fa80c5428b8 mercurial/patch.py --- 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):