Edgewall Software

Ticket #1054 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

incorrect file diff result in changeset view

Reported by: anonymous Owned by: cmlenz
Priority: normal Milestone: 0.8.1
Component: version control/changeset view Version: 0.8
Severity: normal Keywords:
Cc:

Description (last modified by cmlenz) (diff)

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

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

Change History

Changed 4 years ago by anonymous

'-1' -> '-2'

Changed 4 years ago by anonymous

'+1' -> '+2'

Changed 4 years ago by anonymous

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

Changed 4 years ago by anonymous

diff of Diff.py to fix the bug

Changed 4 years ago by anonymous

re-attach the diff from svn repository

Changed 4 years ago by cmlenz

  • owner changed from jonas to cmlenz
  • status changed from new to assigned
  • description modified (diff)
  • milestone set to 0.8.1

Changed 4 years ago by cboos@…

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: 

Changed 4 years ago by cmlenz

  • status changed from assigned to closed
  • resolution set to fixed

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.

Add/Change #1054 (incorrect file diff result in changeset view)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cmlenz. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.