##// END OF EJS Templates
patch: merge makerejlines() into write_rej()
Patrick Mezard -
r14349:776ae95b default
parent child Browse files
Show More
@@ -543,15 +543,6 b' class patchfile(object):'
543 cand.sort(key=lambda x: abs(x - linenum))
543 cand.sort(key=lambda x: abs(x - linenum))
544 return cand
544 return cand
545
545
546 def makerejlines(self, fname):
547 base = os.path.basename(fname)
548 yield "--- %s\n+++ %s\n" % (base, base)
549 for x in self.rej:
550 for l in x.hunk:
551 yield l
552 if l[-1] != '\n':
553 yield "\n\ No newline at end of file\n"
554
555 def write_rej(self):
546 def write_rej(self):
556 # our rejects are a little different from patch(1). This always
547 # our rejects are a little different from patch(1). This always
557 # creates rejects in the same form as the original patch. A file
548 # creates rejects in the same form as the original patch. A file
@@ -559,8 +550,14 b' class patchfile(object):'
559 # without having to type the filename.
550 # without having to type the filename.
560 if not self.rej:
551 if not self.rej:
561 return
552 return
562 self.backend.writerej(self.fname, len(self.rej), self.hunks,
553 base = os.path.basename(self.fname)
563 self.makerejlines(self.fname))
554 lines = ["--- %s\n+++ %s\n" % (base, base)]
555 for x in self.rej:
556 for l in x.hunk:
557 lines.append(l)
558 if l[-1] != '\n':
559 lines.append("\n\ No newline at end of file\n")
560 self.backend.writerej(self.fname, len(self.rej), self.hunks, lines)
564
561
565 def apply(self, h):
562 def apply(self, h):
566 if not h.complete():
563 if not h.complete():
General Comments 0
You need to be logged in to leave comments. Login now