Code Monkey home page Code Monkey logo

java-diff-utils's People

Contributors

dnaumenko avatar simonmit avatar

java-diff-utils's Issues

ant build file

Since I did not find an ant build file in this project I have created one.
Please use/enhance it if you will.

Cheers.
Zoltan

Original issue reported on code.google.com by [email protected] on 22 Feb 2010 at 9:28

Attachments:

Patch for /trunk/src/difflib/DiffUtils.java

There is less overhead to use Integer.valueOf, rather than instantiating a new 
Integer object.

It can result in performance improvements: 
http://tech.puredanger.com/2007/02/01/valueof/

Original issue reported on code.google.com by madshansen3 on 27 Feb 2011 at 1:48

Attachments:

ArrayIndexOutOfBoundsException when both original and revision List is empty

What steps will reproduce the problem?
1. Call DiffUtils.diff(new ArrayList<String>(), new ArrayList<String>())
2. java.lang.ArrayIndexOutOfBoundsException: 3
3.

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


What version of the product are you using? On what operating system?
1.2

Please provide any additional information below.
Full stacktrace:
java.lang.ArrayIndexOutOfBoundsException: 3
    at difflib.myers.MyersDiff.buildPath(MyersDiff.java:140)
    at difflib.myers.MyersDiff.diff(MyersDiff.java:106)
    at difflib.myers.MyersDiff.diff(MyersDiff.java:94)
    at difflib.DiffUtils.diff(DiffUtils.java:58)
    at difflib.DiffUtils.diff(DiffUtils.java:46)


Original issue reported on code.google.com by [email protected] on 5 Oct 2010 at 5:08

its not working?

Hi guys
I am sorry, but I have no idea whats going wrong. the same code has worked 
elsewhere, and is continuing to work. and I have no idea why THIS code is going 
wrong. Granted im using groovy, but that shouldn't be an issue.

https://gist.github.com/AbrarSyed/5719269

ive exhausted every other avenue.. no nooby mistakes have been found... that 
leaves the fact that it could be an issue on your side.

using diffUtils version 1.2 from maven central.

Original issue reported on code.google.com by [email protected] on 6 Jun 2013 at 4:43

Added lines directly after deleted lines don't show

I've found, by chance, that when you do a diff where the modified file adds 
lines right after deleted lines, the additions don't show in the diff. If the 
additions are elsewhere they will show. The two attached files show this 
discrepancy. I used the Chunk.java class from the source.

I removed lines 65-71, and added the following at line 65:
    //add a new line here
I also removed lines 113-117, and added the same line at 113 (which is now 107 
in the modified file).

Also note that I deleted lines starting at 65 and 113, not 64 and 112 as is 
reported by the diff algorithm.

I used the code below, which is a modified version of "Task 1: Compute the 
difference between to files and print its deltas" 

I can only assume this is an issue with the implementation of the MyersDiff 
algorithm (MyersDiff.java) as my program just follows the basic test. 

Any ideas? I'm looking at the MyersDiff.java code, but it looks like I may need 
to read up on the Algorithm first.

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

import difflib.Chunk;
import difflib.Delta;
import difflib.DiffUtils;
import difflib.InsertDelta;
import difflib.Patch;

public class DiffTest1 {

    // Helper method for get the file content
    private static List<String> fileToLines(String filename) {
            List<String> lines = new LinkedList<String>();
            String line = "";
            try {
                    BufferedReader in = new BufferedReader(new FileReader(filename));
                    while ((line = in.readLine()) != null) {
                            lines.add(line);
                    }
            } catch (IOException e) {
                    e.printStackTrace();
            }
            return lines;
    }

    public static void main(String[] args) {
            List<String> original = fileToLines("Chunk1.java");
            List<String> revised  = fileToLines("Chunk2.java");

            // Compute diff. Get the Patch object. Patch is the container for computed deltas.
            Patch patch = DiffUtils.diff(original, revised);
            for (Delta delta: patch.getDeltas()) {
                System.out.println(delta);
            }

            //print out a detailed list of changes
            try {
                for (Delta delta: patch.getDeltas()) {
                    if(delta instanceof InsertDelta){
                        System.out.println("(+ at " + delta.getOriginal().getPosition() + ")");
                        Chunk ck = delta.getRevised();

                        for(String sl: (List<String>)ck.getLines()){
                            System.out.println(sl);
                        }

                    }else{
                        System.out.println("(- at " + delta.getOriginal().getPosition() + ")");
                        Chunk ck = delta.getOriginal();

                        for(String sl: (List<String>)ck.getLines()){
                            System.out.println(sl);
                        }
                    }
                }

            } catch (Exception e) {
                e.printStackTrace();
            }


    }


}

Original issue reported on code.google.com by [email protected] on 13 Apr 2011 at 4:40

Attachments:

patch delta inconsistency on a 1-character insert

What steps will reproduce the problem?
1. see attached test.java
2. enable 1 set of add statements and disable the other, run it
3. enable the other set of adds and disable the ones used in 2., and run it

What is the expected output? What do you see instead?
the only change between the orig. and revised strings is the addition of 1 
character in revised.
one set of adds generates a patch with a single ChangeDelta. the other set of 
adds generate a patch with an InsertDelta on Pos. 1 and a DeleteDelta on Pos. 
2. I assume Position = line #.

What version of the product are you using? On what operating system?
1.2.1

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 27 Feb 2012 at 10:45

Attachments:

Cannot open JAR "diffutils-1.2.1.jar"

What steps will reproduce the problem?
1. Open JAR "diffutils-1.2.1.jar".

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


>java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

