[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[Subclipse-dev] Mylar repository configuration for Subclipse projects

From: Eugene Kuleshov <eu_at_md.pp.ru>
Date: 2007-05-25 03:00:32 CEST

Mark,

  I noticed you've added Mylar repository configuration to all Subclipse
projects and your configuration is using property-based repository link
provider (the default one in Mylar).

  However we have repository link provider in Subclipse module for Mylar
that is using svn's own properties (bugtraq:url etc) to discover those
links. Unfortunately there is a limitation. Current implementation of
SubclipseTaskRepositoryLinkProvider don't work too well for properties
that are defined above project folder, so existing bugtraq:url property
for Subclipse project isn't picked up.

  I've tried to fix that by falling to remote properties if local
properties can't be retrieved. See updated code below. It works, but as
you would expect it is extremely slow to go trough all parent folders.

  So, I wonder if there is a better way to collect properties from all
parent folders, or at least somehow cache them locally?

  regards,
  Eugene

public class SubclipseTaskRepositoryLinkProvider extends
    AbstractTaskRepositoryLinkProvider {

  public TaskRepository getTaskRepository(IResource resource,
      TaskRepositoryManager repositoryManager) {
    try {
      ProjectProperties props =
ProjectProperties.getProjectProperties(resource);
      if(props!=null && props.getUrl()!=null) {
        return SubclipseTeamPlugin.getRepository(props.getUrl(),
repositoryManager);
      }

      // TODO need to cache or somehow speedup this
     
      ISVNLocalResource svnResource =
SVNWorkspaceRoot.getSVNResourceFor(resource);
      ISVNClientAdapter svnClient =
SVNProviderPlugin.getPlugin().createSVNClient();
     
      SVNUrl svnUrl = svnResource.getUrl();
      while(svnUrl!=null) {
        ISVNProperty[] properties = svnClient.getProperties(svnUrl);
        ISVNProperty urlProperty = getProperty(properties, "bugtraq:url");
        if(urlProperty!=null && urlProperty.getValue()!=null &&
urlProperty.getValue().trim().length()>0) {
          return
SubclipseTeamPlugin.getRepository(urlProperty.getValue().trim(),
repositoryManager);
        }
       
        svnUrl = svnUrl.getParent();
      }
     
    } catch (SVNException ex) {
      // ignore
    } catch (SVNClientException ex) {
      // ignore
    }
    return null;
  }

  private ISVNProperty getProperty(ISVNProperty[] properties, String name) {
    for (int i = 0; i < properties.length; i++) {
      ISVNProperty property = properties[i];
      if(name.equals(property.getName())) {
        return property;
      }
    }
    return null;
  }

}

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subclipse.tigris.org
For additional commands, e-mail: dev-help@subclipse.tigris.org
Received on Fri May 25 03:00:48 2007

This is an archived mail posted to the Subclipse Dev mailing list.