Modify ↓
Opened 19 years ago
Closed 19 years ago
#2090 closed defect (fixed)
Incorrect diff line numbering in case of inserting at top of the file.
Reported by: | Owned by: | Christopher Lenz | |
---|---|---|---|
Priority: | normal | Milestone: | 0.9 |
Component: | version control/changeset view | Version: | devel |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
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.py
115 115 nn = n + n 116 116 group = [] 117 117 for tag, i1, i2, j1, j2 in opcodes: 118 if tag == 'equal' and i1 == 0 :118 if tag == 'equal' and i1 == 0 and j1 == 0: 119 119 i1, j1 = max(i1, i2 - n), max(j1, j2 - n) 120 if tag == 'equal' and i2 - i1 > nn:120 elif tag == 'equal' and i2 - i1 > nn: 121 121 group.append((tag, i1, min(i2, i1 + n), j1, min(j2, j1 + n))) 122 122 yield group 123 123 group = []
Attachments (0)
Change History (2)
comment:1 by , 19 years ago
Milestone: | → 0.9 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed in [2264].
Note that the patch didn't completely solve the problem, but was a good starting point. I've added a unit test to make sure this doesn't resurface. Thanks again!
Note:
See TracTickets
for help on using tickets.
Good catch, and thanks for the patch! :-)