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

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.

Related

How to merge files(differentiate) in visual studio code

I am using Visual studio code for angular2 application. The requirement is to merge files, so, I want to differentiate changes in two files as it happens in Netbeans IDE. Is there, any extensions available to achieve the task in visual studio code.
For e.g - Merging Two files by differentiating changes like below:-
Please suggest some solution.
abc.component.ts (located in project1)
abc <-- text for understanding purpose
def
abc.component.ts ( located in project2)
abc
I want to differentiate two component files and push changes in another like it happens in Netbeans IDE? Is there, any solution available for Visual studio code?
First using vscode natively with the git toolset
(Make sure to look on the second title as it's a better native way!)
This way may be available on older version of vscode too! Still a good thing to know! (even we should always run on the latest version! And vscode is always keeping getting better and better).
A native powerful and cool way is to use the git toolset within vscode! It still not the most fluid way! But if you are in a setup where you don't have anything else or time or resources to use anything else! Also as a requirement you need to have a git repo initiated! Here we go:
First we will use the change and diffing capability of the git tool set. And the steps go as bellow:
Commit all the current changes
once done: copy past the other file to diff on the place of the current one. And save.
Cool now in the git pallet you can see the file in changes list! Click on it and the diffing editor will show!
Bingo this is it! You can compare and make direct changment! The diffing will keep happening in real time. Note the current state is in the right. And you make changement there.
Here an illustration of direct modification for instance the part in the left is missing from the current file
And here another illustration (current have in plus)
Well to sum up! Git tool and diffing in vscode is so powerful! And all that one need! The only problem is the extra step of committing and cleaning after if desired!
Here some tips! If you want to have the commit history cleaner! Or not have a merge separate! You can remove the last commits from history as much as you need: Without hard reset and commit again a cleaner one!
git reset --soft HEAD~1
You can check
How to cancel a local git commit
Otherwise it can be ok with atomic commit and merge mention!
Also if what you need is to be able to keep a lot from the current file! You can copy the current elsewhere! past the other file to compare! commit ! and then past again the old one! You'll have the old in the right and as current (Not as described on the above) In such a scenario this work well! (Hacky a bit but you may need it).
Native way (direct open of the compare editor)
(May require the newer version of vscode)
open a file that you gonna compare
open the command pallet
CTRL + SHIFT + P
type file: compare
You can see the different possible ways! For a file we can choose compare active file with.
Then you choose the file! The file need to be within the project directory.
And then you choose a file and the compare editor will open
The above was tested on my brother computer on a new vscode installation. I wasn't sure at first if it was part of the core! And i just confirmed that it is. That too remove the need to the method above involving git! And it's the best native way to go with.
Vscode extensions
Here two extensions i suggest the first:
https://marketplace.visualstudio.com/items?itemName=jinsihou.diff-tool
Easy and simple! It add two elements to the right click menu:
In current file right click -> Select as first file for diff, select one again to view the diff results
select to compare and compare with select no more simple then that !
Another extension to check:
https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-diff
I prefer the first! As this one compare a lot to the native way. And having the control in the contextual menu is just great.
Out of vscode! Using other tools
A quick google search and you'll find a lot of tools!
https://meldmerge.org/
meld merge is cross platform and open source and nice!
in linux and debian:
sudo apt install meld
Otherwise you can check the long list here:
https://www.jotform.com/blog/25-useful-document-and-file-comparison-tools/
https://stackify.com/code-merge-tools/
There is too winMerge to mention (an open source project for windows)
https://winmerge.org/

Using Eclipse with non-standard subversion directory layouts

I have a subversion repository with a layout like this:
/trunk/<projectname>
/branches/<projectname>/<branchname>
/tags/<projectname>/<tagname>
It is this way for historical reasons, which aren't really up for debate and so I won't go into here.
I'm trying to use this layout with Eclipse (Juno) using the Subversive plug in. The .project file lives in /trunk/<projectname>, and I can check out a project from trunk with no problem. However if I try to create a new branch for a project using subversive, I seem to get into trouble. Creating a branch with a path /branches/<projectname>/<branchname>, it gets transformed into a branch /branches/<projectname>/<branchname>/<projectname>.
The repository properties dialog has no visible options which allow for this layout - although the Advanced tab has fields for "Resource names" which default to as "trunk", "branches" and "tags", these evidently cannot contain a path separator without being rejected as an "invalid resource name"
I've read the documentation for Subversive. It talks about a "Repository Location project layout", and states that with this "the user is free to change this layout by any way he wish" [sic] - but it doesn't really explain how.
In short What's the correct, or most expedient way to use this layout within Eclipse?
Note, I really need a way which will appease those users uncomfortable with the command line subversion client, so dropping to the command line won't be a very satisfactory solution.
I have not used it, and I'm not using eclipse for branching/merging operations, but in Window/Preferences/Team/SVN > project structure, you can modify project structure.
Not sure exaclty what it do , but you can try playing with structure settings and manual specification.
Command line subversion don't really assume a structure, given a tag/branch is only a simple (remote preferably) copy, so you may be able to just copy from Eclipse (IIRC it's possible in the repositories view).
This has been answered on the Eclipse Subversive forum here:
http://www.eclipse.org/forums/index.php/mv/msg/674039/1274614/#msg_1274614
To quote:
It is not the one of recommended layouts, so the automation is not available for it. In order to use such a layout you should open plug-in preferences and change the following option: Window->Preferences->Team->SVN->Project structure->Branch and Tag settings from "Respect project structure" to "Manual specification"
I have checked and it does seem to work, although unfortunately it is a global setting and not a per-project setting.

