Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2012-02-10 00:51:04 +0000
committerKevin Sawicki2012-02-10 00:51:04 +0000
commit056626f17e1fd11b80d11366d12311110ce2e2b7 (patch)
treed35a69de1655e3f02bab299f55644ffdb6d6a0ee /org.eclipse.egit.github.core/src/org/eclipse/egit
parent467a3e84a86fa8d19109d9bf4ddb61cedb59ea71 (diff)
downloadegit-github-056626f17e1fd11b80d11366d12311110ce2e2b7.tar.gz
egit-github-056626f17e1fd11b80d11366d12311110ce2e2b7.tar.xz
egit-github-056626f17e1fd11b80d11366d12311110ce2e2b7.zip
Support editing specific repository fields only
This overloads RepositoryService.editRepository to take a map of the fields that should be changed on the repository Bug: 371062 Change-Id: Ie13a22b6af795c58d30858c493436c51ff864e3a
Diffstat (limited to 'org.eclipse.egit.github.core/src/org/eclipse/egit')
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java
index e35cf5f2..7e9dae70 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java
@@ -700,6 +700,49 @@ public class RepositoryService extends GitHubService {
}
/**
+ * Edit given fields in repository
+ * <p>
+ * Only values in the given fields map will be updated on the repository
+ *
+ * @param owner
+ * @param name
+ * @param fields
+ * @return edited repository
+ * @throws IOException
+ */
+ public Repository editRepository(String owner, String name,
+ Map<String, Object> fields) throws IOException {
+ verifyRepository(owner, name);
+ if (fields == null)
+ throw new IllegalArgumentException("Fields cannot be null"); //$NON-NLS-1$
+
+ StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
+ uri.append('/').append(owner).append('/').append(name);
+ return client.post(uri.toString(), fields, Repository.class);
+ }
+
+ /**
+ * Edit given fields in repository
+ * <p>
+ * Only values in the given fields map will be updated on the repository
+ *
+ * @param provider
+ * @param fields
+ * @return edited repository
+ * @throws IOException
+ */
+ public Repository editRepository(IRepositoryIdProvider provider,
+ Map<String, Object> fields) throws IOException {
+ String id = getId(provider);
+ if (fields == null)
+ throw new IllegalArgumentException("Fields cannot be null"); //$NON-NLS-1$
+
+ StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
+ uri.append('/').append(id);
+ return client.post(uri.toString(), fields, Repository.class);
+ }
+
+ /**
* Fork given repository into new repository under the currently
* authenticated user.
*

Back to the top