Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r3777 - branches/1.2.x/subclipse/core/src/org/tigris/subversion/subclipse/core: . repo

subclipse
Discussion topic

Back to topic list

svn commit: r3777 - branches/1.2.x/subclipse/core/src/org/tigris/subversion/subclipse/core: . repo

Author markphip
Full name Mark Phippard
Date 2008-03-25 12:14:51 PDT
Message Author: markphip
Date: 2008-03-25 12:14:51-0700
New Revision: 3777

Modified:
   branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/SVNProjec​tSetCapability.java
   branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/repo/SVNR​epositories.java
   branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/repo/SVNR​epositoryLocation.ja​va

Log:
Backport of r3516:3517 from trunk

* Create connections using root URL when importing projects

Modified: branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/SVNProjec​tSetCapability.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/branches​/1.2.x/subclipse/cor​e/src/org/tigris/sub​version/subclipse/co​re/SVNProjectSetCapa​bility.java?view=dif​f&rev=3777&p​1=branches/1.2.x/sub​clipse/core/src/org/​tigris/subversion/su​bclipse/core/SVNProj​ectSetCapability.jav​a&p2=branches/1.​2.x/subclipse/core/s​rc/org/tigris/subver​sion/subclipse/core/​SVNProjectSetCapabil​ity.java&r1=3776​&r2=3777
====================​====================​====================​==================
--- branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/SVNProjec​tSetCapability.java (original)
+++ branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/SVNProjec​tSetCapability.java 2008-03-25 12:14:51-0700
@@ -13,6 +13,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -35,7 +36,9 @@
 import org.eclipse.team.cor​e.TeamException;
 import org.tigris.subversio​n.subclipse.core.com​mands.CheckoutComman​d;
 import org.tigris.subversio​n.subclipse.core.rep​o.SVNRepositoryLocat​ion;
+import org.tigris.subversio​n.subclipse.core.res​ources.RemoteFolder;​
 import org.tigris.subversio​n.subclipse.core.res​ources.SVNWorkspaceR​oot;
