From f76fee63ed9cb3a30d3c0c092d860b1cb93a481b Mon Sep 17 00:00:00 2001
From: Gerard Smyth <gerard.smyth@gmail.com>
Date: Thu, 08 May 2014 13:09:30 -0400
Subject: [PATCH] Updated the SyndicationServlet to provide an additional option to return details of the tags in the repository instead of the commits. This uses a new 'ot' request parameter to indicate the object type of the content to return, which can be ither TAG or COMMIT. If this is not provided, then COMMIT is assumed to maintain backwards compatability. If tags are returned, then the paging parameters, 'l' and 'pg' are still supported, but searching options are currently ignored.

---
 src/main/java/com/gitblit/utils/RpcUtils.java |  137 ++++++++++++++++++++++++++++++---------------
 1 files changed, 91 insertions(+), 46 deletions(-)

diff --git a/src/main/java/com/gitblit/utils/RpcUtils.java b/src/main/java/com/gitblit/utils/RpcUtils.java
index 290be49..8220215 100644
--- a/src/main/java/com/gitblit/utils/RpcUtils.java
+++ b/src/main/java/com/gitblit/utils/RpcUtils.java
@@ -39,9 +39,9 @@
 
 /**
  * Utility methods for rpc calls.
- * 
+ *
  * @author James Moger
- * 
+ *
  */
 public class RpcUtils {
 
@@ -76,7 +76,7 @@
 	}.getType();
 
 	/**
-	 * 
+	 *
 	 * @param remoteURL
 	 *            the url of the remote gitblit instance
 	 * @param req
@@ -88,7 +88,7 @@
 	}
 
 	/**
-	 * 
+	 *
 	 * @param remoteURL
 	 *            the url of the remote gitblit instance
 	 * @param req
@@ -110,7 +110,7 @@
 
 	/**
 	 * Returns the version of the RPC protocol on the server.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -124,7 +124,7 @@
 		try {
 			protocol = JsonUtils.retrieveJson(url, Integer.class, account, password);
 		} catch (UnknownRequestException e) {
-			// v0.7.0 (protocol 1) did not have this request type 
+			// v0.7.0 (protocol 1) did not have this request type
 		}
 		return protocol;
 	}
@@ -132,7 +132,7 @@
 	/**
 	 * Retrieves a map of the repositories at the remote gitblit instance keyed
 	 * by the repository clone url.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -149,7 +149,7 @@
 
 	/**
 	 * Tries to pull the gitblit user accounts from the remote gitblit instance.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -167,7 +167,7 @@
 	/**
 	 * Tries to pull the gitblit team definitions from the remote gitblit
 	 * instance.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -184,7 +184,7 @@
 
 	/**
 	 * Create a repository on the Gitblit server.
-	 * 
+	 *
 	 * @param repository
 	 * @param serverUrl
 	 * @param account
@@ -203,9 +203,23 @@
 
 	}
 
-	/**
+    /**
+     * Create a fork of a repository.
+     *
+     * @param repository
+
+     * @return true if the action succeeded
+     * @throws IOException
+     */
+    public static boolean forkRepository(RepositoryModel repository, String serverUrl,
+                                        String account, char[] password) throws IOException {
+        return doAction(RpcRequest.FORK_REPOSITORY, repository.name, null, serverUrl, account, password);
+    }
+
+
+    /**
 	 * Send a revised version of the repository model to the Gitblit server.
-	 * 
+	 *
 	 * @param repository
 	 * @param serverUrl
 	 * @param account
@@ -221,7 +235,7 @@
 
 	/**
 	 * Delete a repository from the Gitblit server.
-	 * 
+	 *
 	 * @param repository
 	 * @param serverUrl
 	 * @param account
@@ -235,25 +249,56 @@
 				password);
 
 	}
-	
+
 	/**
 	 * Clears the repository cache on the Gitblit server.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
 	 * @return true if the action succeeded
 	 * @throws IOException
 	 */
