SVN::Repos - Subversion repository functions
use SVN::Core; use SVN::Repos; use SVN::Fs; my $repos = SVN::Repos::open('/path/to/repos'); print $repos->fs()->youngest_rev;
SVN::Repos wraps the object-oriented svn_repos_t functions, providing access to a Subversion repository on the local filesystem.
svn_repos_t
This function opens an existing repository, and returns an SVN::Repos object.
SVN::Repos
This function creates a new repository, and returns an SVN::Repos object.
Create a dump file of the repository from revision $start_rev to $end_rev , store it into the filehandle $dump_fh, and write feedback on the progress of the operation to filehandle $feedback_fh.
$start_rev
$end_rev
$dump_fh
$feedback_fh
If $incremental is TRUE, the first revision dumped will be a diff against the previous revision (usually it looks like a full dump of the tree).
$incremental
If $use_deltas is TRUE, output only node properties which have changed relative to the previous contents, and output text contents as svndiff data against the previous contents. Regardless of how this flag is set, the first revision of a non-incremental dump will be done with full plain text. A dump with @a use_deltas set cannot be loaded by Subversion 1.0.x.
$use_deltas
According to svn_repos.h, the $cancel_func is a function that is called periodically and given $cancel_baton as a parameter to determine whether the client wishes to cancel the dump. You must supply undef at the very least.
$cancel_func
$cancel_baton
undef
Example:
use SVN::Core; use SVN::Repos; my $repos = SVN::Repos::open('/repo/sandbox'); open my $fh, ">/tmp/tmp.dump" or die "Cannot open file: $!\n"; my $start_rev = 10; my $end_rev = 20; my $incremental = 1; my $deltify = 1; $repos->dump_fs2($fh, \*STDOUT, # Dump file => $fh, Feedback => STDOUT $start_rev, $end_rev, # Revision Range $incremental, $deltify, # Options undef, undef); # Cancel Function close $fh;
Loads a dumpfile specified by the $dumpfile_fh filehandle into the repository. If the dumpstream contains copy history that is unavailable in the repository, an error will be thrown.
$dumpfile_fh
The repository's UUID will be updated iff the dumpstream contains a UUID and $uuid_action is not equal to $SVN::Repos::load_uuid_ignore and either the repository contains no revisions or $uuid_action is equal to $SVN::Repos::load_uuid_force.
$uuid_action
$SVN::Repos::load_uuid_ignore
$SVN::Repos::load_uuid_force
If the dumpstream contains no UUID, then $uuid_action is ignored and the repository UUID is not touched.
If $parent_dir is not null, then the parser will reparent all the loaded nodes, from root to @a parent_dir. The directory $parent_dir must be an existing directory in the repository.
$parent_dir
If $use_pre_commit_hook is set, call the repository's pre-commit hook before committing each loaded revision.
$use_pre_commit_hook
If $use_post_commit_hook is set, call the repository's post-commit hook after committing each loaded revision.
$use_post_commit_hook
If $cancel_func is not NULL, it is called periodically with $cancel_baton as argument to see if the client wishes to cancel the load.
You must at least provide undef for these parameters for the method call to work.
Example: use SVN::Core; use SVN::Repos;
my $repos = SVN::Repos::open('/repo/test_repo'); open my $fh, "/repo/sandbox.dump" or die "Cannot open file: $!\n"; my $parent_dir = '/'; my $use_pre_commit_hook = 0; my $use_post_commit_hook = 0; $repos->load_fs2($fh, \*STDOUT, $SVN::Repos::load_uuid_ignore, # Ignore uuid $parent_dir, $use_pre_commit_hook, # Use pre-commit hook? $use_post_commit_hook, # Use post-commit hook? undef, undef); close $fh;
Returns the SVN::Fs object for this repository.
SVN::Fs
Iterates over all the revisions that affect the list of paths passed as the first parameter, starting at $start, and ending at $end.
$receiver is called for each change. The arguments to $receiver are:
The SVN::Repos object.
undef if $discover_changed_paths is false. Otherwise, contains a hash of paths that have changed in this revision.
The revision this change occured in.
The date and time the revision occured.
The log message associated with this revision.
An SVN::Pool object which may be used in the function.
SVN::Pool
If $strict_node_history is true then copies will not be traversed.
The following methods work, but are not currently documented in this file. Please consult the svn_repos.h section in the Subversion API for more details.
Chia-liang Kao <clkao@clkao.org>
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
To install Alien::SVN, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Alien::SVN
CPAN shell
perl -MCPAN -e shell install Alien::SVN
For more information on module installation, please visit the detailed CPAN module installation guide.