Imagine yourself committing your sources to your subversion repository after a hard day’s work and having this message pop up:

Yikes! You are pretty sure you did modify the correct files and did not mess up your trunk/tag SVN meta files (again).
Relax, most probably it’s just your Subversive plug-in playing tricks on you. We recently updated one of our customer’s development environment to Ganymede with Subversive as the Subversion plug-in and encountered no problems so far. The only oddity that surfaced quite fast was this message.
Taking a closer look we noticed that Subversive’s method to check whether you are on a tag or not is not as smart as you might expect. Every time you try to commit something that has the string “tags” in it, subversive will complain. We have packages that contain JSP tags (com.acme.tags.FooTag), and every time we try to commit a change this warning pops up.
Obviously this is nothing to be afraid of, just confirm your commit and you are good to go. If you want to know why this irritating behaviour occurs, read on.
This part of the CommitAction class is responsible for the nag-screen:
if (SVNUtility.isTagOperated(allResources)) { TagModifyWarningDialog dlg = new TagModifyWarningDialog(this.getShell()); if (dlg.open() != 0) { return; } } |
SVNUtility.isTagOperated() checks for the kind of the “root” of the resource to be committed.
if (((IRepositoryRoot)SVNRemoteStorage.instance().asRepositoryResource(resources[i]).getRoot()).getKind() == IRepositoryRoot.KIND_TAGS) { return true; } |
I put “root” in quotations, because one could argue what a “root” really is. Just ask yourself what the root of “/usr/local/share/svn/trunk/com/acme/tags/FooTag.java” is. I’d say it’s “/” or “/usr/” from a file system or “/trunk/” from a repository point of view. But SVNRepositoryResource.getRoot() thinks different:
public IRepositoryResource getRoot() { if (this.root == null) { IRepositoryResource parent = this; while (!(parent instanceof IRepositoryRoot)) { parent = parent.getParent(); } this.root = (IRepositoryRoot)parent; } return this.root; } |
SVNRepositoryLocation.getParent() returns a specific object if the last segment of the URL path contains one of SVN’s keywords:
Path urlPath = new Path(url); String name = urlPath.lastSegment(); if (location.isStructureEnabled()) { if (name.equals(location.getTrunkLocation())) { return new SVNRepositoryTrunk(location, url, SVNRevision.HEAD); } if (name.equals(location.getTagsLocation())) { return new SVNRepositoryTags(location, url, SVNRevision.HEAD); } if (name.equals(location.getBranchesLocation())) { return new SVNRepositoryBranches(location, url, SVNRevision.HEAD); } } |
Subversive treats the first occurrence as the root. Because of the package name name.equals(location.getTagsLocation()) matches and a SVNRepositoryTags object is returned.
Funny thing is that the SVNRepositoryTags class (which is of IRepositoryRoot.KIND_TAGS, of course) extends SVNRepositoryRootBase which implements IRepositoryRoot. Here we go, the while loop’s condition of getRoot() is no longer met, so it returns the current IRepositoryResource which leads to the positive return value of SVNUtility.isTagOperated() – even tough we a not working on a SVN tag.
This is a minor problem, because it just leads to a warning, not an error. IMHO going down all the way of the urlPath could solve to problem. The last occurrence of an instance of IRepositoryRoot should be used rather than the fist. This would also work for repositories regardless of the repository layout (global vs. per project trunk/tags/branches). Subversion implementations should not interfere with package layouts, even if SVN keywords are used.
category:
English
Deutsch 

I’d say the same about this one as I said about the camelize post: why not submit this issue to the Subclipse project? I believe that this problem is not too uncommon, especially bearing in mind that Subclipse is an Eclipse plugin, and that Eclipse is widely used for web-related Java development.
Au Backe… Selbstverständlich darf die Warnung nicht vom Inhalt abhängig sein.
Da muss ich direkt wieder an den wirklich sehenswerten Vortrag von Linus über Git denken: http://tinyurl.com/336ony
Grüße aus Aachen,
Michael.
Robert is right, the only problem I saw after thinking half a day about it was: How would a proper way be. I see there quite many problems doing it proper. Because I do not fully agree with the conclusion that one should parse the whole path.
what about the svnroot named “tags” instead of svnroot? would cause problems as well. not sure though
Hello world,
I’ve just realized that there is now a checkbox in that dialog, saying “Don’t ask any more for projects which contain tag modification.” – cool. Should be used with caution, though – you may potentially suppress sensible warnings if you activate this option.
Cheers
Rob