-	public static boolean clearRepositoryCache(String serverUrl, String account, 
+	public static boolean clearRepositoryCache(String serverUrl, String account,
 			char[] password) throws IOException {
 		return doAction(RpcRequest.CLEAR_REPOSITORY_CACHE, null, null, serverUrl, account,
 				password);
 	}
 
 	/**
+	 * Reindex all tickets on the Gitblit server.
+	 *
+	 * @param serverUrl
+	 * @param account
+	 * @param password
+	 * @return true if the action succeeded
+	 * @throws IOException
+	 */
+	public static boolean reindexTickets(String serverUrl, String account,
+			char[] password) throws IOException {
+		return doAction(RpcRequest.REINDEX_TICKETS, null, null, serverUrl, account,
+				password);
+	}
+
+	/**
+	 * Reindex tickets for the specified repository on the Gitblit server.
+	 *
+	 * @param serverUrl
+	 * @param repositoryName
+	 * @param account
+	 * @param password
+	 * @return true if the action succeeded
+	 * @throws IOException
+	 */
+	public static boolean reindexTickets(String serverUrl, String repositoryName,
+			String account, char[] password) throws IOException {
+		return doAction(RpcRequest.REINDEX_TICKETS, repositoryName, null, serverUrl,
+				account, password);
+	}
+
+	/**
 	 * Create a user on the Gitblit server.
-	 * 
+	 *
 	 * @param user
 	 * @param serverUrl
 	 * @param account
@@ -269,7 +314,7 @@
 
 	/**
 	 * Send a revised version of the user model to the Gitblit server.
-	 * 
+	 *
 	 * @param user
 	 * @param serverUrl
 	 * @param account
@@ -285,7 +330,7 @@
 
 	/**
 	 * Deletes a user from the Gitblit server.
-	 * 
+	 *
 	 * @param user
 	 * @param serverUrl
 	 * @param account
@@ -297,11 +342,11 @@
 			char[] password) throws IOException {
 		return doAction(RpcRequest.DELETE_USER, null, user, serverUrl, account, password);
 	}
-	
+
 	/**
 	 * Tries to get the specified gitblit user account from the remote gitblit instance.
 	 * If the username is null or empty, the current user is returned.
-	 * 
+	 *
 	 * @param username
 	 * @param serverUrl
 	 * @param account
@@ -318,7 +363,7 @@
 
 	/**
 	 * Create a team on the Gitblit server.
-	 * 
+	 *
 	 * @param team
 	 * @param serverUrl
 	 * @param account
@@ -334,7 +379,7 @@
 
 	/**
 	 * Send a revised version of the team model to the Gitblit server.
-	 * 
+	 *
 	 * @param team
 	 * @param serverUrl
 	 * @param account
@@ -350,7 +395,7 @@
 
 	/**
 	 * Deletes a team from the Gitblit server.
-	 * 
+	 *
 	 * @param team
 	 * @param serverUrl
 	 * @param account
@@ -365,7 +410,7 @@
 
 	/**
 	 * Retrieves the list of users that can access the specified repository.
-	 * 
+	 *
 	 * @param repository
 	 * @param serverUrl
 	 * @param account
@@ -379,10 +424,10 @@
 		Collection<String> list = JsonUtils.retrieveJson(url, NAMES_TYPE, account, password);
 		return new ArrayList<String>(list);
 	}
-	
+
 	/**
 	 * Retrieves the list of user access permissions for the specified repository.
-	 * 
+	 *
 	 * @param repository
 	 * @param serverUrl
 	 * @param account
@@ -390,7 +435,7 @@
 	 * @return list of User-AccessPermission tuples
 	 * @throws IOException
 	 */
-	public static List<RegistrantAccessPermission> getRepositoryMemberPermissions(RepositoryModel repository, 
+	public static List<RegistrantAccessPermission> getRepositoryMemberPermissions(RepositoryModel repository,
 			String serverUrl, String account, char [] password) throws IOException {
 		String url = asLink(serverUrl, RpcRequest.LIST_REPOSITORY_MEMBER_PERMISSIONS, repository.name);
 		Collection<RegistrantAccessPermission> list = JsonUtils.retrieveJson(url, REGISTRANT_PERMISSIONS_TYPE, account, password);
@@ -399,7 +444,7 @@
 
 	/**
 	 * Sets the repository user access permissions
-	 * 
+	 *
 	 * @param repository
 	 * @param permissions
 	 * @param serverUrl
@@ -414,10 +459,10 @@
 		return doAction(RpcRequest.SET_REPOSITORY_MEMBER_PERMISSIONS, repository.name, permissions, serverUrl,
 				account, password);
 	}
-	
+
 	/**
 	 * Retrieves the list of teams that can access the specified repository.
-	 * 
+	 *
 	 * @param repository
 	 * @param serverUrl
 	 * @param account
@@ -431,10 +476,10 @@
 		Collection<String> list = JsonUtils.retrieveJson(url, NAMES_TYPE, account, password);
 		return new ArrayList<String>(list);
 	}
-	
+
 	/**
 	 * Retrieves the list of team access permissions for the specified repository.
-	 * 
+	 *
 	 * @param repository
 	 * @param serverUrl
 	 * @param account
@@ -442,7 +487,7 @@
 	 * @return list of Team-AccessPermission tuples
 	 * @throws IOException
 	 */
-	public static List<RegistrantAccessPermission> getRepositoryTeamPermissions(RepositoryModel repository, 
+	public static List<RegistrantAccessPermission> getRepositoryTeamPermissions(RepositoryModel repository,
 			String serverUrl, String account, char [] password) throws IOException {
 		String url = asLink(serverUrl, RpcRequest.LIST_REPOSITORY_TEAM_PERMISSIONS, repository.name);
 		Collection<RegistrantAccessPermission> list = JsonUtils.retrieveJson(url, REGISTRANT_PERMISSIONS_TYPE, account, password);
@@ -451,7 +496,7 @@
 
 	/**
 	 * Sets the repository team access permissions
-	 * 
+	 *
 	 * @param repository
 	 * @param permissions
 	 * @param serverUrl
@@ -466,11 +511,11 @@
 		return doAction(RpcRequest.SET_REPOSITORY_TEAM_PERMISSIONS, repository.name, permissions, serverUrl,
 				account, password);
 	}
-	
+
 	/**
 	 * Retrieves the list of federation registrations. These are the list of
 	 * registrations that this Gitblit instance is pulling from.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -489,7 +534,7 @@
 	/**
 	 * Retrieves the list of federation result registrations. These are the
 	 * results reported back to this Gitblit instance from a federation client.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -507,7 +552,7 @@
 
 	/**
 	 * Retrieves the list of federation proposals.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -525,7 +570,7 @@
 
 	/**
 	 * Retrieves the list of federation repository sets.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -542,7 +587,7 @@
 
 	/**
 	 * Retrieves the settings of the Gitblit server.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -559,7 +604,7 @@
 
 	/**
 	 * Update the settings on the Gitblit server.
-	 * 
+	 *
 	 * @param settings
 	 *            the settings to update
 	 * @param serverUrl
@@ -576,7 +621,7 @@
 
 	/**
 	 * Retrieves the server status object.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -593,7 +638,7 @@
 	/**
 	 * Retrieves a map of local branches in the Gitblit server keyed by
 	 * repository.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -610,7 +655,7 @@
 
 	/**
 	 * Retrieves a list of available branch feeds in the Gitblit server.
-	 * 
+	 *
 	 * @param serverUrl
 	 * @param account
 	 * @param password
@@ -634,7 +679,7 @@
 
 	/**
 	 * Do the specified administrative action on the Gitblit server.
-	 * 
+	 *
 	 * @param request
 	 * @param name
 	 *            the name of the object (may be null)

--
Gitblit v1.9.1