patch: simplify logic
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 31 Oct 2009 18:00:05 +0100
changeset 9681 ac3a68cb16eb
parent 9680 8cea86d73887
child 9682 bd70f645cfb0
patch: simplify logic
mercurial/patch.py
--- a/mercurial/patch.py	Sat Oct 31 17:07:12 2009 +0100
+++ b/mercurial/patch.py	Sat Oct 31 18:00:05 2009 +0100
@@ -342,11 +342,7 @@
         # result is a list of line numbers sorted based on distance
         # from linenum
 
-        try:
-            cand = self.hash[l]
-        except:
-            return []
-
+        cand = self.hash.get(l, [])
         if len(cand) > 1:
             # resort our list of potentials forward then back.
             cand.sort(key=lambda x: abs(x - linenum))