diffparser icon indicating copy to clipboard operation
diffparser copied to clipboard

Parsing SVN Diff skips one class

Open javydreamercsw opened this issue 7 years ago • 2 comments

I have a svn diff where parsing seems to miss the start of the second class.

Index: MyClass1.java

--- MyClass1.java (nonexistent) +++ MyClass1.java (working copy) @@ -0,0 +1,30 @@ +/*

    • Copyright 2018 XXX
    • All Rights Reserved
  • */

+package com.xxx; + +/**

  • */ +public class MyClass1 +{
  • @Override
  • public boolean equals(Object obj)
  • {
  • return super.equals(obj);
  • }
  • @Override
  • public int hashCode()
  • {
  • return super.hashCode();
  • }
  • @Override
  • public String toString()
  • {
  • return super.toString();
  • } +} Index: MyClass2.java =================================================================== --- MyClass2.java (nonexistent) +++ MyClass2.java (working copy) @@ -0,0 +1,30 @@ +/*
    • Copyright 2018 xxx
    • All Rights Reserved
  • */

+package com.xxx; + +/**

  • */ +public class MyClass2 +{
  • @Override
  • public boolean equals(Object obj)
  • {
  • return super.equals(obj);
  • }
  • @Override
  • public int hashCode()
  • {
  • return super.hashCode();
  • }
  • @Override
  • public String toString()
  • {
  • return super.toString();
  • } +}

When parsed the first hunk ends on the line:

+++ MyClass2.java (working copy)

Instead of the Index one.

javydreamercsw avatar Sep 04 '18 17:09 javydreamercsw

MyClass2 is not returned from the parser.

javydreamercsw avatar Sep 04 '18 17:09 javydreamercsw

Looks to be related to this assumption:

/** * The parser is in this state if it is currently parsing a line that is the delimiter between two Diffs. This line is always a new * line. */ END { @Override public ParserState nextState(ParseWindow window) { String line = window.getFocusLine(); logTransition(line, END, INITIAL); return INITIAL; }

In this case there's no end line between Diffs.

javydreamercsw avatar Sep 04 '18 18:09 javydreamercsw