comparison mercurial/patch.py @ 9681:ac3a68cb16eb

patch: simplify logic
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 31 Oct 2009 18:00:05 +0100
parents 7d17794f08a9
children bd70f645cfb0
comparison
equal deleted inserted replaced
9680:8cea86d73887 9681:ac3a68cb16eb
340 def findlines(self, l, linenum): 340 def findlines(self, l, linenum):
341 # looks through the hash and finds candidate lines. The 341 # looks through the hash and finds candidate lines. The
342 # result is a list of line numbers sorted based on distance 342 # result is a list of line numbers sorted based on distance
343 # from linenum 343 # from linenum
344 344
345 try: 345 cand = self.hash.get(l, [])
346 cand = self.hash[l]
347 except:
348 return []
349
350 if len(cand) > 1: 346 if len(cand) > 1:
351 # resort our list of potentials forward then back. 347 # resort our list of potentials forward then back.
352 cand.sort(key=lambda x: abs(x - linenum)) 348 cand.sort(key=lambda x: abs(x - linenum))
353 return cand 349 return cand
354 350