Package CedarBackup2 :: Package extend :: Module subversion
[show private | hide private]
[frames | no frames]

Module CedarBackup2.extend.subversion

Provides an extension to back up Subversion databases.

This is a Cedar Backup extension used to back up Subversion repositories via the Cedar Backup command line. Each Subversion repository can be backed using the same collect modes allowed for filesystems in the standard Cedar Backup collect action: weekly, daily, incremental.

This extension requires a new configuration section <subversion> and is intended to be run either immediately before or immediately after the standard collect action. Aside from its own configuration, it requires the options and collect configuration sections in the standard Cedar Backup configuration file.

There are two different kinds of Subversion repositories at this writing: BDB (Berkeley Database) and FSFS (a "filesystem within a filesystem"). This extension backs up both kinds of repositories in the same way, using svnadmin dump in an incremental mode.

It turns out that FSFS repositories can also be backed up just like any other filesystem directory. If you would rather do that, then use the normal collect action. This is probably simpler, although it carries its own advantages and disadvantages (plus you will have to be careful to exclude the working directories Subversion uses when building an update to commit). Check the Subversion documentation for more information.

Author: Kenneth J. Pronovici <pronovic@ieee.org>

Classes
BDBRepository Class representing Subversion BDB (Berkeley Database) repository configuration.
FSFSRepository Class representing Subversion FSFS repository configuration.
LocalConfig Class representing this extension's configuration document.
Repository Class representing generic Subversion repository configuration..
SubversionConfig Class representing Subversion configuration.

Function Summary
  backupBDBRepository(repositoryPath, backupFile, startRevision, endRevision)
Backs up an individual Subversion BDB repository.
  backupFSFSRepository(repositoryPath, backupFile, startRevision, endRevision)
Backs up an individual Subversion FSFS repository.
  executeAction(configPath, options, config)
Executes the Subversion backup action.
  getYoungestRevision(repositoryPath)
Gets the youngest (newest) revision in a Subversion repository using svnlook.

Variable Summary
Logger logger = <logging.Logger instance at 0x3ae6038c>
str REVISION_PATH_EXTENSION = 'svnlast'
list SVNADMIN_COMMAND = ['svnadmin']
list SVNLOOK_COMMAND = ['svnlook']

Function Details

backupBDBRepository(repositoryPath, backupFile, startRevision=None, endRevision=None)

Backs up an individual Subversion BDB repository.

The starting and ending revision values control an incremental backup. If the starting revision is not passed in, then revision zero (the start of the repository) is assumed. If the ending revision is not passed in, then the youngest revision in the database will be used as the endpoint.

The backup data will be written into the passed-in back file. Normally, this would be an object as returned from open, but it is possible to use something like a GzipFile to write compressed output. The caller is responsible for closing the passed-in backup file.
Parameters:
repositoryPath - Path to Subversion repository to back up
           (type=String path representing Subversion BDB repository on disk.)
backupFile - Python file object to use for writing backup.
           (type=Python file object as from open() or file().)
startRevision - Starting repository revision to back up (for incremental backups)
           (type=Integer value >= 0.)
endRevision - Ending repository revision to back up (for incremental backups)
           (type=Integer value >= 0.)
Raises:
ValueError - If some value is missing or invalid.
IOError - If there is a problem executing the Subversion dump.

Notes:

  • This function should either be run as root or as the owner of the Subversion repository.
  • It is apparently not a good idea to interrupt this function. Sometimes, this leaves the repository in a "wedged" state, which requires recovery using svnadmin recover.

backupFSFSRepository(repositoryPath, backupFile, startRevision=None, endRevision=None)

Backs up an individual Subversion FSFS repository.

The starting and ending revision values control an incremental backup. If the starting revision is not passed in, then revision zero (the start of the repository) is assumed. If the ending revision is not passed in, then the youngest revision in the database will be used as the endpoint.

The backup data will be written into the passed-in back file. Normally, this would be an object as returned from open, but it is possible to use something like a GzipFile to write compressed output. The caller is responsible for closing the passed-in backup file.

You should only use this function to back up an FSFS repository if you want to use svnadmin dump for your backup. Use a normal filesystem copy otherwise. That will be simpler, and possibly less prone to problems like updates to the repository in the middle of a backup.
Parameters:
repositoryPath - Path to Subversion repository to back up
           (type=String path representing Subversion FSFS repository on disk.)
backupFile - Python file object to use for writing backup.
           (type=Python file object as from open() or file().)
startRevision - Starting repository revision to back up (for incremental backups)
           (type=Integer value >= 0.)
endRevision - Ending repository revision to back up (for incremental backups)
           (type=Integer value >= 0.)
Raises:
ValueError - If some value is missing or invalid.
IOError - If there is a problem executing the Subversion dump.

Note: This function should either be run as root or as the owner of the Subversion repository.

executeAction(configPath, options, config)

Executes the Subversion backup action.
Parameters:
configPath - Path to configuration file on disk.
           (type=String representing a path on disk.)
options - Program command-line options.
           (type=Options object.)
config - Program configuration.
           (type=Config object.)
Raises:
ValueError - Under many generic error conditions
IOError - If a backup could not be written for some reason.

getYoungestRevision(repositoryPath)

Gets the youngest (newest) revision in a Subversion repository using svnlook.
Parameters:
repositoryPath - Path to Subversion repository to look in.
           (type=String path representing Subversion BDB repository on disk.)
Returns:
Youngest revision as an integer.
Raises:
ValueError - If there is a problem parsing the svnlook output.
IOError - If there is a problem executing the svnlook command.

Note: This function should either be run as root or as the owner of the Subversion repository.


Variable Details

logger

Type:
Logger
Value:
<logging.Logger instance at 0x3ae6038c>                                

REVISION_PATH_EXTENSION

Type:
str
Value:
'svnlast'                                                              

SVNADMIN_COMMAND

Type:
list
Value:
['svnadmin']                                                           

SVNLOOK_COMMAND

Type:
list
Value:
['svnlook']                                                            

Generated by Epydoc 2.1 on Mon Sep 4 13:49:34 2006 http://epydoc.sf.net