Show More
@@ -1,4 +1,4 b'' | |||
|
1 |
# diffhelper |
|
|
1 | # diffhelper.py - helper routines for patch | |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2009 Matt Mackall <mpm@selenic.com> and others |
|
4 | 4 | # |
@@ -28,7 +28,7 b' from .node import (' | |||
|
28 | 28 | ) |
|
29 | 29 | from . import ( |
|
30 | 30 | copies, |
|
31 |
diffhelper |
|
|
31 | diffhelper, | |
|
32 | 32 | encoding, |
|
33 | 33 | error, |
|
34 | 34 | mail, |
@@ -800,7 +800,7 b' class patchfile(object):' | |||
|
800 | 800 | # if there's skew we want to emit the "(offset %d lines)" even |
|
801 | 801 | # when the hunk cleanly applies at start + skew, so skip the |
|
802 | 802 | # fast case code |
|
803 |
if self.skew == 0 and diffhelper |
|
|
803 | if self.skew == 0 and diffhelper.testhunk(old, self.lines, oldstart): | |
|
804 | 804 | if self.remove: |
|
805 | 805 | self.backend.unlink(self.fname) |
|
806 | 806 | else: |
@@ -827,7 +827,7 b' class patchfile(object):' | |||
|
827 | 827 | cand = [oldstart] |
|
828 | 828 | |
|
829 | 829 | for l in cand: |
|
830 |
if not old or diffhelper |
|
|
830 | if not old or diffhelper.testhunk(old, self.lines, l): | |
|
831 | 831 | self.lines[l : l + len(old)] = new |
|
832 | 832 | self.offset += len(new) - len(old) |
|
833 | 833 | self.skew = l - orig_start |
@@ -1259,8 +1259,8 b' class hunk(object):' | |||
|
1259 | 1259 | self.starta = int(self.starta) |
|
1260 | 1260 | self.startb = int(self.startb) |
|
1261 | 1261 | try: |
|
1262 |
diffhelper |
|
|
1263 |
|
|
|
1262 | diffhelper.addlines(lr, self.hunk, self.lena, self.lenb, | |
|
1263 | self.a, self.b) | |
|
1264 | 1264 | except error.ParseError as e: |
|
1265 | 1265 | raise PatchError(_("bad hunk #%d: %s") % (self.number, e)) |
|
1266 | 1266 | # if we hit eof before finishing out the hunk, the last line will |
@@ -1379,7 +1379,7 b' class hunk(object):' | |||
|
1379 | 1379 | def _fixnewline(self, lr): |
|
1380 | 1380 | l = lr.readline() |
|
1381 | 1381 | if l.startswith('\ '): |
|
1382 |
diffhelper |
|
|
1382 | diffhelper.fixnewline(self.hunk, self.a, self.b) | |
|
1383 | 1383 | else: |
|
1384 | 1384 | lr.push(l) |
|
1385 | 1385 |
General Comments 0
You need to be logged in to leave comments.
Login now