-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve diff implementation #364
Comments
@leobalter now that we've got the modules split, we could just try to drop in jsdiff and see what happens. |
I'm thinking about how is the best way to bring jsdiff code, maybe as a npm dependecy and using its dist file in the build process or as a git submodule or anything else. anyway, I'll work on this patch. |
Using https://github.com/kpdecker/jsdif Closes qunitjs#364 Tests: --- Breaking tests to show diff
@jzaefferer: I tried to use kpdecker/jsdiff without much success. See: https://github.com/leobalter/qunit/tree/jsdiff There are a lot of things that doesn't make me feel comfortable with this patch (and that's why I am not requesting a merge yet), I'll try to list some here.
There are other arguments that I will still check if I am wrong or not but I would like to first try other solutions. Btw, I would like to see a repository of the actual QUnit.diff we are using, maybe that should be kept by the jQuery foundation or even by @jeresig himself, as he is the author. |
I've started reading jsdifflib code to implement it and I got a question: is jQuery Foundation compatible with their kind of license? Ref: https://github.com/cemerick/jsdifflib/blob/master/difflib.js#L1-L30 |
I tried to implement jsdifflib on https://github.com/leobalter/qunit/tree/364-jsdifflib but is far from perfect yet. |
The cemerick/jsdifflib I used in the VisualEditor test suite works, but has problematic rendering. Its css selectors conflict with QUnit. And because its output is inside the list item and table cell of QUnit, css rules of QUnit also wrongly apply to the table cells of the diff rendering. The result is a mess for anything other than short and simple values. |
Regarding the license: Its under BSD, which should be fine for us. @scottgonzalez can you confirm that? |
We can probably include Simplified BSD since it's almost the same as MIT, but this uses Modified BSD which contains the no-endorsement clause. We'll need to talk to @joelgkinney about it. |
@jzaefferer @leobalter Hey, I want to work on this for GSoC 15. Can u help me get started?? |
I would like to contribute ! Can someone get me started ? |
There some parts of the current diff tool that we would like to enhance. We can improve its code or use another external tool, if it doesn't bring more problems to deal with. We can look at the following issues to see specific points to lead the way to improve it:
|
I thought of starting with #335 It´s a great idea to use the length factor to determine whether the diff is valid or not ! Changing the head.js to check the length condition at first would help this ryt ? |
As I wrote in #335, comparing the length isn't as easy as it seems.
I'm not sure what Anyway, I think in this case it would be good to start with a few diff test cases that show the potential for improvements. A group of actual/expected values that currently end up with more or less useless diffs. |
Gsoc 2015 - QUnit - Better diff output I am interested in this and I am trying to understand the code any help would be great |
@leobalter @jzaefferer Hey, How does the following look? This is using google's diff-patch-match with some additional changes done by me. Currently its supported for strings, but we can add it for array objects as well. |
The diff should work not only for strings, but for dumped object representations. See our QUnit.dump to check how it shows arrays, functions, objects, etc. I can't say how good the diff looks from 2 strings only, it needs more information. |
@asped08, if you write a failing assertion, (like |
I just thought that we could deal with #348 first since it seems to be little less complicated |
Just wanted to know that what are the issues in using |
Just a heads-up. I have been using jsdifflib, as it looked to be the best option, months ago (not sure why I skipped prettydiff ..probably seemed like too much at the time). Prettydiff was originally developed from jsdifflib and has been developed quite a bit further. The only feature of prettydiff that I'm interested in is character-diffs. Cheers. P.S. These 'diff' modules really should keep their diff code separate, ideally in a separate module. I'm tempted to fork.. |
On the list above, only #363 is still open, and we have a WIP PR for that. I don't think we need this meta ticket anymore. |
@garan, I recently finish a diff implementation here: https://github.com/Mr21/diff.js So if you want to make a diff between two strings you can do: result = diff(
"first_string".split(""),
"second_string".split("")
); |
Potential diff implementations:
Related tickets: #335, #348, #478, #363, #483
The text was updated successfully, but these errors were encountered: