-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IDEX-3128: Add posibility to get mirror repository url.
Will be used for warn user if the try contribute mirrored repository like https://github.com/apache/tomee. Also create pull request to original lib hub4j/github-api#233
- Loading branch information
Vitaly Parfonov
committed
Nov 19, 2015
1 parent
5d83090
commit 57aa90a
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...-plugin-github-ext-github/src/main/java/org/kohsuke/github/GHRepositoryWithMirrorUrl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2015 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.kohsuke.github; | ||
|
||
/** | ||
* Add mirror url original lib don't support it | ||
* | ||
* @author Vitalii Parfonov | ||
*/ | ||
@SuppressWarnings({"UnusedDeclaration"}) | ||
public class GHRepositoryWithMirrorUrl extends GHRepository { | ||
|
||
|
||
private String mirror_url; | ||
|
||
|
||
public String getMirrorUrl() { | ||
return mirror_url; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...in-github/che-plugin-github-ext-github/src/main/java/org/kohsuke/github/IsMirrorRepo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2015 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.kohsuke.github; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Return mirror url if it exist otherwise null | ||
* | ||
* @author Vitalii Parfonov | ||
*/ | ||
public class IsMirrorRepo { | ||
|
||
public static String getMirrorUrl(GitHub gitHub, String user, String repo) throws IOException { | ||
return gitHub.retrieve().to("/repos/" + user + '/' + repo, GHRepositoryWithMirrorUrl.class).getMirrorUrl(); | ||
} | ||
} |