SVN

The Agent SVN library provides regular Subversion (SVN) operations on the checkout directory in the simplest form possible, by running the SVN binary directly.

Synopsis

use Assure1::Agent::SVN;

my $branch = 'event/default';

my $svn = Assure1::Agent::SVN->load({
  path   => $BaseDir . '/var/checkouts/' . $branch,
  svn    => $BaseDir . '/vendor/svn/bin/svn',
  config => $BaseDir . '/etc/svn/'
});

# Find out modified files
print join(', ', @{$svn->modified}) . "\\n";

# Usual svn operations
$svn->add('file.pl');
$svn->commit('Message');

Constructor

The Agent SVN library contains the constructor described below.

load

Constructs SVN::Agent instance. Loads the current status of the directory specified in the path option.

load(\%options)

Options

path   - The path to the working copy directory.
svn    - The path to the SVN executable.
config - The path to the SVN configuration.

Returns

1. Object

Methods

The Agent SVN library contains the methods described below.

add

Adds a file into the repository with optional command arguments. Assumes a relative path. If the file's directory is not under SVN control, it is also added.

add($file [, @cmdParams])

added

Returns an array of files scheduled to be added.

cat

Returns cat of FILE given (svn URL/working copy) and returns raw multi-lined output.

cat($file [, @cmdParams])

changes

Returns an array of files changed for the next commit. You can also modify this array to change the next commit files.

checkout

Checks out the working copy from the repository into the directory specified in path.

checkout($repository)

commit

Commits the current changes using MESSAGE as a log message. The changes should be listed in the changes array.

commit($message)

copy

Copies a file from the first specified location to the second specified location, with optional command arguments (for example, -r 123).

copy($location1, $location2 [, @cmdParams])

delete

Schedules the specified file to be deleted.

delete($file)

deleted

Returns an array of files scheduled to be deleted.

diff

Diffs the file against the repository.

diff($file)

info

Runs the info command on path or the working copy and returns output.

info($wc)

export

Exports the specified source repository to path or the specified destination, with optional command arguments (for example, -r ###).

export($src [, $dest] [, @cmdParams])

list

Returns a list of files in the path or specified source (URL/working copy) and returns output. Allows optional command arguments (for example, -R).

list($src [, @cmdParams])

merge

Merges changes to the specified file from HEAD to the previous REVISION.

merge($file, $revision)

missing

Returns an array of files missing from the working directory.

modified

Returns an array of currently modified files.

move

Moves OLDFILE to NEWFILE with optional command arguments.

move($oldFile, $newFile [, $message] [, @cmdParams])

prepare_changes

Rolls modified, added, and deleted arrays into the changes array.

revert

Runs the revert command.

status

Runs the status command on path or the specified working copy and returns the output as an array of lines.

status($wc)

svn_import

Imports the specified $src to the SVN $dest, with optional command arguments (for example, -r ###).

svn_import($message, $src, $desc [, @cmdParams])

svn_mkdir

Creates an SVN directory. If $dir is a remote SVN URL, $msg is required.

svn_mkdir($dir [, $message] [, @cmdParams])

unknown

Returns an array of files which do not exist in the SVN repository.

update

Updates the current working directory from the latest repository contents.

wcLocked

Checks if an SVN transaction is in progress within the same process by "wcLock".

wcLock

Locks SVN for a transaction.

wcUnlock

Unlocks the SVN transaction previously locked by "wcLock".