ARCHIVE

Description

Archives data in external storage.

Usage

cm archive | arch <revspec>[ ...] [-c=<str_comment>] [--file=<base_file>]

(Extracts data from the repository and stores it on external storage.)

cm archive | arch <revspec>[ ...] --restore

(Restores previously archived revisions back into the repository.)

Options

Option / ArgumentDescription
-cSets a comment in the archive storage files to create.
--fileName prefix and (optional) path for the new archive data files.
--restoreRestores previously archived data from generated archive files. The external storage location and the externaldata.conf file must be available at the moment of the revision restoration. See Remarks for more information.
revspecOne or more revision specs. (Use 'cm help objectspec' to learn more about revspecs.)

Help

Remarks

This command extracts data from the repository database and store it on external storage, saving database space. The command can also restore (--restore) previously archived revisions back into the repository database.

Use 'cm help objectspec' to learn how to specify a revspec.

The user running this command must be the Unity VCS server administrator (repository server owner) to be allowed to complete the operation.

Every data segment from the specified revisions will be stored in a different file, with a name starting with the value defined by the --file argument. This argument can contain either a full path value including a prefix for future archive files or just this prefix value.

Once archived, the data from the specified revisions will be accessible in two ways:

  1. From the client: The client will detect if the data was archived and it will prompt the user to enter the location of the files. Users can configure the external data location by creating a file named externaldata.conf (at the standard configuration files locations, using the same rules that apply for the client.conf file) containing the paths where archived data have been located.
  2. From the server: This way users won't have to know whether the data was archived or not, since requests will be transparently resolved by the server. To do so, the administrator will create a file called externaldata.conf in the server directory and will fill it with the paths where the archived volumes are.

To unarchive (restore) a revision (or set of revisions), the archived files must be accessible from the client. Hence, it is not possible to unarchive data being resolved by the server (method 2) because the client will not be able to identify it as archived. If method 2 is used, to unarchive successfully, the administrator will have to edit the externaldata.conf server file first to remove access to the archived files which have to be unarchived.

Archive example

  1. Archive one revision: cm archive Assets/RoofTextures/Textures/Wooden_Roof_05.png --file=/Users/ruben/archive/battle

See the archived revision in the specified output path: ls -al /Users/ruben/archive/battle* -rw-r--r-- 1 ruben staff 2220039 Nov 9 10:52 /Users/ruben/archive/battle-100280-167

Unarchive (restore) example

  1. Add the output archive folder to the externaldata.conf file: vi /Users/ruben/.plastic4/externaldata.conf /Users/ruben/archive
  2. Unarchive the revision: cm archive Assets/RoofTextures/Textures/Wooden_Roof_05.png --restore

Set the PLASTICEDITOR environment variable to specify an editor for entering comments. If the PLASTICEDITOR environment variable is set, and the comment is empty, the editor will be automatically launched to allow you to specify the comment.

Reading input from stdin

The 'archive' command can read paths from stdin. To do this, pass a single dash "-". Example: cm archive -

Paths will be read until an empty line is entered. This allows you to use pipe to specify which files to archive. Example:

dir /S /B *.c | cm archive -

(In Windows, archives all .c files in the workspace.)

Examples

cm archive bigfile.zip#br:/main

(Archives the last revision of 'bigfile.zip' in branch 'main'.)

cm archive bigfile.zip#br:/main --restore

(Restores the archived revision.)

cm archive rev:myfile.pdf#cs:2 -c="big pdf file" --file=c:\arch_files\arch

(Archives the revision with changeset 2 of myfile.pdf in 'c:\archived_files' folder. The archived file name will start with 'arch' (for example, arch_11_56).)

cm find "revs where size > 26214400" --format="{item}#{branch}"

--nototal | cm archive -c="volume00" --file="volume00" -

(Archives all the files bigger than 25Mb on files starting with name 'volume00'.)