Show More
@@ -70,8 +70,8 b' def testhunk(a, b, bstart):' | |||||
70 | alen = len(a) |
|
70 | alen = len(a) | |
71 | blen = len(b) |
|
71 | blen = len(b) | |
72 | if alen > blen - bstart: |
|
72 | if alen > blen - bstart: | |
73 |
return |
|
73 | return False | |
74 | for i in xrange(alen): |
|
74 | for i in xrange(alen): | |
75 | if a[i][1:] != b[i + bstart]: |
|
75 | if a[i][1:] != b[i + bstart]: | |
76 |
return |
|
76 | return False | |
77 |
return |
|
77 | return True |
@@ -795,8 +795,7 b' class patchfile(object):' | |||||
795 | # if there's skew we want to emit the "(offset %d lines)" even |
|
795 | # if there's skew we want to emit the "(offset %d lines)" even | |
796 | # when the hunk cleanly applies at start + skew, so skip the |
|
796 | # when the hunk cleanly applies at start + skew, so skip the | |
797 | # fast case code |
|
797 | # fast case code | |
798 | if (self.skew == 0 and |
|
798 | if self.skew == 0 and diffhelpers.testhunk(old, self.lines, oldstart): | |
799 | diffhelpers.testhunk(old, self.lines, oldstart) == 0): |
|
|||
800 | if self.remove: |
|
799 | if self.remove: | |
801 | self.backend.unlink(self.fname) |
|
800 | self.backend.unlink(self.fname) | |
802 | else: |
|
801 | else: | |
@@ -823,7 +822,7 b' class patchfile(object):' | |||||
823 | cand = [oldstart] |
|
822 | cand = [oldstart] | |
824 |
|
823 | |||
825 | for l in cand: |
|
824 | for l in cand: | |
826 |
if not old or diffhelpers.testhunk(old, self.lines, l) |
|
825 | if not old or diffhelpers.testhunk(old, self.lines, l): | |
827 | self.lines[l : l + len(old)] = new |
|
826 | self.lines[l : l + len(old)] = new | |
828 | self.offset += len(new) - len(old) |
|
827 | self.offset += len(new) - len(old) | |
829 | self.skew = l - orig_start |
|
828 | self.skew = l - orig_start |
General Comments 0
You need to be logged in to leave comments.
Login now