[Trac-tickets] Re: [The Trac Project] #1985: diff processor displays wrong line number (+1)

The Trac Project noreply at edgewall.com
Tue Sep 6 05:31:08 CDT 2005


#1985: diff processor displays wrong line number (+1)
-----------------------------------------------+----------------------------
 Reporter:  Shunichi Goto <gotoh at taiyo.co.jp>  |        Owner:  jonas
     Type:  defect                             |       Status:  new  
 Priority:  normal                             |    Milestone:       
Component:  wiki                               |      Version:  devel
 Severity:  normal                             |   Resolution:       
 Keywords:                                     |  
-----------------------------------------------+----------------------------
Comment (by Shunichi Goto <gotoh at taiyo.co.jp>):

 This is due to bug of {{{PatchRenderer._diff_to_hdf()}}} caused by the
 difference of 'line number' (1 base) and 'offset number' (0 base).
 Here is a patch:
 {{{
 #!diff
 Index: patch.py
 ===================================================================
 --- patch.py    (revision 2200)
 +++ patch.py    (working copy)
 @@ -151,8 +151,8 @@
              if (command == ' ') != last_type:
                  last_type = command == ' '
                  blocks.append({'type': last_type and 'unmod' or 'mod',
 -                               'base.offset': fromline, 'base.lines': [],
 -                               'changed.offset': toline,'changed.lines':
 []})
 +                               'base.offset': fromline-1, 'base.lines':
 [],
 +                               'changed.offset':
 toline-1,'changed.lines': []})
              if command == ' ':
                  blocks[-1]['changed.lines'].append(line)
                  blocks[-1]['base.lines'].append(line)
 }}}

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/1985>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list