Mercurial > hg-stable
changeset 6951:c8c9ce0ed3ee
merge with crew-stable
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sun, 31 Aug 2008 12:05:29 +0200 |
parents | 359e93ceee3a (current diff) 381a892159d9 (diff) |
children | 3fffba1c87d0 |
files | hgext/record.py |
diffstat | 1 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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.