##// END OF EJS Templates
patch: inline patchfile.hashlines()
Patrick Mezard -
r13700:63307feb default
parent child Browse files
Show More
@@ -488,11 +488,6 b' class patchfile(object):'
488 cand.sort(key=lambda x: abs(x - linenum))
488 cand.sort(key=lambda x: abs(x - linenum))
489 return cand
489 return cand
490
490
491 def hashlines(self):
492 self.hash = {}
493 for x, s in enumerate(self.lines):
494 self.hash.setdefault(s, []).append(x)
495
496 def makerejlines(self, fname):
491 def makerejlines(self, fname):
497 base = os.path.basename(fname)
492 base = os.path.basename(fname)
498 yield "--- %s\n+++ %s\n" % (base, base)
493 yield "--- %s\n+++ %s\n" % (base, base)
@@ -574,8 +569,10 b' class patchfile(object):'
574 self.dirty = 1
569 self.dirty = 1
575 return 0
570 return 0
576
571
577 # ok, we couldn't match the hunk. Lets look for offsets and fuzz it
572 # ok, we couldn't match the hunk. Lets look for offsets and fuzz it
578 self.hashlines()
573 self.hash = {}
574 for x, s in enumerate(self.lines):
575 self.hash.setdefault(s, []).append(x)
579 if h.hunk[-1][0] != ' ':
576 if h.hunk[-1][0] != ' ':
580 # if the hunk tried to put something at the bottom of the file
577 # if the hunk tried to put something at the bottom of the file
581 # override the start line and use eof here
578 # override the start line and use eof here
General Comments 0
You need to be logged in to leave comments. Login now