>java -jar diffutils-1.2.1.jar
Exception in thread "main" java.lang.NullPointerException
        at sun.launcher.LauncherHelper.getMainClassFromJar(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

>

---------------------------
Java Virtual Machine Launcher
---------------------------
A Java Exception has occurred.
---------------------------
OK   
---------------------------




What version of the product are you using? On what operating system?
JRE 7. Windows Vista x64.

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 5 Sep 2011 at 7:12

Producing + publishing maven artifacts

Hi there guys,

Great library, very nice APIs.

I notice there is currently no Maven artifact for the library, which would make 
it much easier for many projects to use. Is this something you'd be interested 
in pursuing? I am happy to create a POM file and possibly take up organising 
publishing to the central repository through on of the open source forges, e.g. 
Sonatype (I have set this up before on my own OSS projects). 

(Sadly I won't be able to use your tool in my current project anyway, as the 
GPL license you've chosen won't let me use it -- Apache would be much more 
business-friendly, if that's a concern of yours. However I'm still happy to 
help set up + publish repos to let you distribute this more effectively)

Original issue reported on code.google.com by [email protected] on 23 Jul 2010 at 3:33

Provide java-diff-utils as OSGi bundle

Hi,

I am planning to use the java-diff-utils in an Eclipse plugin. For easier 
integration, it would be great to have your tool available as an OSGi bundle 
(aka Eclipse plug-in). Are there any plans to provide this in the future?

Best regards,
Martin

Original issue reported on code.google.com by [email protected] on 23 Jul 2012 at 11:02

What license is java-diff-utils released under?

The project says its Apache v2.0
However 
https://code.google.com/p/java-diff-utils/source/browse/branches/1.2/src/difflib
/myers/package.html says its GNU 3.0
Can you confirm which licence takes precedence?

Thanks

Original issue reported on code.google.com by [email protected] on 15 Jan 2015 at 5:04

Delta.applyTo and Delta.restore take List<Object> which causes generics problems

The two methods:

public abstract void applyTo(List<Object> target) 
public abstract void restore(List<Object> target);

Take List<Object> as a param, whereas most other things use List<?>. the former 
doesn't allow lists of anything other that Objects (no subclasses) whereas the 
later allows anything (subclasses of Object). This makes the class pretty 
inflexible, and means everything has to be copied to an Object that treats its 
contents only as Objects.

Original issue reported on code.google.com by [email protected] on 16 Jun 2013 at 6:44

Can't locate custom brush JS

Custom brush is created using following syntax:

@Brush.Source("shBrushYaml.js")
public interface YamlBrush extends Brush { }

I place shBrushYaml.js into web roor right next to index.html. When I try to 
run mvn install I get the following error and build fails

[INFO]    Scanning for additional dependencies: 
file:/C:/teradata/sources/Quantum/client/src/main/java/teradata/quantum/
reporting/client/widgets/FileViewerTabItem.java
[INFO]       Computing all possible rebind results for 
'teradata.quantum.reporting.client.js.YamlBrush'
[INFO]          Rebinding teradata.quantum.reporting.client.js.YamlBrush
[INFO]             Invoking 
com.google.gwt.dev.javac.StandardGeneratorContext@1886920
[INFO]                [ERROR] Unable to locate Brush JavaScript file 
"shBrushYaml.js".
[INFO]    [ERROR] Errors in 
'file:/C:/teradata/sources/Quantum/client/src/main/java/teradata/quantum/reporti
ng/client/wi
dgets/FileViewerTabItem.java'
[INFO]       [ERROR] Line 53:  Failed to resolve 
'teradata.quantum.reporting.client.js.YamlBrush' via deferred binding
[INFO]    Scanning for additional dependencies: 
C:\teradata\sources\Quantum\client\target\.generated\com\alexgorbatchev\
syntaxhighlighter\client\com_alexgorbatchev_syntaxhighlighter_client_Resources_d
efault_StaticClientBundleGenerator.java

Original issue reported on code.google.com by [email protected] on 10 Nov 2010 at 11:08

Support fuzzy-patch

If the line numbers given in a unified diff do not match, the patch command 
line program will perform a fuzzy patch and try to find the lines givn in the 
context of the unified diff  near the given line numbers in the original file 
to apply the patch. This is currently not supported.

PS: This is a feature request and no defect.

Original issue reported on code.google.com by [email protected] on 14 Aug 2013 at 9:09

ArrayIndexOutOfBounds exception when the text includes a line that matches the format "@@ -2,6 +2,7 @@"

What steps will reproduce the problem?
1. Add a line as below to the revised text.
@@ -2,6 +2,7 @@
2. Generate unified diff text.
3. Now create a 'Patch' from above diff text using DiffUtils.parseUnifiedText().
4. The following will be thrown.
    Caused by: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)
    at com.difflib.textdiff.difflib.Chunk.verify(Chunk.java:92)
    at com.difflib.textdiff.difflib.ChangeDelta.verify(ChangeDelta.java:91)
    at com.difflib.textdiff.difflib.ChangeDelta.applyTo(ChangeDelta.java:41)
    at com.difflib.textdiff.difflib.Patch.applyTo(Patch.java:47)
    at com.difflib.textdiff.TextDiffGenerator.applyDiff(TextDiffGenerator.java:113)
    ... 23 more


Attached the updated file DiffUtils.java with a fix.    A flag to prevent the 
processing of header line after the first time seems to fix the issue.


Original issue reported on code.google.com by [email protected] on 5 Jun 2011 at 10:10

Attachments:

Diff misses change

Try these:

Lst<String> original = Arrays.asList("line1", "line2", "line3");
List<String> revised = Arrays.asList("line1", "line2-2", "line4");

Patch patch = DiffUtils.diff(original, revised);

position 1 shows as changed, but that is the only delta produced.

Original issue reported on code.google.com by [email protected] on 30 Sep 2013 at 9:32

ChangedDelta doesn't create informal output.

What steps will reproduce the problem?
1. Create two string list, which has a difference in line content.
2. Run against the DiffUtils.diff function
3. Print out the results as suggested in the examples using:
for(Delta delta : patch.getDeltas()){
 System.out.println(delta); //delta is an instance of Delta
}

