Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2010-12-22 10:48:21 -0500
committerTomasz Zarna2010-12-22 10:48:21 -0500
commitbc1dfd854ed1d5e990dcfd005c19dd69d315fa08 (patch)
tree718787c8b8f15623070137664fe121a7fdb8314a
parent7fdfb294c67705ce2a9e4b3c750b8fab42cbd4ed (diff)
downloadeclipse.platform.team-bc1dfd854ed1d5e990dcfd005c19dd69d315fa08.tar.gz
eclipse.platform.team-bc1dfd854ed1d5e990dcfd005c19dd69d315fa08.tar.xz
eclipse.platform.team-bc1dfd854ed1d5e990dcfd005c19dd69d315fa08.zip
bug 332732: SCMURL needs to default project name if not given
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java8
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/CVSURITest.java21
3 files changed, 26 insertions, 11 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
index 6ee37e768..52bc5b6fc 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
@@ -327,10 +327,10 @@ public abstract class ProjectSetCapability {
* the URI that identifies the location of the project in the
* repository.
* @param projectName
- * the name of the project to use. If <code>null</code>, use the
- * project name from the provided SCM URI. If the URI is not an
- * SCM URI or does not contain project name, <code>null</code> is
- * returned.
+ * the name of the project to use. If <code>null</code>, use a
+ * project name from the provided SCM URI. If the URI does not
+ * contain the project name the last segment of the URI's path is
+ * used. If this fails, <code>null</code> is returned.
* @return the reference string representing a project that can be loaded
* into the workspace or <code>null</code>, if the URI and name
* cannot be translated into a reference string
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java
index 01e3e74ee..c5e3d53d0 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java
@@ -630,11 +630,11 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
ICVSRepositoryLocation location = cvsURI.getRepository();
ICVSFolder folder = cvsURI.toFolder();
if (projectName == null) {
- if (cvsURI.getProjectName() != null) {
- projectName = cvsURI.getProjectName();
- } else {
+ projectName = cvsURI.getProjectName();
+ if (projectName == null)
+ projectName = cvsURI.getLastSegment();
+ if (projectName == null)
return null;
- }
}
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
return asReference((CVSRepositoryLocation)location, folder, project);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/CVSURITest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/CVSURITest.java
index c8a02a222..c9fe16cc3 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/CVSURITest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/CVSURITest.java
@@ -187,7 +187,7 @@ public class CVSURITest extends EclipseTest {
assertEquals(cvsUri.getTag(), new CVSTag("tag", CVSTag.VERSION));
String refString = new CVSProjectSetCapability().asReference(uri, null);
- assertNull(refString);
+ assertEquals("1.0,:pserver:host.com:/cvsroot/path,path/to/module,module,tag", refString);
}
public void testScmUri7() throws CVSException {
@@ -199,7 +199,7 @@ public class CVSURITest extends EclipseTest {
assertEquals(cvsUri.getTag(), new CVSTag("version", CVSTag.VERSION));
String refString = new CVSProjectSetCapability().asReference(uri, null);
- assertNull(refString);
+ assertEquals("1.0,:pserver:host.com:/cvsroot/path,path/to/module,module,version", refString);
}
public void testScmUri8() throws CVSException {
@@ -211,7 +211,7 @@ public class CVSURITest extends EclipseTest {
assertEquals(cvsUri.getTag(), CVSTag.DEFAULT);
String refString = new CVSProjectSetCapability().asReference(uri, null);
- assertNull(refString);
+ assertEquals("1.0,:pserver:host.com:/cvsroot/path,path/to/module,module", refString);
}
public void testScmUri9() throws CVSException {
@@ -249,5 +249,20 @@ public class CVSURITest extends EclipseTest {
String refString = new CVSProjectSetCapability().asReference(uri, "project");
assertEquals("1.0,:pserver:username@host.com:/cvsroot/path,module,project", refString);
}
+
+ public void testScmUri12() throws URISyntaxException {
+ URI uri = new URI("notScm:cvs:pserver:username@host.com:/cvsroot/path:module");
+ try {
+ new CVSProjectSetCapability().asReference(uri, "project");
+ fail("Expected IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ }
+ }
+ public void testScmUri13() throws URISyntaxException {
+ URI uri = new URI("scm:cvs:pserver:username@host.com:/cvsroot/path:");
+ String refString = new CVSProjectSetCapability().asReference(uri, null);
+ assertNull(refString);
+ }
+
}

Back to the top