patch: inline patchfile.hashlines()
authorPatrick Mezard <pmezard@gmail.com>
Sun, 20 Mar 2011 00:09:44 +0100
changeset 13700 63307feb59dd
parent 13699 d3c0e0033f13
child 13701 bc38ff7cb919
patch: inline patchfile.hashlines()
mercurial/patch.py
--- a/mercurial/patch.py	Sun Mar 20 00:08:44 2011 +0100
+++ b/mercurial/patch.py	Sun Mar 20 00:09:44 2011 +0100
@@ -488,11 +488,6 @@
             cand.sort(key=lambda x: abs(x - linenum))
         return cand
 
-    def hashlines(self):
-        self.hash = {}
-        for x, s in enumerate(self.lines):
-            self.hash.setdefault(s, []).append(x)
-
     def makerejlines(self, fname):
         base = os.path.basename(fname)
         yield "--- %s\n+++ %s\n" % (base, base)
@@ -574,8 +569,10 @@
                 self.dirty = 1
             return 0
 
-        # ok, we couldn't match the hunk.  Lets look for offsets and fuzz it
-        self.hashlines()
+        # ok, we couldn't match the hunk. Lets look for offsets and fuzz it
+        self.hash = {}
+        for x, s in enumerate(self.lines):
+            self.hash.setdefault(s, []).append(x)
         if h.hunk[-1][0] != ' ':
             # if the hunk tried to put something at the bottom of the file
             # override the start line and use eof here