Modify ↓
Opened 19 years ago
Closed 19 years ago
#3725 closed defect (fixed)
unified_diff() fails when there are fewer lines than the context
| Reported by: | Owned by: | Matthew Good | |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.10.1 |
| Component: | version control | Version: | devel |
| Severity: | minor | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
>>> from trac.versioncontrol.diff import unified_diff
>>> list(unified_diff(['old'], ['new']))
Traceback (most recent call last):
File "stealtrac.py", line 122, in ?
list(unified_diff(['old'], ['new']))
File "/usr/lib/python2.4/site-packages/trac/versioncontrol/diff.py", line 217, in unified_diff
i1, i2, j1, j2 = group[0][1], group[-1][2], group[0][3], group[-1][4]
TypeError: unsubscriptable object
I have also created a unit test for this.
Attachments (1)
Change History (4)
by , 19 years ago
| Attachment: | unittest-against-bug-in-unified_diff.patch added |
|---|
comment:1 by , 19 years ago
| Milestone: | → 0.10.1 |
|---|---|
| Owner: | changed from to |
| Severity: | normal → minor |
| Summary: | Bug in diff.unified_diff() → unified_diff() fails when there are fewer lines than the context |
Ok, it appears that the error occurs when there are fewer lines to diff than the expected "context" lines surrounding the diff. This doesn't seem to impact many people, so I'll try to get this fixed for 0.10.1.
comment:2 by , 19 years ago
| Component: | general → version control |
|---|
comment:3 by , 19 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.



Add a new test suite