comparison mercurial/patch.py @ 31715:6c80f985a13c

diff: slice over bytes to make sure conditions work normally Both of this are part of generating `hg diff` on python 3.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 26 Mar 2017 20:52:51 +0530
parents a7acda2de4b8
children 66a9faadbc83
comparison
equal deleted inserted replaced
31714:bbf7a29dcf9b 31715:6c80f985a13c
735 base = os.path.basename(self.fname) 735 base = os.path.basename(self.fname)
736 lines = ["--- %s\n+++ %s\n" % (base, base)] 736 lines = ["--- %s\n+++ %s\n" % (base, base)]
737 for x in self.rej: 737 for x in self.rej:
738 for l in x.hunk: 738 for l in x.hunk:
739 lines.append(l) 739 lines.append(l)
740 if l[-1] != '\n': 740 if l[-1:] != '\n':
741 lines.append("\n\ No newline at end of file\n") 741 lines.append("\n\ No newline at end of file\n")
742 self.backend.writerej(self.fname, len(self.rej), self.hunks, lines) 742 self.backend.writerej(self.fname, len(self.rej), self.hunks, lines)
743 743
744 def apply(self, h): 744 def apply(self, h):
745 if not h.complete(): 745 if not h.complete():