What is the expected output? What do you see instead?
Here is the output for one comparison:
difflib.ChangeDelta@311dc402
[DeleteDelta, position: 80, lines: [! U1 X 340]]
[InsertDelta, position: 83, lines: [______________extra_______]]
difflib.ChangeDelta@91d50064

As you can see the two text, has 4 difference. One insert one delete and two 
change. The ChangeDelta.toString() is probably not overridden.


What version of the product are you using? On what operating system?
Probably you are only interested in the version: 1.2


Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 6 Aug 2010 at 1:37

Change line has wrong diff indicators

What steps will reproduce the problem?

This JUnit test fails on the 2nd assert:

    public final void testGenerateDiffRowsListOfStringListOfStringChange1() {

        DiffRowGenerator generator = new DiffRowGenerator.Builder().showInlineDiffs(true).ignoreWhiteSpaces(true)
                .columnWidth(100).build();

        List<String> revised = new ArrayList<String>();
        List<String> original = new ArrayList<String>();

        original.add("aaaaa");
        revised.add("aabaa");

        List<DiffRow> result = generator.generateDiffRows(original, revised);

        assertEquals("wrong size", 1, result.size());

        assertEquals("wrong tag", DiffRow.Tag.CHANGE, result.get(0).getTag());
        assertEquals("wrong new value", "aa<span class=\"editNewInline\">b</span>aa", result.get(0).getNewLine());
        assertEquals("wrong old value", "aa<span class=\"editOldInline\">a</span>aa", result.get(0).getOldLine());
    }

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

junit.framework.ComparisonFailure: wrong old value expected:<aa[<span 
class="editOldInline">a</span>aa]> but was:<aa[aa<span 
class="editOldInline">a</span>]>
    at junit.framework.Assert.assertEquals(Assert.java:81)

Note that the difference for the "old" line indicates the changed part is the 
last "a" and not the middle "a" where it should be.

What version of the product are you using? On what operating system?

Downloaded this file: java-diff-utils-1.2src.zip
Windows XP

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 2 May 2011 at 2:31

Attachments:

ArrayIndexOutOfBoundsException in DiffUtils.generateUnifiedDiff

What steps will reproduce the problem?
public class testGenerateUnifiedDiffWithZeroDiffs extends TestCase {
    String myContent = "abc";

    public void testDiffRowGenerator() {
        Patch patch = DiffUtils.diff(myContent, myContent);
                DiffUtils.generateUnifiedDiff("myContent.txt", "myContent.txt", myContent, patch, 0));
    }
}

What is the expected output? What do you see instead?
I would expect to see no diffs. Instead I see an ArrayIndexOutOfBoundsException.

What version of the product are you using? On what operating system?
Version 1.2 on Windows XP

Please provide any additional information below.
The issue is with this line:
    Delta delta = patchDeltas.get(0);
which tries to get the first delta without testing to see if there are are any 
deltas.

Original issue reported on code.google.com by [email protected] on 18 Feb 2011 at 6:40

Failed to create unified diff for a one-string file

see attached files: for these files the following test fails

    public void testDiff_Issue11() throws Exception {
        final List<String> lines1 = fileToLines("test" + FS + "mocks" + FS + "issue11_1.txt");
        final List<String> lines2 = fileToLines("test" + FS + "mocks" + FS + "issue11_2.txt");


        final Patch patch = DiffUtils.diff(lines1, lines2);
        final String fileName = "xxx";
        final List<String> stringList = DiffUtils.generateUnifiedDiff(fileName, fileName, lines1, patch, 3);
        final Patch x = DiffUtils.parseUnifiedDiff(stringList);
        DiffUtils.patch(lines1, x);
    }

Original issue reported on code.google.com by [email protected] on 9 Dec 2010 at 5:37

Attachments:

Delta isn't working for the collection bellow

