final String stash_destination = "http://.../repos/dummyTest/branches?filterText=" + ticket; WebAuthentication wAuth_Stash = new WebAuthentication_Stash(stash_destination); WebResource webResource_Stash = wAuth_Stash.response(); ClientResponse response_Stash = webResource_Stash.accept("application/json").type("application/json").get(ClientResponse.class); JSONObject jsonOutput_Stash = (JSONObject) JSONSerializer.toJSON(response_Stash.getEntity(String.class)); JSONArray jsonValues = jsonOutput_Stash.getJSONArray("values"); if (jsonValues.size() > 0) { return jsonValues.getJSONObject(0).containsValue(ticket); } else { return false; }
Hi,
I want to check if a branch with a certain Name already exist, what is already working. But it is so slow that it doesn't make me happy.
Does anyone know a faster method in Java?
(Sorry for the code on top of my post, but I wasn't able to get it below)
Community moderators have prevented the ability to post new answers.
Hi Nafets,
You could specify the fully qualified branch name as the until parameter on the commits REST resource. If it returns a 404 you know the branch doesn't exist in the repo.
The URL you'd need to request would look something like this: https://stash.atlassian.com/rest/api/1.0/projects/PROJECT/repos/my-repo/commits?until=refs/heads/branch
cheers,
Tim
Thank's for the answer, it's working 3 seconds faster than my solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.