Mercurial > hg
changeset 6949:834f7e069cae
record: take diff lines for lack of trailing newlines into account (issue1282)
The record extension incorrectly re-calculated the size lines for unified
diff hunks. It counted a '\\ No newline at end of file\n' line towards the
number of lines of trailing context, while it's not actually part of the
context (and certainly isn't added as a line to the resulting output).
Use the local name of a variable that was access through the nonlocal scope
while we're at it. Seeing the variable was a little bewildering.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sun, 31 Aug 2008 11:34:52 +0200 |
parents | 1b15d6e7cc3c |
children | 381a892159d9 |
files | hgext/record.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/record.py Thu Aug 21 19:02:56 2008 +0200 +++ b/hgext/record.py Sun Aug 31 11:34:52 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([])