I Have 2 Collections (original and revised) with 53 and 1 elements each.

The collection.toString() content is reproduced bellow.

original: [<p>Esta &eacute; uma obra Online.</p>, <p>&nbsp;</p>,
<p><strong>Este texto &eacute; negrito</strong></p>, <p><em>Este texto
&eacute; it&aacute;lico</em></p>, <p><span style="text-decoration:
underline;">Este texto est&aacute; sublinhado</span></p>, <p><span
style="text-decoration: line-through;">Este texto est&aacute;
riscado</span></p>, <p style="text-align: center;">Este texto est&aacute;
centralizado</p>, <p style="text-align: right;">Este texto est&aacute;
alinhado a direita</p>, <ol>, <li>Este texto est&aacute; em uma lista
num&eacute;rica<ol>, <li>Este texto est&aacute; identado</li>, </ol></li>,
</ol>, <p><a title="uol" href="http://www.uol.com.br" target="_blank">Este
aqui &eacute; um link</a></p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>,
<p>&nbsp;</p>, <p>P&aacute;gina 1</p>, <p>&nbsp;</p>, <p>&nbsp;</p>,
<p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>,
<p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>,
<p>P&aacute;gina 2</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>,
<p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>,
<p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>,
<p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>, <p>&nbsp;</p>,
<p>&nbsp;</p>, <p>P&aacute;gina 3</p>, <p>&nbsp;</p>]

revised: [<p>Revis&atilde;o 3</p><p>&nbsp;</p><p>Esta &eacute; uma obra
Online.</p><p>&nbsp;</p><p><strong>Este texto &eacute;
negrit</strong></p><p>Este texto &eacute; it&aacute;lico/p><p><span
style="text-decoration: undeline;">Este texto est&aacute;
sublinhado</span></p><p>Este texto est&aacute; riscado agora n&atilde;o
est&aacute; mais</p>p style="text-align: left;">Este texto est&aacute;
centralizado nem este</p><p style="text-align: right;">Este texto
est&aacute; alinhado a direita</p><ol><li>Este texto est&aacute; em uma
lista num&eacute;rica</li></ol><p><a title="uol"
href="http://www.uol.com.br" target="_blank">Este aqui &eacute; um
link</a></p>]

DiffUtils shows only 1 Delta for line 1. It does not show other 52 changes.

I am using 1.1 version.

Congrats for the job

Original issue reported on code.google.com by rafabene on 7 Oct 2009 at 6:33

Please include a LICENSE file in the source tree

Including a LICENSE file makes it easier for downstream packagers and other 
users to ensure that they are using the software in a manner consistent with 
its license.  Please include the Apache license in the source tree and in 
source distributions:  http://www.apache.org/licenses/LICENSE-2.0 

Original issue reported on code.google.com by [email protected] on 21 Oct 2013 at 3:36

Diff algorithm hangs in infinite loop on pathological data

While using this diff lib on a very large collection of files, I encountered a 
pair of files that caused the diff algorithm to hang. I attach this 
pathological data, after sanitizing it.

What steps will reproduce the problem?
1. Read files ta and tb as lists of lines of text
2. Run DiffUtils.diff on these lists
3. Program does not terminate while Unix diff does.

What is the expected output? What do you see instead?
I did not get any output - program hangs.

What version of the product are you using? On what operating system?
diffutils-1.2.1, Java 1.7 on Windows 7.

Please provide any additional information below.
Problematic sample attached.

Original issue reported on code.google.com by [email protected] on 13 Mar 2013 at 12:41

Attachments:

JDK 1.5 compatibility

Because I needed the JDK 1.5 compatibility for this otherwise great lib, I
have changed the MyersDiff.java which uses the Arrays.copyOfRange() method
which exists only in JDK 1.6. 
I am attaching the patch for this change. I would prefer to keep the lib
JDK 1.5 compatibility if possible. The current jar file available under
downloads should be recompiled for this too.

