How to force Eclipse's quick diff to refresh after a commit? - eclipse

I'm using Subclipse 3.0.0 and set my quick diff settings to be against "Prestine SVN copy".
However when I make a commit using the menu option Team -> Commit I still see the old changes coloured in my left side ruller where the line numbers are.
Doing a Refresh on the source tree does not help either. I have to manually close all the opened source files and re-open them for the quick diff to update.
From what I see the reference "Prestine SVN copy" only gets updated when you open a file that is not currently opened. Is there any way to fix this?

In Eclipse, to do SVN clean up
Right Click on Project -> Team -> Refresh/Cleanup option
You also can refer to this to add a keyboard shortcut for this command

Related

Can I recover the replaced file by SVN in eclipse

I am using SVN as code repository. Accidentally I replaced my entire project with the one in SVN. As soon as I replaced, i tried to look at the local history of some files and figured out that there won't be any.
Is there anyway I can switch back my project (or atleast a file in that project) to previous versions in eclipse?
History is stored in this (hidden) folder:
.metadata/.plugins/org.eclipse.core.resources/.history/
So you should be able to restore from there.
Use the svn history. In Eclipse IDE (with subeclipse):
right click
show history
in the history window, locate the desired version (e.g. 55)
right click on it and Switch to Revision 55

How to checkout from diff view?

I am using Perforce 2015 client (P4V) on Windows 7.
I changed some files in my IDE. Then I use "Folder Diff" in Perforce to locate them. I was expecting to find "checkout" right click menu on the "Folder Diff" Perforce window in order to move my changes to a changeset but I don't see any "checkout" around.
How can I checkout directly from Diff view?
If you changed files on your workstation, but Perforce doesn't know about those changes yet, the command you're looking for is "reconcile".
I believe that P4V's Folder Diff may only show you the reconcile options if you use Folder Diff from the Advanced Reconcile Options variant of Reconcile Offline Work.
So to perform this style of Folder Diff within P4V, you should start by context-clicking on the root folder in your tree view and choosing "Reconcile Offline Work", then choose the Advanced Reconcile button at the bottom of that display, as described here: http://www.perforce.com/perforce/doc.current/manuals/p4v/Offline.html
Then, when Advanced Reconcile opens up the Folder Diff, you will see suggestions in red lettering about what your options are for each file (Mark For Edit, Get Revision, ec.). You can then pick one of those options by context-clicking that file in Folder Diff.
Alternatively (and perhaps more useful, once you get used to it), you can do this from the command line. If you haven't worked directly with the command line before, you can context-click "Open Command Window Here" on the root folder of your workspace treeview to get to the command window. Then, type
p4 status
to see a report about what changes you have made to your files, and
p4 reconcile
to make those files open for add, edit, or delete, as appropriate. Then close the command window and refresh P4V to see them.
I am not sure what your exact scenario and IDE is. I am using Visual Studio with the Perforce plugin, and when I make any changes in my source this plugin will check-out this file automatically (you can also choose to be prompted). So no need for folder diffs to locate any changes.
Should your IDE miss any integration plugin's then a very simple workflow could be like this:
Go to Perforce and check out all the files in your solution
Make your edits in your IDE (online or offline doesn't really matter)
In Perforce choose 'Revert Unchanged Files' on the changelist
And voila, only the changed files will be left in your changelist, you can then review the changes and submit to the depot.
NB: should in the mean time another developer have made any changes to any of your changed files, Perforce will warn you that you need to execute a Get Latest and then Resolve (i.e. merge) the changes.

Using Subversion in Spring Tool Suite: untrack file committed by accident

Does anyone know how I can untrack a couple of files committed by accident?
I'm looking for the equivalent of the Mercurial hg forget command.
I'd especially appreciate any answers that explain how to untrack files using the Spring Tool Suite IDE, i.e. not from command line.
It seems that it is not as easy as in Mercurial :) especially if the repo is shared with others and they also need to keep this file (after it is removed from tracking and ignored, the first svn update will delete it).
See this answer for detailed instructions: SVN: Ignoring an already committed file
I found a way to achieve this by fiddling around. Neither of these is ideal - can anyone improve on this?
Option 1: Delete in SVN repository, then resolve
Navigate to Window -> Open Perspective -> SVN Repository Exploring
to view the repository.
Right-click on the file and press Delete...
Navigate back to Spring perspective
Right-click on the file and press Team -> Show Tree Conflicts
In SVN Tree Conflicts perspective, right-click and press Resolve... to explicitly accept the repository deletion
In Spring perspective, right-click on the file and press Team -> Add to svn:ignore
Option 2: Delete locally, then resolve
Move file somewhere else on local
Commit to repository
Copy file back into tracked project
Add to svn:ignore
Run svn delete <path> --keep-local in your working and then svn commit the change.
The first command will schedule the delete of the file in repository, however it won't touch it in your working copy making the file unversioned. You can add the file to ignores afterwards.
svn delete
--keep-local

Reconnecting a project to SVN in Eclipse

I have a project that has been versioned by SVN for months, but now all of a sudden it seems that Eclipse does not recognize the project as being under version control. In the team menu, I only have Apply Patch... and Share Project...
I tried Share Project as suggested elsewhere, but Eclipse doesn't recognize the project as being under version control.
All the svn dirs exist.
Interestingly, I tried sharing the project to a different repository and I got an error saying that the project was already a working copy for another URL.
Any ideas?
There are a few things that you can try.
If the project is in synch with SVN, probably the easiest way is to delete it and check it out anew.
Otherwise, you can try to delete the project from your workspace (not from disk!) and to re-import it into the workspace.
If that does not work, you can try to use the SVN command line tools, e.g. svn commit, to synchronize your local project with the SVN repository (and check it out anew using Eclipse).
In case the SVN command line tools do not work, there might to be an actual problem with the SVN files. In this case, you could back up your project (with unsynched changes), check out the project from SVN, and use an offline-diff-tool such as diff or meld to carry the changes over to the newly checked-out project.
Try following: Rigth click -> Team->'share projectS' (plural, in singular does not work) in your disconnected project
I cannot reproduce it now in my PC but there appears a option to reconnect to svn -or to connect using svn information that exists in project-. (Just do as you were going to put a new project in svn, it will see the svn info and will asks you to use it)
I hate that problems....
Team > Share project works fine. The disadvantage is SVN supports to share projects one by one rather than many projects at a time.
4 years too late, but for anyone who faces this problem :
If while disconnecting from SVN, the meta-data was erased :
Right click on the project ->
Team -> Share Project -> SVN ->
Use existing repository location -> Next ->
Browse to your project's trunk folder -> OK -> Next ->
Here you will get a commit comment box. Just press Finish ->
A warning sign is displayed in a popup window saying "The project xxx already exists in the repository and has some content. Do you wish to proceed?" ->
Click yes ->
A window will popup showing the progress of prepare commit ->
After completion you will get the actual commit window showing all the resources as modified ->
Click CANCEL here ->
It will connect your local project to SVN and also will not commit anything.
I had better luck with the singular version of 'share project'. Had to manually add 'trunk' to the suggested repository path.

Eclipse and EGit: How to easily review changes to ALL modified files before committing to *local* repository

I'm using Eclipse Indigo SR2 with the (built-in) EGit plugin v.1.3.0.201202151440-r and haven't been able to find any way to easily review all my changes before making a commit.
I used Eclipse with SVN for years, and this was always very easy to do. I would typically right-click on my project, select Team->Synchronize, double-click on the first changed file (in the Team Sync perspective), then hit Ctrl-. repeatedly to review all changes in one file, and then proceed to the next file, as I wrote a summary of my changes for the commit message.
But of course, git is very different from Subversion, and so my workflow must change. With EGit, "Team Sync" only appears to be useful for reviewing changes between my local files and the remote repository (i.e. before a push to the remote). I need a way to review changes since my last commit to my local repository. I generally don't even care to (re)review changes before a push to remote (and if I did, I'd prefer a simple equivalent of git log to see what commits I'm about to push).
If I right-click on my project and select Team->Commit, I am presented with a window that does almost everything I need to do (select files to stage, commit, write a commit message, amend a previous commit, etc.). What it doesn't allow me to do is quickly and easily review all my changes in a compare editor. I can't believe this capability doesn't exist! It seems I am required to double-click on each individual file, review the changes, close the compare editor, and double-click on the next file. That's ridiculous!
TL/DR - I am looking for a simple GUI equivalent (in Eclipse) to do what I am easily able to do from the command line using git vimdiff (where vimdiff is a git alias that uses vimdiff as the "difftool" to cycle through all modified files) followed by git commit (with perhaps a git add or two in between).
If no one has a good solution, I am curious about how others handle their commit workflow with EGit. I've been getting along fine committing from the command line (not that Eclipse is happy about that) but I can't believe that EGit is as near-useless as it seems to me. Perhaps my google-fu is not as strong as it once was?
Says here that you can see the diffs between the working tree and any given reference. Perhaps you should try out the latest version (Juno) of Eclipse/EGit and see if it's gotten any better?
Update: I've tried this out in the latest Eclipse, and as far as I can see it works fine. Here's how:
In the moment of writing this, Eclipse Juno 4.2 is the version you should go for. On the download page, you can pick between several packages according to your needs. The 'Eclipse IDE for Java Developers' comes bundled with EGit, but you can also install EGit into any distribution using the Eclipse Marketplace (under the Help menu).
Once you've imported your project into Eclipse, make sure the project is "shared":
Right-click project -> Team -> Share Project.. -> Git
Now do the following:
Switch to the Team Synchronizing Perspective.
Click the little synchronize button in the Synchronize View.
Choose Git
Pick a suitable branch to sync against, like refs/remotes/origin/master
Make sure to check the "Include local uncommitted changes in comparison" box
Click Finish
Now, change some files and watch them appear in the Synchronize View. Double-click the changed files to see the diff (like in the screenshot below).
Are you aware of the 'Git Staging' view. It keeps track of all the files that have changed and you can review the changes any time. (This can be a bit better than using the commit dialog)
An alternative is to commit all changes without reviewing, and then use the history view to compare two commits (Simply select the last top most commits, right click and select 'Compare with each other'). This way you do not have to keep double clicking individual files. If you need to change something you can always 'Amend' the last commit. (I usually follow this approach)
I am writing this as of Eclipse Oxygen, but it should apply to other versions as well.
Option 1 with team synchronizing view: right click the project > Compare with > Commit. You can choose your latest commit here, even if you haven't pushed it to repository.
Option 2 with diff view: If you want to see the "diff" version without committing, you can achieve this by right clicking your project > team > stashes > Stash Changes > check Include untracked files. This will save all of your changes to a stash. Then you will right click project > team > stashes > select stash you saved. You click the green arrow at the top right to re-apply all of your changes you stashed back to your code. In the same stash window, you will see a "Diff" tab at the bottom right. Clicking on the diff tab will show your changes in the red/green highlighted diff style. I wish there was a way to generate a diff view without stashing, but this is the only work-around I have found.