Symptoms:
- My storage consumption is too high and I need to remove content.
- I have old projects whose history I don't need.
- I want to clean up the dashboard.
Cause:
Working with Unity Version Control will inevitably mean submitting content to the cloud server and making the storage consumption grow. This means that the cost will increase as time goes on.
The pricing costs can be found here.
Resolution:
To reduce content from the servers, users have three options:
- Removing specific revisions of a file - "cm archive" command.
- Removing old revisions for multiple file types - "cm purge" command.
- Removing repositories completely - Delete option.
The "cm archive" command.
This command allows you to select one specific file to extract it from the server and store it in an external location. The metadata in the server will be kept, so history and traceability will not be affected, but the data itself will not be there. Keep in mind that accessing a changeset with its content archived will be impossible without unarchiving it.
To archive a revision you need to run the "cm archive <revspec> [--file=pathtostore]", which will store the revision specified in the location specified. For example:
cm archive rev:myfile.fbx#cs:14 --file=c:\arch_files\arch
This will store the "myfile.fbx" revision of the file that was created in changeset 14 in the path specified.
You could specify the changeset where the revision is:
cm archive rev:myfile.fbx#cs:32 -c="Storing unused .fbx file" --file=c:\arch_files\arch
You can also concatenate the output of a "cm find" to a "cm archive" command and run it for multiple files as shown here:
cm find "revs where size > 26214400" --format="{item}#{branch}" \ --nototal | cm archive -c="c:\arch_files\arch" --file="test" -
In this case, it will archive all the files bigger than 25 MB that start with the name 'test'.
If you want to restore old revisions, then you need to run the command with the "--restore" option.
The "cm purge" command.
This command allows you to specify a certain point in time and a file extension and remove all the revisions that fit those extensions added before the time specified, always keeping at least the latest valid version. It will also keep any revision that is at the head of the branch or in a labeled changeset, as those are assumed to be important revisions.
To run the purge operation, you first need to register it with the "cm purge register <extension> <date> [--repository=repname]". For example:
cm purge register ".fbx" "2023-Dec-31 00:00 AM" --repository=myGame
This command will register a purge that will remove all of the ".fbx" revisions of all the files added before the specified date in the "myGame" repository. When you execute it, it will give you a GUID that you will need to execute it and can be shown with the "cm purge show" command.
cm purge show a7919afc-45af-4c58-a5b8-c54c32f1c0ea PurgeId: a7919afc-45af-4c58-a5b8-c54c32f1c0ea Repository: myGame Author: heber Status: ReadyToPurge Purge size: 52 revisions, 5.290.06 MB .fbx: 52 revisions, 5.290.06 MB
Once you are happy with the purge operation you have configured, you need to run it with the "cm purge execute GUID"
>cm purge execute a7919afc-45af-4c58-a5b8-c54c32f1c0ea PurgeId: a7919afc-45af-4c58-a5b8-c54c32f1c0ea Repository: myGame Author: heber Status: ReadyToPurge Purge size: 52 revisions, 5.290.06 MB .fbx: 52 revisions, 5.290.06 MB
Lastly, you can check the history of the purge operations run in your server with the "cm purge history" command.
Keep in mind that this operation is irreversible, and the content purged cannot be recovered in any way.
Delete option.
If you don't need to keep anything from the repository, you could completely wipe it out.
To do so, you can either use the cloud dashboard or the client app.
More information:
Keep in mind that the data deletion is applied at the time you run the command. But note that you cannot change the consumption that already happened in the current billing cycle before the data deletion.
As with any other command line command, using the "--help" flag will show you the in-console documentation, with explanations and examples.