4397: Invalid diff: new line is highlighted as changed

EUG

What version are you running?

I have ReviewBoard 2.5.3 installed via Bitnami installer "Review Board 2.5.4-0.exe" on Windows Server 2008 R2.

What's the URL of the page containing the problem?

http://myserver:8088/reviewboard/r/646/diff/1#0

What steps will reproduce the problem?

  1. Commit new file test.cs to SVN repository (revision/file extension 142004 in attach).
  2. Commit changed file test.cs to SVN (revision/file extension 142005 in attach).
  3. Create diff for the latest commit ("svn diff -c 142005 > diff-142005").
  4. Create review request based on prepared diff ("rbt post --diff-file diff-142005").
  5. Open created review request in diff tab.

What is the expected output? What do you see instead?

New line with function "public byte[] Buffer(...) {...}" should be highlighted as new code block (green).
New line is highlighted as changed lines (yellow).

What operating system are you using? What browser?

Chrome & Firefox on Windows 7

Please provide any additional information below.

see source code and picture in attachment

Index: utilities/CodeReview/test.cs
===================================================================
--- utilities/CodeReview/test.cs	(revision 142004)
+++ utilities/CodeReview/test.cs	(revision 142005)
@@ -5,38 +5,44 @@
 {
     public class StreamWrapper: Stream
     {
-        private readonly Stream stream;
+        public Stream Stream { get; private set; }
 
-        private readonly Action<StreamWrapper> onDispose;
+        private readonly Action<StreamWrapper,object> onDispose;
 
-        public StreamWrapper(Stream stream, Action<StreamWrapper> onDispose)
+        public object Context { get; private set; }
+
+        public StreamWrapper(Stream stream, object context, Action<StreamWrapper,object> onDispose)
         {
-            this.stream = stream; this.onDispose = onDispose;
+            Context = context; Stream = stream; this.onDispose = onDispose;
         }
 
         protected override void Dispose(bool disposing)
         {
-            
using System;
using System.IO;
namespace Storage
{
    public class StreamWrapper: Stream
    {
        private readonly Stream stream;
        private readonly Action<StreamWrapper> onDispose;
        public StreamWrapper(Stream stream, Action<StreamWrapper> onDispose)
        {
            this.stream = stream; this.onDispose = onDispose;
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing); if (disposing && onDispose != null) onDispose(this);
        }
        public override bool CanRead { get { return stream.CanRead; } }
        public override bool CanSeek { get { return stream.CanSeek; } }
        public override bool CanWrite { get { return stream.CanWrite; } }
        public override void Flush() { stream.Flush(); }
        public override long Length { get { return stream.Length; } }
        public override long Position { get { return stream.Position; } set { stream.Positio
using System;
using System.IO;
namespace Storage
{
    public class StreamWrapper: Stream
    {
        public Stream Stream { get; private set; }
        private readonly Action<StreamWrapper,object> onDispose;
        public object Context { get; private set; }
        public StreamWrapper(Stream stream, object context, Action<StreamWrapper,object> onDispose)
        {
            Context = context; Stream = stream; this.onDispose = onDispose;
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing); Exception error = null;
            if (disposing && onDispose != null) try { onDispose(this, Context); } catch (Exception e) { error = e; }
            Stream.Dispose(); if (error != null) throw error;
        }
        public override bool CanRead { get { return Stream.CanRead; } }
        public override bool CanSeek { get { return Stream.CanSeek; } }
        public override bool CanWrite { 
david
#1 david

This is a subtle consequence of the way that the Myers diff algorithm works, and while it's perhaps less than ideal, this looks like a particularly pathological case. I doubt there's anything we can do to the existing algorithm to improve this without causing other regressions.

  • -New
    +NotABug