Skip to content

Assure1::Agent::SVN Perl library

Description

Provides regular svn operations on check out directory. It tries to do this in a simplest form possible.

All operations are currently performed by running svn binary directly. Thus it is probably unportable.

For a much more powerful way of working with svn repository see SVN::Client.

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

load

Constructs SVN::Agent instance. Loads current status of the directory given by path option.

load(\%options)

Options

path   -> Path to working copy directory
svn    -> Path to svn executable
config -> Path to svn configuration

Returns

1. Object

Methods

add

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

add($file [, @cmdParams])

added

Returns array of files which are scheduled for addition.

cat

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

cat($file [, @cmdParams])

changes

Returns array of files which are changes for the next commit. Note that you can also modify this array to change next commit files.

checkout

Checks-out working copy from the REPOSITORY into directory given by path option.

checkout($repository)

commit

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

commit($message)

copy

Copy from LOCATION1 to LOCATION2 with optional command arguments (e.g. "-r 123").

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

delete

Schedules single FILE for deletion.

delete($file)

deleted

Returns array of files which are scheduled for deletion.

diff

Diffs the file against the repository.

diff($file)

info

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

info($wc)

export

Exports given repository source to path or given destination. Allows optional command arguments (e.g. -r ###)

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

list

Returns list of files for the path or given SRC (URL/working copy) and returns output. Allows optional command arguments (e.g. -R)

list($src [, @cmdParams])

merge

Merge changes to FILE from HEAD to previous REVISION.

merge($file, $revision)

missing

Returns array of files which are missing from the working directory.

modified

Returns array of files which are currently modified.

move

Move OLDFILE to NEWFILE with optional command arguments.

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

prepare_changes

Rolls modified, added and deleted arrays into changes array.

revert

Runs revert command.

status

Runs status command on path or given working copy WC and returns output as array of lines.

status($wc)

svn_import

Imports given SRC to svn DEST. Allows optional command arguments (e.g. -r ###)

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

svn_mkdir

Create svn directory. If DIR is a remote svn url MESSAGE is required.

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

unknown

Returns array of files which do not exist in svn repository.

update

Updates current working directory from the latest repository contents.

wcLocked

Checks if an svn transaction in progress within the same process by wcLock()

wcLock

Locks svn for transaction

wcUnlock

Unlocks the svn transaction previously locked by wcLock()