[Trac-tickets] [The Trac Project] #2090: Incorrect diff line
numbering in case of inserting at top of the file.
The Trac Project
noreply at edgewall.com
Tue Sep 20 07:13:46 CDT 2005
#2090: Incorrect diff line numbering in case of inserting at top of the file.
-----------------------------------------------+----------------------------
Reporter: Shunichi Goto <gotoh at taiyo.co.jp> | Owner: jonas
Type: defect | Status: new
Priority: normal | Milestone:
Component: changeset view | Version: devel
Severity: normal | Keywords: |
-----------------------------------------------+----------------------------
There's a bug of making line number (offset) of diff by {{{hdf_diff()}}}
in case of
insertion at the top of file.
See http://projects.edgewall.com/trac/changeset/2234#file1 for example.
'equal' part should be start as line number 1 and 8.
Here's a patch.
{{{
#!diff
Index: diff.py
===================================================================
--- diff.py (revision 2259)
+++ diff.py (working copy)
@@ -115,9 +115,9 @@
nn = n + n
group = []
for tag, i1, i2, j1, j2 in opcodes:
- if tag == 'equal' and i1 == 0:
+ if tag == 'equal' and i1 == 0 and j1 == 0:
i1, j1 = max(i1, i2 - n), max(j1, j2 - n)
- if tag == 'equal' and i2 - i1 > nn:
+ elif tag == 'equal' and i2 - i1 > nn:
group.append((tag, i1, min(i2, i1 + n), j1, min(j2, j1 + n)))
yield group
group = []
}}}
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2090>
The Trac Project <http://trac.edgewall.com/>
More information about the Trac-Tickets
mailing list