How to activate revision info in line number view - eclipse

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.

Related

Recent Locations in vscode (Like in IntelliJ)

I like the feature Recent Locations of IntelliJ.
For other reasons I will use vscode (for golang).
Is there a similar feature in vscode?
I want to see a list of the my recent locations (optional filtered, so that only the locaions are visible, which where recently changed).
After a break (like lunch), this feature is really handy. It helps you to connect to your work before the break.
Especially the "show changed only" is very helpful.
If you use git, you get most of what you request here. Vscode has a git extension in the sidebar that shows you what files you have changed, as in unstaged and staged changes.
You can also jump between location, with alt+left/right arrow. This is independent from git. It just remembers your last cursor positions.
If you are willing to use an extension, there is one that seems to do what you are asking for, judging by its name: https://marketplace.visualstudio.com/items?itemName=percygrunwald.vscode-intellij-recent-files
#guettli They are different editors, so it will be hard to always find the exact same feature. I think there is nothing like recent locations in vsCode, at least when i'm writing this. Will there be something like that in the future? Probably.
Ctrl-P will display a list of recently opened files, and by selecting one of the files it will go to the last location when editing the file. To see the changes in a file(w/ git) you can right-click it and select the "view timeline" or view the changes with the git button. Not exactly what you asked for but may be useful.
This function is called "navigate Back", you find it also in the Key Bindings for Visual Studio Code and more accessible within vscode from the keybindings UI.
Ctrl+P will display a list of recently opened files in Vscode
You can use Timeline option at the right-bottom corner of the vscode for comparing previous file and current changes of the file that is in currently opened
You can even compare the files with options on right clicking the file
You can get more about code navigations in this video https://www.youtube.com/watch?v=MuQmMsIpI04

Git tags still in the file while solving conflicts in Eclipse

the following situation is an example of what happens when i try to solve a conflict in Eclipse. I know i can use other ways to solve a conflict, i know how to solve conflicts, but i would like to use Eclipse and i apreciate if you could help. So, these are the steps:
(Using Eclipse 2019-09)
I'm in my branch:
Team > Merge > Select master
Eclipse tells there is conflict
Team Synchronize
(Now on Team Synchronizing view) Right Click on conflicting file > Merge Tool
I don't want to modify anything (even thou if i modify the problem occurs anyway)
Right Click on the file again > Add to index
After this, when i open the php perpective and open the file that was confliting these tags (<<>>refs) are there:
The weird thing is that Eclipse offers these 3 editors on the comparation view (after step 4). If i choose the Text Compare editor the tags doesn't remain in the code and everything works fine.
I know you may say "just switch to the text compare then" but it is annoying to do this everytime. So i'd like to know why this happens and if there is some way to solve it.

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 shortcut for Compare With Head Revision

I want to have a keyboard shortcut for comparing the current open buffer with the HEAD version of that file. This is available in the context menu by clicking Compare With/Head Revision.
I tried to add a key binding in Preferences/General/Keys, but the key binding is ignored. I can set (and use) shortcuts for Compare with other resource and Compare with previous version, but the most useful one, Compare with HEAD Revision doesn't work. I couldn't find any difference between the ones that work and the ones that don't.
I am using Eclipse Helios (3.6.2).
The answer is actually what Mohsen suggested:
Window dropdown menu > Customize Perspective > Command Groups Availability and there check the Git box.
This enables the relevant shortcut keys for this perspective.
Go to Eclipse Window->Preferences
General->Keys
Select the Compare command and add bindings for it.
It works after upgrading to EGit 2.0. I am now using Indigo (Eclipse 3.7.2).
I can set (and use) shortcuts to Compare with HEAD and Show Annotations (blame), both of which didn't work before.