added command to disable Wiki

This commit is contained in:
Kohsuke Kawaguchi
2011-08-26 18:36:29 -07:00
parent d5e52a2468
commit 1f8e732d3a
2 changed files with 21 additions and 2 deletions

View File

@@ -207,6 +207,14 @@ public class GHRepository {
.to("/repos/show/" + owner + "/" + name);
}
/**
* Enables or disables Wiki for this repository.
*/
public void enableWiki(boolean v) throws IOException {
new Poster(root).withCredential().with("values[has_wiki]",String.valueOf(v))
.to("/repos/show/" + owner + "/" + name);
}
/**
* Deletes this repository.
*/

View File

@@ -41,8 +41,10 @@ public class AppTest extends TestCase {
public void testApp() throws IOException {
GitHub gitHub = GitHub.connect();
GHPullRequest i = gitHub.getOrganization("jenkinsci").getRepository("parameterized-trigger-plugin").getPullRequest(3);
System.out.println(i);
// tryDisablingIssueTrackers(gitHub);
// tryDisablingWiki(gitHub);
// GHPullRequest i = gitHub.getOrganization("jenkinsci").getRepository("sandbox").getPullRequest(1);
// for (GHIssueComment c : i.getComments())
@@ -87,6 +89,15 @@ public class AppTest extends TestCase {
}
}
private void tryDisablingWiki(GitHub gitHub) throws IOException {
for (GHRepository r : gitHub.getOrganization("jenkinsci").getRepositories().values()) {
if (r.hasWiki()) {
System.out.println("DISABLED "+r.getName());
r.enableWiki(false);
}
}
}
private void tryUpdatingIssueTracker(GitHub gitHub) throws IOException {
GHRepository r = gitHub.getOrganization("jenkinsci").getRepository("lib-task-reactor");
System.out.println(r.hasIssues());