we've got a large number of repos and I would like to get an overview of the sizes of each of these repos. Is there a way to get the repository size available under settings/repository details via REST API call?
Hi Robbin,
Unfortunately that information isn't directly accessible via any Stash REST API:
It would be trivial to add this to a plugin - you just need to expose this method:
https://developer.atlassian.com/static/javadoc/stash/latest/api/reference/com/atlassian/stash/repository/RepositoryService.html#getSize%28com.atlassian.stash.repository.Repository%29
Let me know if you're interesting, I'm happy to show you how this could be done.
Cheers,
Charles
hi, I tried last time to write plugins, and currently I simply don't have the time right now to learn java, eclipse, maven etc all things that are needed to write plugins. If you can show me to to get the repository size count from stash that would be appreciated.
Try this:
https://bitbucket.org/cofarrell/stash-repo-size-plugin/downloads#download-318851
Instructions here:
https://bitbucket.org/cofarrell/stash-repo-size-plugin/overview
that was exactly what I needed! Could be nice if the rawSize and size were parameters for /rest/reposize/latest/projects/$proj/repos/$repo, but this absolutely works! thank you, it's very much appreciated.
Looks like bit bucket makes following simple AJAX call (http get) when it tries to get the aprox size on it's UI:
https://<Git URL>/projects/<project name>/repos/<repo name>/sizes
It can easily be converted to a curl and can work as an API...
Yes this is do-able gives back the following json
{u'attachments': 0, u'repository': 642}
Thanks for the answer, i guess this can change at any time but it's better than nothing.
I have a small python script that will get you this info:
https://github.com/gsj889/bitbucket-repo-size
It looks like you're new here. Sign in or register to get started.