Edgewall Software
Modify

Opened 20 years ago

Closed 20 years ago

#1054 closed defect (fixed)

incorrect file diff result in changeset view

Reported by: anonymous Owned by: Christopher Lenz
Priority: normal Milestone: 0.8.1
Component: version control/changeset view Version: 0.8
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christopher Lenz)

Look at screenshots.

first one: I modified the line #2 from '-1' to '-2'.

second one: I modified the line #2 from '+1' to '+2'.

Attachments (4)

1.jpg (62.3 KB ) - added by anonymous 20 years ago.
'-1' → '-2'
2.jpg (63.5 KB ) - added by anonymous 20 years ago.
'+1' → '+2'
Diff.py.diff (2.7 KB ) - added by anonymous 20 years ago.
diff of Diff.py to fix the bug
Diff.py.2.diff (2.7 KB ) - added by anonymous 20 years ago.
re-attach the diff from svn repository

Download all attachments as: .zip

Change History (8)

by anonymous, 20 years ago

Attachment: 1.jpg added

'-1' → '-2'

by anonymous, 20 years ago

Attachment: 2.jpg added

'+1' → '+2'

comment:1 by anonymous, 20 years ago

I attach a diff of Diff.py. Please review.

by anonymous, 20 years ago

Attachment: Diff.py.diff added

diff of Diff.py to fix the bug

by anonymous, 20 years ago

Attachment: Diff.py.2.diff added

re-attach the diff from svn repository

comment:2 by Christopher Lenz, 20 years ago

Description: modified (diff)
Milestone: 0.8.1
Owner: changed from Jonas Borgström to Christopher Lenz
Status: newassigned

comment:3 by cboos@…, 20 years ago

Argh, I didn't see the patch before doing my own fix. Bah, just for fun then…

  • trac/Diff.py

    === trac/Diff.py
    ==================================================================
     
    3939        self.blockno = 0
    4040        self.offset_base = 0
    4141        self.offset_changed = 0
     42        self.blocklen = 0
    4243
    4344    def _escape(self, text):
    4445        return space_re.sub(lambda m:
     
    9192        self.blockno += 1
    9293
    9394    def writeline(self, text):
    94         if text[0:2] in ['++', '--']:
     95        if self.blocklen <= 0: # we're in the header
     96            match = line_re.search(text)
     97            if match:
     98                self.print_block()
     99                self.changeno += 1
     100                self.blockno = 0
     101                self.offset_base = int(match.group(1)) - 1
     102                self.offset_changed = int(match.group(3)) - 1
     103                self.blocklen = int(match.group(2)) + int(match.group(4))
    95104            return
    96         match = line_re.search(text)
    97         if match:
    98             self.print_block()
    99             self.changeno += 1
    100             self.blockno = 0
    101             self.offset_base = int(match.group(1)) - 1
    102             self.offset_changed = int(match.group(3)) - 1
    103             return
    104105        ttype = text[0]
    105106        text = text[1:]
    106107        text = text.expandtabs(self.tabwidth)
     108        if ttype == ' ':
     109            self.blocklen -= 2
     110        else:
     111            self.blocklen -= 1
    107112        if ttype == self.ttype:
    108113            self.block.append(text)
    109114        else:

comment:4 by Christopher Lenz, 20 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [1132], ported to stable in [1133].

Thanks for the patches. Even though I ended up using a somewhat simpler approach, the patches did help demonstrate what needed to be fixed.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.