eclipse compare editor stopped showing detailed differences

I've been using eclipse for java android development for 6 months and I love the compare editor. In the last few days I have been hacking away and I think I have all my git ducks in a row, or close enough that things are clean and neat and I can find old working versions of apps.
But it seems in the last day or two, the eclipse compare editor has stopped showing diffs! i right click on uncommitted PlayThread.java and choose to compare with Commit... or HEAD or branch or anything, and no matter how similar the files might be, the compare editor shows one big white bar on its right side, and clicking to go to the next difference highlights the whole file!
I have looked through the git and compare preferences on eclipse and can't find anything that might help.
Any help getting my beautiful compare editor working for me again would be greatly appreciated!
With respect to Javascript compair showing nothing, there is a known bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509820
Workaround...
Window >> Preferences >> General Tab >> Compare/Patch
Deselect checkbox next to "Open structure compare automatically"
Note the the latest EGit 5.3.0 (Feb. 2020, 8 years later) improves the right side of the compare editor, using the Eclipse -> Preferences -> Text Editors -> Show whitespace characters mentioned in Vivek's answer.
Text comparisons in Eclipse have been improved to make "Show Whitespace" work in more cases.
Also, concurrent editing of a file in a merge editor and in another editor open on the same file has been improved and works now better and even for files not in the Eclipse workspace.
Note that both showing whitespace and concurrent editing depend not only on the way EGit sets up the comparison (which is what we improved) but also on the actual editors being used. These editors are beyond the control of EGit.
With files not in the Eclipse workspace, one may encounter Platform bug 214351 when a file is open in another editor.
Original answer (May 2012):
The compare editor shows one big white bar on its right side,
That means Egit considers the local content of that file (on your disk) differs completely from what have been committed.
The one classic case where that happens is for automatic eol conversion (Windows <=> Unix), which is why I always set core.autocrlf to false.
See "Git beta on Windows (msysgit) - Unix or DOS line termination".
See also "Distributing git configuration with the code" for managing those eol through .gitattribute file (except EGit doesn't support yet .gitattribute file).
In this instance, the OP mwengler reports:
Well that was it.
The way I fixed it was in Eclipse > Window > Preferences > General > Compare/Patch > General on that page I checked "Ignore white space" and now the editor shows my diffs.
But I think I will turn off that autocrlf stuff, I don't think I'm using anything on windows that can't handle both flavors
See Egit bug 361503 which mentions that this "Ignore White Space" now also honors the core.autocrlf setting.
Below setting also works for Eclipse Oxygen Release.
It appears that this has something to do with the Structured Compare. To
use the simpler and apparently working version of compare choose:
Window > Preferences > General Tab > Compare/Patch
Deselect checkbox next to "Open structure compare automatically"
Enjoy text level diffing of ES6 classes.
Regards,
Rasool Javeed Mohammad
javeed.mca#gmail.com
Today again after long I caught in this issue. Every-time I fix this problem and move on but this time I tried understanding the root cause and get it fixed and since the fix which worked for me is not in the answers to this question, thus adding part with details :
I am using EGit plugin in eclipse, and the problem was same as OP - eclipse compare tool was not highlighting the differences rather a whole block as if the whole file has changed.
Lets understand the issue first , since I was aware that this is related to CRLF vs LF eol , so went to check that first and enabled the visibility as :
Eclipse -> Preferences -> Text Editors -> Show whitespace characters
In the above click on configure visibility.
Now as you see highlighted in above image, select the check boxes under Trailing and against both Carrier Return (CR) and Line Feed (LF).
Apply - Save and Close. Now in my case , file looked like this :
and this evident that for me I had CRLF window like eol which further also confirms as I do not have core.autocrlf set to true and by default it is false thus Git actually didn't tried to do anything about my EOL delimiters (as expected in this case).
And until this stage, the compare tool was showing the whole file as changed.
Now, moving to fix which worked for me.
Since, I wanted to get this fix within IDE realm, thus I first converted the particular file to Unix delimiters as :
Then my file became with LF (Unix delimiter) eol :
And compare tool started highlighting the delta.
So the issue as it was assumed was because of CRLF (window style) eol and eclipse comparator was not able to highlight delta rather whole file.
Then, instead of changing each file or package to Unix delimiters .
I updated in Eclipse->Preferences -> Workspace
By this, eclipse takes care of line-endings for new files to Unix, so that text files are saved in a format that is not specific to the Windows OS and most easily shared across heterogeneous developer desktops. After all this compare tool worked happily ever.
Hope this helps.

eclipse team ( Mercurial Eclipse ) edit highlighting

I am trying to move from Netbeans to Eclipse.
Minor thing bothering me is that Eclipse dosen't seem to have the kinda edit highlighting that Netbeans does.
For example, a new line is automatically highlighted as green. An edit is highlighted as blue. And this happens in an unobtrusive way on the left along with the line numbers( if line numbers are turned on).
Is this some configuration issue or does eclipse team not support it ?
This is specifically for MercurialEclipse plugin.
I'm a heavy eclipse user and as a general rule of thumb, it supports mostly everything. So problems like these are most likely solved through configuration and/or plugins.
Regarding your specific situation...
Maybe I'm not following your question but it seems you want to look at edits that happen on a file? When I do this in eclipse, I do so through the subversion plugin (Subclipse) and compare the existing file against a previous version in the repository (to compare against the team's older version of the file) or in local history (to compare against your own version of the file).
As in:
Also there is great article about this:
http://blog.firdau.si/2010/07/09/eclipse-quick-diff-see-what-changes-youve-made-since-last-checkout/

