mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-11 00:11:25 +00:00
Compare commits
5 Commits
github-api
...
github-api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b953d0c831 | ||
|
|
ecb71006d8 | ||
|
|
cffa552ba1 | ||
|
|
f6e7ee3253 | ||
|
|
ab2d0cebaf |
2
pom.xml
2
pom.xml
@@ -3,7 +3,7 @@
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.6</version>
|
||||
<version>1.7</version>
|
||||
<name>GitHub API for Java</name>
|
||||
<url>http://kohsuke.org/github-api/</url>
|
||||
<description>GitHub API for Java</description>
|
||||
|
||||
@@ -43,11 +43,15 @@ public abstract class GHPerson {
|
||||
*/
|
||||
protected GHRepository refreshRepository(String name) throws IOException {
|
||||
if (repositories==null) getRepositories(); // fetch the base first
|
||||
GHRepository r = root.retrieve("/repos/show/" + login + '/' + name, JsonRepository.class).wrap(root);
|
||||
GHRepository r = fetchRepository(name);
|
||||
repositories.put(name,r);
|
||||
return r;
|
||||
}
|
||||
|
||||
protected GHRepository fetchRepository(String name) throws IOException {
|
||||
return root.retrieve("/repos/show/" + login + '/' + name, JsonRepository.class).wrap(root);
|
||||
}
|
||||
|
||||
public GHRepository getRepository(String name) throws IOException {
|
||||
return getRepositories().get(name);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ import com.gargoylesoftware.htmlunit.html.HtmlInput;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlPage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -236,7 +238,19 @@ public class GHRepository {
|
||||
try {
|
||||
f.getInputByName("name").setValueAttribute(newName);
|
||||
f.submit((HtmlButton)f.getElementsByTagName("button").get(0));
|
||||
name = newName;
|
||||
|
||||
// overwrite fields
|
||||
final GHRepository r = getOwner().fetchRepository(newName);
|
||||
for (Field fi : getClass().getDeclaredFields()) {
|
||||
if (Modifier.isStatic(fi.getModifiers())) continue;
|
||||
fi.setAccessible(true);
|
||||
try {
|
||||
fi.set(this,fi.get(r));
|
||||
} catch (IllegalAccessException e) {
|
||||
throw (IllegalAccessError)new IllegalAccessError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
} catch (ElementNotFoundException e) {
|
||||
// continue
|
||||
|
||||
Reference in New Issue
Block a user