export
Functionality for creating standalone backups
export_backup(repo_root, revision, archive_path=None)
Export a backup to a stand-alone archive
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_root |
Path
|
The directory containing the GSB-managed repo |
required |
revision |
str
|
The commit hash or tag name of the backup to archive |
required |
archive_path |
Path
|
The full path to save the archive, including the filename and the extension. If None is provided, one will be automatically generated in the current working directory based on the repo's name and the specified revision. |
None
|
Raises:
Type | Description |
---|---|
OSError
|
If the specified repo does not exist or is not a GSB-managed repo |
ValueError
|
If the specified revision does not exist or if the given |
NotImplementedError
|
If the compression schema implied by the |
Source code in gsb/export.py
generate_archive_name(repo_name, revision, extension=None)
Programmatically generate a name for an archived backup
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_name |
str
|
The alias assigned to the GSB-managed repo |
required |
revision |
str
|
The commit hash or tag name of the backup that's being archived |
required |
extension |
str
|
The file extension for the archive (thus specifying the archive's format). If None is provided, an appropriate one will be chosen based on the operating system. |
None
|
Returns:
Type | Description |
---|---|
str
|
A (hopefully) descriptive archive filename, including a format-specifying extension |
Notes
The default choice of extension (and thus format) is:
- zip for Windows
- tar.gz for all other systems