Announcing Hex Diff

Hey everyone! It’s my enormous pleasure to present Hex Diff, an official hex.pm service for generating web-based diffs between package versions on Hex. You can find it at https://diff.hex.pm.

Read more about it and why it’s a great tool for the community on the announcement blog post!

114 Likes

Thanks, for the great work done , I have tested on cowboy lib and it highlighted the major difference between version thanks great work !!!

4 Likes

The amount of just cool stuff the Elixir community builds is astounding. Thanks for yet another very productive feature! This will make upgrading our older dependencies a little less scary.

9 Likes

Wow, that’s great! Thanks so much for spearheading this @jola! This is a great service to have officially running :heart:

4 Likes

This is such a convenient and useful tool. Great work!

2 Likes

Wonderful work!!! Congratulations to all people who had worked on this tool! :partying_face:

1 Like

Very useful tool, thanks! Would it be possible to add some information like a total X files changed, Y lines added, Z lines removed and then +X lines, -Y lines per file?

And what about a link on hex.pm/package to the latest diff? :slight_smile:

1 Like

That’s something we can look into, don’t hesitate to make an issue on the diff repo with your ideas and examples of what it would look like!

There are links to the diffs, but they might be a bit tricky to see

If you have ideas for how to improve the UI and make the diffs easier to see, please make an issue on the hexpm repo :slight_smile:

11 Likes

I have checked it out, and for now one thing brought my attention - why fire git diff to compare two projects? Now I am thinking about writing diff algorithm in Elixir or to bring it via NIF to xdiff.

2 Likes

Using git diff was a pragmatic choice with libraries support (we use git_diff | Hex to parse hunks to provide better user experience).

I think a pure Elixir solution would be interesting and in fact that could be a great default for another tool: mix hex.package diff (we couldn’t use a NIF there)

3 Likes

xdiff is library used by Git, so there should be no difference. By the way, do you use regular algorithm or patience? Patience one should give slightly better results while being slightly more computationally expensive (but caching should made it neglible difference).

I will try to write something like that in some spare time.

4 Likes

You can see the exact command run here https://github.com/hexpm/diff/blob/master/lib/diff/hex/hex.ex#L94-L102

A solution that doesn’t require shelling out to git is absolutely welcome!

2 Likes

Yeah, I have seen that. PR is ready.

2 Likes

I have spotted that Elixir already provides functionality that I wanted to implement - List.myers_difference/2, however I would need to dig more if there is space for optimisations, I am still learning the Myer’s algorithm.

@jola you can see that one and see how much performance difference is there between calling external Git command vs using above function on in-memory data. If there is noticeable difference that cannot be solved by caching then I can try to implement NIF for Git’s xdiff library.

Just read it today, hex diff seems nice!

however i am confused on .DS_Store. while trying hex diff on Ecto 3.3.1 to 3.3.2 (ecto 3.3.1..3.3.2 | hexdiff), .DS_Store file (mac related?) is included on the change. But when i try to see github repo for 3.3.2 (ecto/lib/mix/tasks at v3.3.2 · elixir-ecto/ecto · GitHub) i could not find .DS_Store file.

Github and hex are completely unrelated. Files are directly uploaded from the maintainers computer. They might just have a .gitignore setup for .DS_Store files.

4 Likes