+import org.tigris.subversio​n.svnclientadapter.S​VNUrl;
 
 /**
  * An object for serializing and deserializing of references to SVN based
@@ -105,7 +108,11 @@
             return new IProject[0];
         }
         // Load the projects
- return checkout(projects, infoMap, monitor);
+ try {
+ return checkout(projects, infoMap, monitor);
+ } catch (MalformedURLException e) {
+ throw SVNException.wrapException(e);
+ }
     }
 
     /**
@@ -150,7 +157,7 @@
      * the progress monitor (not <code>null</code>)
      */
     private IProject[] checkout(IProject[] projects, Map infoMap,
- IProgressMonitor monitor) throws TeamException {
+ IProgressMonitor monitor) throws TeamException, MalformedURLException {
         if(projects==null || projects.length==0) {
           return new IProject[0];
         }
@@ -182,6 +189,7 @@
      */
     protected static class LoadInfo {
         private final ISVNRepositoryLocation repositoryLocation;
+ private final String repo;
         private final IProject project;
         private final boolean fromFileSystem;
         private final String directory; // Only used when fromFileSystem is true
@@ -196,14 +204,14 @@
          */
         LoadInfo(ProjectSetS​erializationContext context,
                 StringTokenizer tokenizer) throws SVNException {
- String repo = tokenizer.nextToken();
+ repo = tokenizer.nextToken();
             String projectName = tokenizer.nextToken();
 
             project = ResourcesPlugin.getW​orkspace().getRoot()​.getProject(
                     projectName);
             if (repo.indexOf("://") != -1) { //$NON-NLS-1$
- //A normal URL
- repositoryLocation = SVNRepositoryLocatio​n.fromString(repo);
+ // Create connection to repository root.
+ repositoryLocation = SVNRepositoryLocatio​n.fromString(repo, false, true);
                 fromFileSystem = false;
                 directory = null;
             } else {
@@ -258,15 +266,18 @@
          * @return true if loaded, else false
          * @throws TeamException
          */
- boolean checkout(IProgressMonitor monitor) throws TeamException {
+ boolean checkout(IProgressMonitor monitor) throws TeamException, MalformedURLException {
             if (fromFileSystem) {
                 return importExistingProject(monitor);
             } else {
                 if (repositoryLocation == null) {
                     return false;
                 }
+ RemoteFolder remoteFolder = new RemoteFolder(reposit​oryLocation, new SVNUrl(repo), repositoryLocation.g​etRootFolder().getRe​vision());
                 CheckoutCommand command = new CheckoutCommand(
- new ISVNRemoteFolder[] { repositoryLocation.g​etRootFolder() }, new IProject[] { project });
+ new ISVNRemoteFolder[] { remoteFolder }, new IProject[] { project });
+// CheckoutCommand command = new CheckoutCommand(
+// new ISVNRemoteFolder[] { repositoryLocation.g​etRootFolder() }, new IProject[] { project });
                 command.run(monitor);
                 return true;
             }

Modified: branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/repo/SVNR​epositories.java
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/branches​/1.2.x/subclipse/cor​e/src/org/tigris/sub​version/subclipse/co​re/repo/SVNRepositor​ies.java?view=diff​&rev=3777&p1=b​ranches/1.2.x/subcli​pse/core/src/org/tig​ris/subversion/subcl​ipse/core/repo/SVNRe​positories.java&​p2=branches/1.2.x/su​bclipse/core/src/org​/tigris/subversion/s​ubclipse/core/repo/S​VNRepositories.java​&r1=3776&r2=3​777
====================​====================​====================​==================
--- branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/repo/SVNR​epositories.java (original)
+++ branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/repo/SVNR​epositories.java 2008-03-25 12:14:51-0700
@@ -186,7 +186,7 @@
             }
             
         }//else we couldn't find it, fall through to adding new repo.
- ISVNRepositoryLocation repository = SVNRepositoryLocatio​n.fromString(locatio​n);
+ ISVNRepositoryLocation repository = SVNRepositoryLocatio​n.fromString(locatio​n, false, true);
         addToRepositoriesCac​he(repository);
         
         return repository;

Modified: branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/repo/SVNR​epositoryLocation.ja​va
Url: http://subclipse.tig​ris.org/source/brows​e/subclipse/branches​/1.2.x/subclipse/cor​e/src/org/tigris/sub​version/subclipse/co​re/repo/SVNRepositor​yLocation.java?view=​diff&rev=3777​&p1=branches/1.2.x/​subclipse/core/src/o​rg/tigris/subversion​/subclipse/core/repo​/SVNRepositoryLocati​on.java&p2=branc​hes/1.2.x/subclipse/​core/src/org/tigris/​subversion/subclipse​/core/repo/SVNReposi​toryLocation.java​&r1=3776&r2=377​7
====================​====================​====================​==================
--- branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/repo/SVNR​epositoryLocation.ja​va (original)
+++ branches/1.2.x/subcl​ipse/core/src/org/ti​gris/subversion/subc​lipse/core/repo/SVNR​epositoryLocation.ja​va 2008-03-25 12:14:51-0700
@@ -525,6 +525,29 @@
         }
     }
 
+ /*
+ * Parse a location string and return a SVNRepositoryLocation.
+ * If useRootUrl is true, use the repository root URL.
+ */
+ public static SVNRepositoryLocation fromString(
+ String location,
+ boolean validateOnly,
+ boolean useRootUrl) throws SVNException {
+ if (!useRootUrl) return fromString(location, validateOnly);
+ ISVNClientAdapter svnClient =
+ SVNProviderPlugin.ge​tPlugin().createSVNC​lient();
+ try {
+ SVNUrl url = new SVNUrl(location);
+ ISVNInfo info = svnClient.getInfo(url);
+ SVNUrl rootUrl = info.getRepository();
+ return fromString(rootUrl.toString());
+ } catch (MalformedURLException e) {
+ throw SVNException.wrapException(e);
+ } catch (SVNClientException e) {
+ throw SVNException.wrapException(e);
+ }
+ }
+
 // public static IUserAuthenticator getAuthenticator() {
 // if (authenticator == null) {
 // authenticator = getPluggedInAuthenticator();

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r3777 - branches/1.2.x/subclipse/core/src/org/tigris/subversion/subclipse/core: . repo markphip Mark Phippard 2008-03-25 12:14:51 PDT
Messages per page: