--- a/hgext/record.py Sun Aug 31 11:41:52 2008 +0200
+++ b/hgext/record.py Sun Aug 31 12:05:29 2008 +0200
@@ -155,6 +155,8 @@
def write(self, fp):
delta = len(self.before) + len(self.after)
+ if self.after and self.after[-1] == '\\ No newline at end of file\n':
+ delta -= 1
fromlen = delta + self.removed
tolen = delta + self.added
fp.write('@@ -%d,%d +%d,%d @@%s\n' %
@@ -206,7 +208,7 @@
if self.context:
self.before = self.context
self.context = []
- self.hunk = data
+ self.hunk = hunk
def newfile(self, hdr):
self.addcontext([])
@@ -467,9 +469,16 @@
# 3b. (apply)
if dopatch:
- ui.debug('applying patch\n')
- ui.debug(fp.getvalue())
- patch.internalpatch(fp, ui, 1, repo.root)
+ try:
+ ui.debug('applying patch\n')
+ ui.debug(fp.getvalue())
+ patch.internalpatch(fp, ui, 1, repo.root)
+ except patch.PatchError, err:
+ s = str(err)
+ if s:
+ raise util.Abort(s)
+ else:
+ raise util.Abort(_('patch failed to apply'))
del fp
# 4. We prepared working directory according to filtered patch.