From c75304637f5535e634e57d4ed933c0fdb594d890 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Fri, 28 Oct 2011 08:08:00 -0400 Subject: [PATCH] Added a list branches rpc --- src/com/gitblit/utils/RpcUtils.java | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/src/com/gitblit/utils/RpcUtils.java b/src/com/gitblit/utils/RpcUtils.java index e584151..faa910b 100644 --- a/src/com/gitblit/utils/RpcUtils.java +++ b/src/com/gitblit/utils/RpcUtils.java @@ -62,6 +62,9 @@ private static final Type SETS_TYPE = new TypeToken<Collection<FederationSet>>() { }.getType(); + private static final Type BRANCHES_TYPE = new TypeToken<Map<String, Collection<String>>>() { + }.getType(); + /** * * @param remoteURL @@ -386,6 +389,24 @@ } /** + * Retrieves a map of all branches in the Gitblit server keyed by + * repository. + * + * @param serverUrl + * @param account + * @param password + * @return + * @throws IOException + */ + public static Map<String, Collection<String>> getAllBranches(String serverUrl, + String account, char[] password) throws IOException { + String url = asLink(serverUrl, RpcRequest.LIST_BRANCHES); + Map<String, Collection<String>> allReferences = JsonUtils.retrieveJson(url, + BRANCHES_TYPE, account, password); + return allReferences; + } + + /** * Do the specified administrative action on the Gitblit server. * * @param request -- Gitblit v1.9.1