How to activate revision info in line number view

I know of an Eclipse feature to show revision information (gradual coloring, more info like revisionnumber, date and author on mouseover) for the last changes in a line in the linenumbers-view.
Does anyone know how to activate this feature for a file, or even better, by default? I accidently hit some shortcut lately which made it show in one file, it does not show up in the others, though.
This is called "Show Annotation" and you can find it in the "Team" menu. Since this is a pretty expensive operation, you can't make it the default.
Regarding the shortcut: You have to enable the command group SVN.
Window -> Customize Perspective... -> Command Groups Availability -> check "SVN".
If you do this, some SVN actions show up in the toolbar which you can remove again (if you want) using the same Customize Perspective dialog (tab Tool Bar Visibility).
Remapping the shortcut did not work for me but enabling the command group did (with the default key mapping Ctrl+Alt+A).
(did not find a way to reply to Aaron's answer so I had to create a new one)
I found my way here while trying to find a way to get the option to show up with code from my git repository.
A lot of the logic in the other answers applies to git too, and I followed the equivalent steps for git but it didn't help me.
It turned out that my projects, although imported from a git repository, hadn't been connected to (or had become disconnected from) the eclipse git integration. I think this happened because I imported the projects before I installed the elcipse git plugin.
I needed to connect them thus:
Right-click your project (or multiple selected projects) in the Project Explorer
Select 'Team' > 'Share Project...'
The default settings were fine for me, but change them if needed
Click 'Finish'
I found this solution here.