Motivation
IT staff or Plastic SCM admins usually need to know how big the repositories are getting. They do it for several reasons such as:
- Knowing if the project repositories are growing in order to allocate more resources such as backup storage.
- Letting teams know that they are starting to use too much storage; maybe they are adding content that shouldn't be inside the repository.
- Audit the Plastic SCM storage usage.
How to check on the repository size?
The Plastic SCM "cm find" command is capable of querying the revisions created for a given repository. It's done using the "cm find revisions" command. For more details, see: https://www.plasticscm.com/documentation/cmfind/plastic-scm-version-control-query-system-guide#Chapter7:Revisions
Using the "cm find revisions" command for each repository provides a nice view of the repositories size. Because Plastic SCM revisions can either be binary or text, the "cm find revisions" has to query for both as seen in this command:
cm find revs where date > '{0}' and type='bin' or type='txt'" --format={size} on repository '{1}' --nototal
{0}: Is the starting date for the query; all the revisions created after that date are displayed.
{1}: Is the repository used for running the query.
The "--format={size}" parameter causes the command to only return the revisions sizes if nothing else is currently needed.
On the other hand, the "cm lrep" command displays the complete list of the Plastic SCM repositories on the Plastic SCM server. The "cm find revs" query is used for each entry returned by the "cm lrep" command giving a complete overview of the space used for each repository.
Automatize it! the "plasticdatabasegrowth" Tool
The attached "plasticdatabasegrowth" tool is able to execute the manually issued commands and queries explained above. The tool retrieves the revisions size for each repository and a given date and it exports the information in a comma separated format so can be later used in a pivot spread sheet table.
Both the executable file and the source code are attached. This is an example of the usage:
plasticdatabasegrowth.exe 01/01/2018 > repoSizes.txt
The "repoSizes.txt" file has the following aspect:
Repository Name, Size (MB) growth since 01/01/2018
boatgame, 106
repository303penth, 0
repository66penth, 0
repository413penth, 0
repository437penth, 0
repository68penth, 0
gatogame, 0
Tanks/Armor, 0
Tanks, 115
...
The comma separated format allows you to use the "repoSizes.txt" file content in a pivot table making very easy to identify the more rapidly growing repositories in the last year: