How to make a tag in SVN using eclipse? - eclipse

I'm using eclipse and Subversion (SVN) is my new version control.
Till now I used to use Concurrent Versions System (CVS) as my version control and after deploy operation I used to tag my projects with Tag as Version in eclipse like this:
Team --> 'Tag as Version..' --> Version-X-Y-Z
How can I do it now using SVN?

Normally, SVN has three root level directories,
trunk
tags
branches
In SVN server, for each project, you have the same above directory structure.
'trunk' is where you keep your ever developing code base.
'tags' is used for the same purpose that you've indicated. i.e. for versioning.
'branches' is used for things like feature developments/individual development.
An example,
Let's say I am developing a database synchronization application which will go out as Pilot release, Moonshine release, Kilimanjaro release, Great release and onwards..
I start in 'trunk' and continue my development for let's say 2 months at which time I am ready for Pilot release..
Then I create a 'tag' of the 'trunk' which I can name 'Pilot tag' which will be released to customers..
Now my main feature developments for next release which is 'Moonshine release' will continue in the 'trunk'. If their are any immediate bug fixes or show-stoppers in my 'Pilot release' those will be done in the 'Pilot tag' and released to the customers immediately..
However since the above fixes are not in my 'trunk' code, sometime later (before releasing the Moonshine release) I will 'merge' the modifications done in my 'Pilot tag' back to 'trunk'.
Here, there can be conflicts since the same code lines could have been modified in both 'Pilot tag' (for bug fixing mentioned earlier) and in 'trunk' (for feature modifications/development of new release). In this situation, you have to carefully review the conflicts, edit any such conflicts and accept the changes.
TortoiseSVN is the primary client tool for using SVN. It embeds features directly to your Windows right click menu for all above mentioned functionalities like commit, update, merge, branch (i.e. tag or branch) etc.
And for conflict resolution I personally prefer 'Beyond Compare' which is a third party application which you have to buy. You can setup TortoiseSVN to invoke Beyond Compare as the application for conflict resolution and it is far better and user-friendly than the built in conflict editor in TortoiseSVN tool.

You would need to install an Eclipse Subversion plugin like subclipse or Subversive. This will provide the same facility as that available for CVS.
For instance, here is the documentation on how to tag using Subversive.

To TAG, using Eclipse with SubClipse:
select Team, Branch/Tag, then click the 'select' button and drill into the appropriate project, then click 'tags' directory, and drill down to your last tag name or any similar name you plan on creating.
The full URL is copied into bar, then you can edit it changing the rightmost tag name portion to any new tag name.
Click next, select from HEAD (HEAD is referring to the repo path you have established already on previous page so in fact may be the Head of a Branch).
Enter a comment like 'tagging <appName> Release <for reason> version x.y.z'
Finish -
You can prior to this point or after, open the Eclipse 'SVN Console' from dropdown on right bottom of page, and see most recent SVN commands generated and there results.

Every checkin in SVN creates an new revision number. SVN revision number should be equivalent of your tag. Remember the SVN revision number for the production build.

Tagging and branching in Subversion works differently from CVS. In Subversion, "to create a tag" means to copy a revision (typically HEAD, but it can be some other revision) to a new directory within the "tags" directory. That is why, when you go to Team->Branch/Tag..., Eclipse is asking you for a URL to copy to.
Check out this page for a more detailed explanation of tagging in Subversion.
To help you understand how things are done "the SVN way," I'd recommend practicing Subversion usage from the command line, before trying it on Eclipse. Or, if not, at least open an SVN console in Eclipse to see the commands that it runs--you'll see that the tagging operation is indeed an svn copy.

Related

project SVN repo paths reduced to "[]" in Eclipse