Thanks,
Zoltan

Original issue reported on code.google.com by [email protected] on 22 Feb 2010 at 9:35

Attachments:

Source code headers refer the GPL license.

All source files contain references to the GPL license. At the same time the 
main project page says that the code is under the ASL v2.0. 

I hope that the source is really under ASL and not GPL :-)

Original issue reported on code.google.com by [email protected] on 22 Sep 2010 at 8:50

ArrayIndexOutOfBoundException in DiffRowGenerator when the inline-diffs is used

This test case reproduces the problem, which is caused by the inline-diff 
calculations. If the "showInlineDiffs" is set to false, then the problem does 
not appear.



public class DiffUtilsDiffRendererTest extends TestCase {

    String first = "anything \n \nother";
    String second ="anything\n\nother";


    public void testDiffRowGenerator() {
        DiffRowGenerator generator = new DiffRowGenerator.Builder()
        .showInlineDiffs(true)
        .ignoreWhiteSpaces(true)
        .ignoreBlankLines(true)
        .columnWidth(Integer.MAX_VALUE) // do not wrap
        .build();
        List<DiffRow> diffRows = generator.generateDiffRows(split(first), split(second));
    }

    private List<String> split(String content) {
        return Arrays.asList(content.split("\n"));
    }


}


Original issue reported on code.google.com by [email protected] on 13 Oct 2010 at 9:11

IndexOutOfBoundsException for seemingly correct patch

Pls see attached files: I have a Patcher java which I use to apply a sequence 
of patches to the source code and I have a PatcherTest that fails with the 
following stack trace:

java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)
    at difflib.Chunk.verify(Chunk.java:85)
    at difflib.ChangeDelta.verify(ChangeDelta.java:78)
    at difflib.ChangeDelta.applyTo(ChangeDelta.java:44)
    at difflib.Patch.applyTo(Patch.java:43)
    at difflib.DiffUtils.patch(DiffUtils.java:70)
    at com.klocwork.bonobo.Patcher.patch(Patcher.java:31)
    at com.klocwork.bonobo.PatcherTest.test(PatcherTest.java:17)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)

Original issue reported on code.google.com by [email protected] on 10 Nov 2010 at 4:31

Attachments:

Add type information to the interface

Hi!

This is not an issue and sorry if I suggest something stupid, but I was 
wondering can you improve the usability of the diff tools, by introducing some 
type information about the Delta.

So instead of looking after the types, with the instanceof operator, I can get 
the type of the change by retrieving an enum.

E.g.:
Delta delta = patch.getDeltas().get(0);
if(Delta.TYPE.Delete.equals(delta.getType());

Than you can make the change deltas package-private for cleanable API.

Just an idea.

David

Original issue reported on code.google.com by [email protected] on 6 Aug 2010 at 1:43

Parsing add-only parts of unified diffs generated by "diff -U 0 ..." fails

What steps will reproduce the problem?
1. Create patch:
   diff -U 0 uc_original.txt uc_insert_revised.txt > uc_insert_patch.txt
2. Copy *.txt files to test/mocks and EmptyContextUnifiedDiffTest.java to 
diffutils/
3. Run JUnit on EmptyContextUnifiedDiffTest

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

testUnifiedContextInsert shouldn't fail.

What version of the product are you using? On what operating system?
diffutils-1.2.1.jar
diff (GNU diffutils) 3.0
Ubuntu 10.10

I have included a patch to fix this issue.


Original issue reported on code.google.com by [email protected] on 15 Jun 2011 at 8:40

Attachments:

return diff position start from 0?

What steps will reproduce the problem?
Run sample code (BasicJavaApp_Task1) of 
http://code.google.com/p/java-diff-utils/wiki/SampleUsage

What is the expected output? 
The position should start from 1.
What do you see instead?
The position should start from 0.

What version of the product are you using? On what operating system?
1.2.1 & windows 7 Enterprise

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 16 May 2012 at 1:38

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.