Keep post-review form eating lines starting with "--" beeing removed.

Review Request #624 — Created Nov. 9, 2008 and discarded

Information

Review Board SVN (deprecated)

Reviewers

If you remove a line starting with "--" from a file thediff will start with "---". In the current incarnation on svn post-review discards ALL lines starting with --- from the diff file.

To avoid that, one needs to implement a state machine for basic diff file parsing. This patch does not contain such a beast but greatly reduces the risk of accidently removing lines by considering three consecutive lines.

I originally wanted to match using regular expressions but I'n not sure which characters are alowed in subversion pathnames and so I didn't know how to exactly craft a regular expression for that.

See also http://groups.google.com/group/reviewboard/browse_thread/thread/cb96afc6064bbf7b#

Seems I'm unable to produce a diff this webinterface accepts o_O. The patch is at http://c0re.23.nu/c0de/misc/reviewboard-r1569_post-review_transparent--upload.patch
I tested it with problematic changesets and it worked. I did no deeper testing regarding the renaming issue which was meant to be handled by the code I changed since I not fully understood under which circumstences that issues could happen.
chipx86
  1. 
      
  2. Please insert these alphabetically.
  3. Is this needed for the change?
  4. /trunk/reviewboard/contrib/tools/post-review (Diff revision 2)
     
     
     
     
    Blank line before the for loop.
  5. /trunk/reviewboard/contrib/tools/post-review (Diff revision 2)
     
     
     
     
     
     
    I think what I'd rather see is to have a flag saying if we're in the header, and then if we see "Index: " set the flag. If we see "--- " and the flag is set, set from_line to that. If we see "+++" unset the flag. Should clean up the code and prevent this sort of thing.
  6. Make sure there's no trailing whitespace here.
  7. 
      
Loading...