Installed Eclipse Kepler, Subclipse 1.8, SVNKit. Several (not all) of my projects now have only "[]" instead of the usual path into the repo. I can't see any obvious relationship between those that still have a full rpo path and those that now have on "[]". The two solutions to similar problems mentioned here (though none were identical) do not work:
renaming the project, then renaming it back -> no change
disconnecting the project then using "share project" -> complains that there is no SVN metadata data in the root of the project (except that there is)
The two other solutions recommended, namely "reinstall everything" and/or "delete the project (retaining files) and re-import it into the workspace" I want to keep as absolute last resort.
The situation is complicated by the fact that the SVN info associated with the projects is old and needs upgrading. A disconnected project cannot be shared, because it there is no "upgrade" option (just "Apply patch" and "Share Project"). A connected project with a "[]" path cannot be upgraded because the option is greyed out, along with everything else on the "Team" menu except Commit, Create Patch, Apply Patch, Show Revision Graph, Add to Version Control, Revert and Disconnect.
A further difficulty is that some of the "[]" projects are newer than their repo versions, with changes I want to preserve. So discarding the local copies and checking out new ones is not an option, at least not for all affected projects.
So, what I specifically want is some way to re-connect those projects with a repo path of "[]" to their correct repo paths. Some explanation of what the heck happened would be a bonus :-)
Any suggestions gratefully received.
Based on all of the things you mentioned, I would guess that the working copy is not the right format. The current version of Subclipse is 1.10.x which would require a Subversion 1.8 working copy format. Team > Upgrade would be available to update it.
You said you have Subclipse 1.8.x installed, so that would requires a Subversion 1.7 working copy format. If the working copy is from a lower version then you could upgrade it, but if the working copy is from Subversion 1.8, then it will not be able to read it.

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.

SVN Commit Issue

Whenever I commit some code to my SVN repository and then do a Synchronization again with the repository the "Team Synchronizing" panel shows me that there is a update to be taken on my code and it shows 0 files and just an "empty update" to update to the latest revision number (the revision number of the recent code commit which I did) in the eclipse. I am on Windows 7. I have used the same tools in Mac and it works fine. Whenever I do a commit in Mac Eclipse it automatically updates it self.
Is this a bug or is there something I am missing?
Any help would be appreciated.
I suspect that although you have Eclipse on both Mac and Windows, the SVN plugin, or the SVN connector used by that plugin, is different between your two setups.
I'm afraid I don't have details to hand, but have seen this behaviour before. The SVN integration in Eclipse makes most sense if you end up with no incoming changes after you do a commit. It seems one of the Eclipse plugins decides after commit to immediately poll for any outstanding changes. It sees that the top-level folder for your project has been updated, so marks it for update.
This is an accurate reflection of what happens in SVN - if you commit a new revision is created in the repository, but your local checkout is not at that revision until you do an update. If you run "svn info" on the command line just after a commit you will see this.

Why is the merge tool disabled in Eclipse for a EGit-managed project?

As per the EGit User Guide, to use the merge tool, one should right-click on the resource with a merge conflict and then select Team > Merge Tool. However, when I do this, the Merge Tool option is greyed out. EGit is properly detecting the conflict and showing me both the icon and text label decorations for the file in conflict.
Any ideas?
It was disabled for me because I had some changes on my stash list.
$ git stash clear
fixed the problem for me.
It can depend on the version of EGit you are using, and on the operation that lead to the conflict.
See for instance bug 339092 which mention merge tool being not enabled in the case of a conflict after cherry-picking: only the just released EGit 0.12 would support that.
The only time (other than a bug) that the Merge Tool would be disabled is that when you are in any status other than the Conflicts one; i.e. you will only see that option enabled when the status is Conflicts. The status is shown next to the project name in most views, such as Project Explorer and Synchronize.
Make sure you have merged with desired branch, then if your merge results in conflicts, your project will enter Conflicts mode, and the Merge Tool will be enabled.
It seems to be a bug in EGit as VonC mentioned, but the fix is easy. I did it using reset branch option on the same menu that Cherry Pick option existed.
Note: git stash clear didn't help.
This happens if you tried to push changes to a remote and there were merges required from the remote. It fails with 'not FF' but also simultaneously detects the conflict. Don't ask me why it doesn't mark the whole project as conflicted at this point.
Open the Synchronize tab, right-click the project and select 'merge'. This immediately fails because of the conflicting file, and it switches on the conflict icon label for the project and enables the 'merge tool' option.
This is for EGit 4.0.3 in Eclipse Mars.
This also happens if you're in detached head state (in my case, I had checked out a remote branch and then forgotten).
Also, even after you've corrected the problem, you may have to select a different project and then reselect the one you actually want (just selecting in the package explorer view) in order for the menu to update.

