Compute a 3-way merge in Monaco Editor - diff

I'm implementing a 3-way merge (currently using OpenBSD's diff, diff3prog, ed) for a client-side LaTeX editor. I would like to make results viewable with Monaco. Is there any way to make Monaco consume an already computed diff? Alternatively, is it possible to get a diff out of Monaco (if it produced a diff with https://microsoft.github.io/monaco-editor/playground.html#creating-the-diffeditor-inline-diff-example)?
I found two related GitHub issues:
https://github.com/microsoft/monaco-editor/issues/2269
https://github.com/microsoft/monaco-editor/issues/1463
But maybe someone knows a hack around? It is quite strange if Monaco only allowed to view internally-produced diffs that have no way to materialize.

Related

VCS for Jupyter Notebooks in PyCharm

I'm wondering how to make PyCharm's VCS (i.e. Git) work with Jupyter Notebook files.
Changing even 1 loc results in 3 modifications detected during commit:
Sorry if it's a duplicate, but I haven't found anything similar.
Well, I wouldn't say that the current support of Jupyter Notebook files versioning doesn't work at all. You can see it on your own screenshot that your changes are detected.
We don't parse all of the changes to detect only the source code changes.
And even if we did, many people actually want to track the output because, for example, in data science, the results are not always reproducible and you may want to keep track of the output as well as src.
Although it can be enhanced with the implementation of the following functionality https://youtrack.jetbrains.com/issue/PY-20132 that would allow committing all of the changes, but see only changes of source code, so feel free to upvote and leave comments.
I use Pycharm Community edition. I love the way Pycharm integrates with git and its VCS shows the diffs visually. However, for jupyter notebook files, the diff is difficult to track visually. Running a cell introduces various changes.
Notebook files normally diff like text files. I use a simple method to enhance the visual quality. I created a new file type Settings>Editor>File Types for *.ipynb files. I enable matching for all types of brackets. I add few keywords,
Keyword 1:
"outputs"
"source"
Keyword 2:
"code"
"markdown"
This highlighted format shows up in the Pycharm VCS and enables us to easily locate changes in code and markdown cells and outputs. An example of this effect is shown in this screenshot. Now, we don't need to worry about changes in the execution count or meta data.

Graphical diff for darcs

I don't feel very comfortable seeing the darcs changes in plain text format, so I've been looking for a tool to display a nice side-by-side comparison of the changes.
For the whatsnew I can just use meld, but when I need see the changes already recorded it does not work as easily. I've read that diffuse allows to compare different revisions, but I cannot get it to work.
I've tried
diffuse -r HEAD^1 -r HEAD^2 myfile.py
but it fails (I think that revision naming is specific to git), so does somebody know how to see the latest changes in darcs?
Suggestions for other tool that does the work (and does not require to set up a web server preferably) are welcome.
in fact you should write something like:
darcs diff --diff-command="diffuse %1 %2" myfile.txt
It works with ECMerge (the tool I work on), it should work seamlessly with diffuse. Darcs will call diffuse with temporary files as necessary (to compare the files from the repository). By the way, ECMerge can dig in Darcs configurations with its browser UI.
EDITED:
to diff tags or patches in the repository, use --from-tag= or --from-patch= and --to-tag= or --to-patch= notation. You should be able to do what you want, however note that from-patch means "from before patch" and --to-patch means "up to after patch". it was not really obvious for me...
(to know the last of changes use darcs changes)
I do not know how to integrate with darcs, but KDiff3 is a wonderful graphical diff/merge application available both for linux, macos and windows.

Editor with inline SVN diff support (like in Netbeans)?

I'm trying to abandon Netbeans as my primary code editor. One thing I like about Netbeans is how it displays file changes - see screenshot. The colored bars give the same information as svn diff. Hovering on these bars gives the option to see the diff or revert this particular change (vs. the whole file).
What other OS X editors/IDEs have a similar feature?
Bonus question: does this feature have a particular name?
UPDATE for someone finding this question later:
With the help of phatfingers's answer, I did some further research myself to find out that Netbeans and Eclipse+Subclipse seem to be the only options offering what I was looking for.
Eclipse seems to call this Quick Diff. There's a preference to diff the current version against Pristine SVN Copy.
For the record, I'm moving to some other editor anyway. Subclipse is (still) horrible to configure on OS X, and Eclipse seems quite bloated for my purposes. Also, Eclipse's Quick Diff is no match for what is in Netbeans. Netbeans colors the diff blocks in the gutter quite more clearly, and you can revert each individual change with a click.
Although many editors provide "non-quick" svn diffs, I'll probably handle my svn diffing on the command line, with eg. svn diff | grcat conf.diff.
Or maybe I'll write a plugin for some other editor. :)
UPDATE 2: I wrote a quickdiff plugin to Komodo Edit / Komodo IDE.
The Eclipse IDE with the Subclipse plugin does a nice job of that, showing you which files changed, allowing you to compare prior versions to see changes over time, detecting which changes involve conflicts, and providing visual tools that allow you to hand-pick individual changes.
I think the class of application is called a "Merge Client" or more specifically a "Graphical Subversion Client" (as you mentioned SVN).
Update: Sublime Text has Vcs Gutter and Git Gutter, of which Vcs Gutter is a fork.

Diff file viewer?

I'm looking for a tool that displays diff files (generated from mercurial, in my case) in some convinient manner. For example, the way bugzilla displays diff patches. Just to be clear, I'm not looking for something that compares/merges files, I already got the diff, just want a convinient way to inspect it.
I couldn't find anything that does that (diff syntax highlighters were the closest thing I got), anyone knows of anything?
Have you tried meld? (it works only in UNIX though..)
I would look into the following Atlassian product 'FishEye' http://www.atlassian.com/software/fisheye/
This allows you a lot of control over your version control system and code views/diffs/code reporting/visualisation etc.
I really like Beyond Compare and Araxis Merge (especially Araxis).
I had the same question -- basically a good syntax highlighter for diff output. I wanted something lightweight and free.
Now I'm using sdif and cdif together.
sdif does the syntax highlighting you want
cdif does word context diffs, so that on a modified line the words that have changed are highlighted differently
As #tomahawk suggested, if you point FishEye at your Hg repository you'll be able to diff between revision of a file, and view a changeset as a diff.
If you want to look at arbitrary patch files, you could buy Atlassian's Crucible, which allows you to create a code review by uploading a patch, which you can then view as a nice diff (and comment on collaboratively, but that is probably not of interest to you). A 5 user Crucible licence costs $10.
(Disclosure: I'm a Crucible developer at Atlassian)

Extending Perforce to use a custom content diff tool for certain file extensions

I have various custom binary files stored in perforce and for many of the file types I have built a custom diff tool to show the content creators a diff of the actual changes to the file.
E.g. If the file holds simple key value pairs as a compressed binary blob the diff tool would load each version into an in memory format and generate a list of additions, deletions and edits to the file presented in a nice clean report view.
Much like the built in image diff tool in P4V i'd like to be able to use my own diff tool for certain file extensions within my depot and allow the users to use the existing P4V interface to pick revisions to diff between and examine history.
So, I am aware you can write add-ins to P4V but I can't find any documentation on it and I'd like to know if this kind of extension functionality is available in P4V and how to use it?
While investigating meta-diff from another answer I found a solution built into P4V itself. It turns out that the dialog in P4V that you use to specify your diff tool has an additional set of options to specify a different tool for different file extensions.
So it seems I don't need to write a plugin or extend p4v at all, I just need to set those properties correctly.
I don't use Perforce, but you should be able to do this using meta-diff, which lets you set up different diff utilities for different file types.