Java Code Examples for org.eclipse.jgit.transport.URIish#getHumanishName()

The following examples show how to use org.eclipse.jgit.transport.URIish#getHumanishName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GitRepoTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void should_check_out_a_branch_on_cloned_repo() throws IOException {
	URIish uri = new URIish(this.springCloudReleaseProject.toURI().toURL());
	File project = this.gitRepo.cloneProject(uri);
	new GitRepo(project).checkout("vCamden.SR3");

	File pom = new File(new File(this.tmpFolder, uri.getHumanishName()), "pom.xml");
	then(pom).exists();
	then(Files.lines(pom.toPath())
			.anyMatch(s -> s.contains("<version>Camden.SR3</version>"))).isTrue();
}
 
Example 2
Source File: GitRepoTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void should_check_out_a_branch_on_cloned_repo2() throws IOException {
	URIish uri = new URIish(this.springCloudReleaseProject.toURI().toURL());
	File project = this.gitRepo.cloneProject(uri);
	new GitRepo(project).checkout("Camden.x");

	File pom = new File(new File(this.tmpFolder, uri.getHumanishName()), "pom.xml");
	then(pom).exists();
	then(Files.lines(pom.toPath())
			.anyMatch(s -> s.contains("<version>Camden.BUILD-SNAPSHOT</version>")))
					.isTrue();
}
 
Example 3
Source File: GitPullRequestHandlerV1.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
public static String[] parseSshGitUrl(String url) throws URISyntaxException{
		String user = "", project = "";
		URIish uriish = new URIish(url);
		String[] scp = uriish.getPath().replaceFirst("^/", "").split("/", -1);;
		if(scp.length==2)
		{
			user = scp[0];
			project = uriish.getHumanishName();
		}
		return new String[]{uriish.getHost(),user,project};
}
 
Example 4
Source File: GitTest.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
protected void assertRepositoryInfo(URIish uri, JSONObject result) throws JSONException {
	assertEquals(uri.toString(), result.getJSONObject("JsonData").get("Url"));
	if (uri.getUser() != null)
		assertEquals(uri.getUser(), result.getJSONObject("JsonData").get("User"));
	if (uri.getHost() != null)
		assertEquals(uri.getHost(), result.getJSONObject("JsonData").get("Host"));
	if (uri.getHumanishName() != null)
		assertEquals(uri.getHumanishName(), result.getJSONObject("JsonData").get("HumanishName"));
	if (uri.getPass() != null)
		assertEquals(uri.getPass(), result.getJSONObject("JsonData").get("Password"));
	if (uri.getPort() > 0)
		assertEquals(uri.getPort(), result.getJSONObject("JsonData").get("Port"));
	if (uri.getScheme() != null)
		assertEquals(uri.getScheme(), result.getJSONObject("JsonData").get("Scheme"));
}
 
Example 5
Source File: GitRepo.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
private File humanishDestination(URIish projectUrl, File destinationFolder) {
	return new File(destinationFolder, projectUrl.getHumanishName());
}
 
Example 6
Source File: ProjectGitHandler.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
private File humanishDestination(URIish projectUrl, File destinationFolder) {
	return new File(destinationFolder, projectUrl.getHumanishName());
}
 
Example 7
Source File: SubtreeConfig.java    From git-merge-repos with Apache License 2.0 3 votes vote down vote up
/**
 * @param subtreeDirectory
 *            the target directory into which the repository should be
 *            merged, can be <code>"."</code> to not change the directory
 *            layout on merge
 * @param fetchUri
 *            the URI where the repository is located (a local one is
 *            preferred while experimenting with conversion, so that it does
 *            not have to be fetched multiple times)
 */
public SubtreeConfig(String subtreeDirectory, URIish fetchUri) {
	this.subtreeDirectory = subtreeDirectory;
	this.fetchUri = fetchUri;
	this.repositoryName = fetchUri.getHumanishName();
	if (this.repositoryName.isEmpty()) {
		throw new IllegalArgumentException(
				"Could not determine repository name from fetch URI: " + fetchUri);
	}
}