Can someone explain the perforce integration options?

Specifically:
Why do I need to explicitly enable "Enable baseless merges" all the time? I am integrating from my branch to the trunk.
What does "Enable integrate over
deleted targets" mean? Shouldn't it
do this by default? If the file
doesn't exist, and you integrate to
that branch with the file, it should
create the file, right??
What does "Do not get latest revision
of selected files" have to do with
integrating? I should be choosing a
source revision, and a target (to
create a new target revision).
What does "Disregard indirect
integration history" mean? I've never used it, since it sounds scary.
I would be grateful to know, as I am a little unsure of what options to enable when I am trying to do various integration tasks from our trunk to various branches or vice versa. (I am not the buildmaster, but hey, I want to know what he knows).
Why do I need to explicitly enable
"Enable baseless merges" all the time?
I am integrating from my branch to the
trunk.
Can't help you here. Something is not right.
What does "Enable integrate over
deleted targets" mean?
If the target file has been deleted and the source file has changed, will re-branch the source file on top of the target file. Without this option, a file on the branch, that has been changed on the branch and deleted on the trunk, would not be allowed to be integrated back into the trunk.
Shouldn't it do this by default?
Not if you are integrating a file back into the trunk, which you branched from the trunk, then deleted on the trunk. Normally 'p4 integrate' avoids mixing outstanding edits with a deleted file. You have to use the advanced options to tell it how to deal with a deleted file.
If the file doesn't exist, and you
integrate to that branch with the
file, it should create the file,
right?
When integrating a file, that previously never existed (i.e., it was added to the branch), from one location to another, yes, Perforce will simply create it in the location into which you are integrating. However, if the file originally came from the trunk, was deleted on the trunk, and now you're trying to integrate it back into the trunk from the branch, you have to tell it what to do via these integration options. Here's the command line switches to which these options correspond:
Enable integrations around deleted revisions = -d
Integrate over deleted targets = -Dt
Delete target file when source is deleted = -Ds
Try to integrate changes when source is deleted and re-added = -Di
You can learn more about them in the integrate command help (type "p4 help integrate" at the command line).
What does "Do not get latest revision
of selected files" have to do with
integrating?
This tells Perforce to use the workspace revision of the target file. By default, the head revision of the target file is automatically retrieved into the workspace before integrating. Say you have made one revision to a branch file and integrated it back into the trunk. The trunk and branch now have two revisions of this file. You submit a change to the branch file so it now has 3 revisions. You sync the branch file back to revision 2. If you were to do a normal integration right now, Perforce would assume you want to integrate everything up to the head revision and would integrate revision 3 of the branch file into the trunk. If you were to select this option, it would say, "all revision(s) already integrated" because you have revision 2 in your workspace. It would be the same as attempting to integrate with the "Limit the range of the integration:" option set to "Integrate all revisions up to:" Revision 2.
What does "Disregard indirect
integration history" mean? I've never
used it, since it sounds scary.
I can't figure out, nor find any info about, what this does.
In general, to merge two files, perforce looks for a "base", the closest revision to the two files, and uses that to provide a much better diff than just directly running a diffing the two files. See Knowledge Base Article. Without knowing your perforce setup, I couldn't say what was going wrong, however, p4win has some nice graphical tools to visualize branches, you might be able to determine why perforce can't find a base for you. This is also what "Disregard indirect integration history" does: stops it from looking for the base.
For the "don't sync to head": when integrating, your "target" is the files in your local client, which you aren't specifying a revision for; instead, perforce will either sync your revision head (if you don't use "-h"), or will use the one you currently have. You can't specify an arbitrary revision because your local client only has a particular one.
"Enable integrate over deleted targets" can lead to problems if done blindly. Here's an example: Imagine you refactor your code in your next release branch, and eliminate a source file as a result - the functionality was merged into some other source files. You then fix a bug in that original source file in a maintenance branch for the previous release. If you integrate over delete by default, the dead source file comes back, but it won't be built and the bug wouldn't have been fixed. It'd better to be warned that this occurred so you could manually merge the fix into the other source files.