Initial class construction

This commit is contained in:
João Narciso
2019-05-06 16:34:28 +02:00
parent 67f2d57e03
commit 431ff5f7d4
5813 changed files with 1622108 additions and 0 deletions

View File

@ -0,0 +1,118 @@
package SVN::Base;
=head1 NAME
SVN::Base - Base class for importing symbols for svn modules
=head1 SYNOPSIS
# Load the svn_ra_* functions into the SVN::Ra namespace.
package SVN::Ra;
use SVN::Base qw(Ra svn_ra_);
# Load svn_config_t structure accessors in the magic namcespace
# provided by swig, so we could use it returned by other functions
package _p_svn_config_t;
use SVN::Base qw(Core svn_config_);
=head1 DESCRIPTION
SVN::Base is a module importing the subversion perl bindings raw
symbols created by swig, into proper namespace and make them easier to
use.
It will also find the accessors for members of a C struct, create an
simpler accessor function like C<$data-E<gt>field()> and
C<$data-E<gt>field($new_value)>.
Once you understand the convention of subversion functions in perl
bindings, you could look at the subversion api and write them in perl.
The API is available in the source header files or online at
http://svn.collab.net/svn-doxygen/.
=head1 INTERNALS
The perl bindings of swig wraps raw functions into different perl
modules, for example, SVN::_Core, SVN::_Repos. Upon import, SVN::Base
bootstrap the requested module if it's not yet loaded, and iterate
over the symbols provided in that module, it them puts the function
with prefix trimmed in the namespace of the caller for this import.
The 3rd through the last parameter is a list of symbol endings that
you wish for SVN::Base not to import into your namespace. This is useful
for cases where you may want to import certain symbols differently than
normally.
=head1 CAVEATS
SVN::Base consider a function as structure member accessor if it is
postfixed ``_get'' or ``_set''. Real functions with this postfixes
will need extra handling.
=cut
sub import {
my (undef, $pkg, $prefix, @ignore) = @_;
no warnings 'uninitialized';
unless (${"SVN::_${pkg}::ISA"}[0] eq 'DynaLoader') {
@{"SVN::_${pkg}::ISA"} = qw(DynaLoader);
eval qq'
package SVN::_$pkg;
require DynaLoader;
bootstrap SVN::_$pkg;
1;
' or die $@;
};
my $caller = caller(0);
my $prefix_re = qr/(?i:$prefix)/;
my $ignore_re = join('|', @ignore);
for (keys %{"SVN::_${pkg}::"}) {
my $name = $_;
next unless s/^$prefix_re//;
next if $ignore_re && m/$ignore_re/;
# insert the accessor
if (m/(.*)_get$/) {
my $member = $1;
*{"${caller}::$1"} = sub {
&{"SVN::_${pkg}::${prefix}${member}_".
(@_ > 1 ? 'set' : 'get')}(@_)
}
}
elsif (m/(.*)_set$/) {
}
else {
*{"${caller}::$_"} = ${"SVN::_${pkg}::"}{$name};
}
}
}
=head1 AUTHORS
Chia-liang Kao E<lt>clkao@clkao.orgE<gt>
=head1 COPYRIGHT
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.
=cut
1;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,211 @@
use strict;
use warnings;
package SVN::Delta;
use SVN::Base qw(Delta svn_delta_);
=head1 NAME
SVN::Delta - Subversion delta functions
=head1 SYNOPSIS
require SVN::Core;
require SVN::Repos;
require SVN::Delta;
# driving an editor
my $editor = SVN::Delta::Editor->
new(SVN::Repos::get_commit_editor($repos, "file://$repospath",
'/', 'root', 'FOO', \&committed));
my $rootbaton = $editor->open_root(0);
my $fbaton = $editor->add_file('filea', $rootbaton,
undef, -1);
my $ret = $editor->apply_textdelta($fbaton, undef);
SVN::TxDelta::send_string("FILEA CONTENT", @$ret);
# implement an editor in perl
SVN::Repos::dir_delta($root1, $path, undef,
$root2, $path,
SVN::Delta::Editor->new(_debug=>1),
1, 1, 0, 1
=head1 DESCRIPTION
SVN::Delta wraps delta related function in subversion. The most
important one is SVN::Delta::Editor, the interface for describing tree
deltas. by default SVN::Delta::Editor relays method calls to its
internal member C<_editor>, which could either be an editor in C (such
as the one you get from get_commit_editor), or another
SVN::Delta::Editor object.
=head1 SVN::Delta::Editor
=head2 Driving Editors
If you want to drive a native editor (such as commit_editor obtained
by SVN::Repos::get_commit_editor), create a SVN::Delta::Editor object
with the native editor/baton pair. The object will then be ready to
use and its method calls will be relayed to the native editor.
=head2 Implementing Editors
If you want to implement an editor, subclass SVN::Delta::Editor and
implement the editors callbacks. see the METHODS section below.
=head2 CONSTRUCTOR - new(...)
=over
=item new($editor, $editor_baton)
Link to the native editor
=back
You can also pass a hash array to new:
=over
=item _debug
Turn on debug.
=item _editor
An arrayref of the editor/baton pair or another SVN::Delta::Editor
object to link with.
=back
=head2 METHODS
Please consult the svn_delta.h section in the Subversion API. Member
functions of svn_delta_editor_t could be called as methods of
SVN::Delta::Editor objects, with the edit_baton omitted. The pool is
also optional.
If you are subclassing, the methods take exactly the same arguments as
the member functions (note that void ** are returned data though as
throughout the perl bindings), with the edit_baton omitted.
=cut
package SVN::TxDelta;
use SVN::Base qw(Delta svn_txdelta_ apply);
*new = *SVN::_Delta::svn_txdelta;
# special case for backward compatibility. When called with an additional
# argument "md5", it's the old style and don't return the md5.
# Note that since the returned m5 is to be populated upon the last window
# sent to the handler, it's not currently working to magically change things
# in Perl land.
sub apply {
if (@_ == 5 || (@_ == 4 && ref($_[-1]) ne 'SVN::Pool' && ref($_[-1]) ne '_p_apr_pool_t')) {
splice(@_, 3, 1);
my @ret = SVN::_Delta::svn_txdelta_apply(@_);
return @ret[1,2];
}
goto \&SVN::_Delta::svn_txdelta_apply;
}
package _p_svn_txdelta_op_t;
use SVN::Base qw(Delta svn_txdelta_op_t_);
package _p_svn_txdelta_window_t;
use SVN::Base qw(Delta svn_txdelta_window_t_);
package SVN::Delta::Editor;
use SVN::Base qw(Delta svn_delta_editor_);
*invoke_set_target_revision = *SVN::_Delta::svn_delta_editor_invoke_set_target_revision;
sub convert_editor {
my $self = shift;
$self->{_editor} = $_[0], return 1
if UNIVERSAL::isa($_[0], __PACKAGE__);
if (ref($_[0]) && $_[0]->isa('_p_svn_delta_editor_t')) {
@{$self}{qw/_editor _baton/} = @_;
return 1;
}
return 0;
}
sub new {
my $class = shift;
my $self = bless {}, $class;
unless ($self->convert_editor(@_)) {
%$self = @_;
$self->convert_editor(@{$self->{_editor}})
if $self->{_editor};
}
return $self;
}
our $AUTOLOAD;
sub AUTOLOAD {
no warnings 'uninitialized';
return unless $_[0]->{_editor};
my $class = ref($_[0]);
my $func = $AUTOLOAD;
$func =~ s/.*:://;
warn "$func: ".join(',',@_)."\n" if $_[0]->{_debug};
return unless $func =~ m/[^A-Z]/;
my %ebaton = ( set_target_revision => 1,
open_root => 1,
close_edit => 1,
abort_edit => 1,
);
my $self = shift;
no strict 'refs';
my @ret = UNIVERSAL::isa($self->{_editor}, __PACKAGE__) ?
$self->{_editor}->$func(@_) :
eval { &{"invoke_$func"}($self->{_editor},
$ebaton{$func} ? $self->{_baton} : (), @_) };
die $@ if $@;
return @ret ? $#ret == 0 ? $ret[0] : [@ret] : undef;
}
=head1 BUGS
Functions returning editor/baton pair should really be typemapped to a
SVN::Delta::Editor object.
=head1 AUTHORS
Chia-liang Kao E<lt>clkao@clkao.orgE<gt>
=head1 COPYRIGHT
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.
=cut
1;

View File

@ -0,0 +1,503 @@
use strict;
use warnings;
package SVN::Fs;
use SVN::Base qw(Fs svn_fs_);
=head1 NAME
SVN::Fs - Subversion filesystem functions
=head1 DESCRIPTION
SVN::Fs wraps the functions in svn_fs.h. The actual namespace
for filesystem objects is C<_p_svn_fs_t>.
=head1 FUNCTIONS
=over
=item SVN::Fs::berkeley_logfiles($path, $only_unused)
=item SVN::Fs::berkeley_recover($path)
=item SVN::Fs::check_related($id1, $id2)
=item SVN::Fs::compare_ids($id1, $id2)
=item SVN::Fs::contents_changed($root1, $path1, $root2, $path2)
=item SVN::Fs::create($path, $config)
=item SVN::Fs::delete_fs($path)
=item SVN::Fs::deltify_revision($fs, $rev)
=item SVN::Fs::get_file_delta_stream($source_root, $source_path, $target_root, $target_path)
=item SVN::Fs::hotcopy($src_path, $dest_path, $clean)
=item SVN::Fs::initialize($pool)
=item SVN::Fs::merge($source_root, $source_path, $target_root, $target_path, $ancestor_root, $ancestor_path)
=item SVN::Fs::open($path, $config)
=item SVN::Fs::path($fs)
=item SVN::Fs::print_modules($s)
TODO - doesn't work, segfaults if $s is null, doesn't do anything if
its an empty string
=item SVN::Fs::props_changed($root1, $path1, $root2, $path2)
See also C<SVN::Fs::contents_changed>
=item SVN::Fs::purge_txn($fs, $txn_id)
Cleanup the transaction C<$txn_id>, removing it completely from
the filesystem C<$fs>.
=item SVN::Fs::set_warning_func($fs, $code, $baton)
=item SVN::Fs::unparse_id($id)
Return a string containing the unparsed form of the node or node
revision id $id, which must be a C<_p_svn_fs_id_t> object.
TODO - why isn't this a method of that object?
=item SVN::Fs::version()
TODO - what can we do with the _p_svn_version_t value returned?
=item SVN::Fs::create_access($username)
Return a new C<_p_svn_fs_access_t> object representing C<$username>.
C<$username> is presumed to have been authenticated by the caller.
=back
=cut
package _p_svn_fs_t;
=head1 _p_svn_fs_t
=over
=item $fs-E<gt>begin_txn($rev)
Creates a new transaction in the repository, and returns a
C<_p_svn_fs_txn_t> object representing it. The new transaction's
base revision will be $rev, which should be a number.
=item $fs-E<gt>change_rev_prop
=item $fs-E<gt>generate_lock_token()
Generate a unique lock-token using C<$fs>.
TODO - translate this to apply to Perl:
This can be used in to populate lock-E<gt>token before calling
svn_fs_attach_lock().
=item $fs-E<gt>get_access()
The filesystem's current access context, as a C<_p_svn_fs_access_t>
object. Returns undef if no access context has been set with
the C<set_access()> method.
=item $fs-E<gt>get_lock
=item $fs-E<gt>get_locks
=item $fs-E<gt>get_uuid()
The UUID associated with C<$fs>.
=item $fs-E<gt>list_transactions()
A reference to an array of all currently active transactions in the
filesystem. Each one is a string containing the transaction's ID,
suitable for passing to C<$fs-E<gt>open_txn()>.
=item $fs-E<gt>lock
=item $fs-E<gt>open_txn($name)
Get a transaction in the repository by name. Returns a
C<_p_svn_fs_txn_t> object.
=item $fs-E<gt>revision_prop($rev, $propname)
The value of revision property C<$propname> in revision C<$rev>.
=item $fs-E<gt>revision_proplist($rev)
A hashref containing the names and values of all revision properties
from revision C<$rev>.
=item $fs-E<gt>revision_root
=item $fs-E<gt>set_access($access)
Associate an access context with an open filesystem.
This method can be run multiple times on the same open
filesystem, in order to change the filesystem access context for
different filesystem operations. C<$access> should be
a C<_p_svn_fs_access_t> object, or undef to disassociate the
current access context from the filesystem.
=item $fs-E<gt>set_uuid($uuid)
Associate C<$uuid> with C<$fs>.
=item $fs-E<gt>unlock
=item $fs-E<gt>youngest_rev()
Return the number of the youngest revision in the filesystem.
The oldest revision in any filesystem is numbered zero.
=back
=cut
our @methods = qw/ youngest_rev revision_root revision_prop revision_proplist
change_rev_prop list_transactions open_txn begin_txn
get_uuid set_uuid set_access get_access
lock unlock get_lock get_locks generate_lock_token path /;
for (@methods) {
no strict 'refs';
*{$_} = *{"SVN::Fs::$_"};
}
package _p_svn_fs_root_t;
=head1 _p_svn_fs_root_t
=over
=item $root-E<gt>apply_text
=item $root-E<gt>apply_textdelta
=item $root-E<gt>change_node_prop($path, $propname, $value)
=item $root-E<gt>check_path($path)
Kind of node at C<$path>. A number which matches one of these constants:
$SVN::Node::none, $SVN::Node::file,
$SVN::Node::dir, $SVN::Node::unknown.
=item $root-E<gt>close_root
=item $root-E<gt>closest_copy
=item $root-E<gt>copied_from
=item $root-E<gt>copy
=item $root-E<gt>delete
=item $root-E<gt>dir_entries
=item $root-E<gt>file_contents
=item $root-E<gt>file_length
=item $root-E<gt>file_md5_checksum
=item $root-E<gt>fs()
The filesystem to which C<$root> belongs, as a C<_p_svn_fs_t> object.
=item $root-E<gt>is_dir($path)
True if there is a node at C<$path> which is a directory.
=item $root-E<gt>is_file($path)
True if there is a node at C<$path> which is a file.
=item $root-E<gt>is_revision_root()
True if the root comes from a revision (i.e., the contents has already been
committed).
=item $root-E<gt>is_txn_root()
True if the root comes from a transaction.
=item $root-E<gt>make_dir
=item $root-E<gt>make_file
=item $root-E<gt>node_created_path($path)
=item $root-E<gt>node_created_rev($path)
=item $root-E<gt>node_history($path)
TODO - _p_svn_fs_history_t
=item $root-E<gt>node_id($path)
=item $root-E<gt>node_prop($path, $propname)
=item $root-E<gt>node_proplist($path)
=item $root-E<gt>paths_changed()
A reference to a hash indicating what changes are made in the root.
The keys are the paths of the files changed, starting with C</> to
indicate the top-level directory of the repository. The values
are C<_p_svn_fs_path_change_t> objects which contain information about
what kind of changes are made.
=item $root-E<gt>revision_link
=item $root-E<gt>revision_root_revision
Revision number of the revision the root comes from.
For transaction roots, returns C<$SVN::Core::INVALID_REVNUM>.
=back
=cut
our @methods = qw/ apply_textdelta apply_text change_node_prop
check_path close_root copied_from copy
dir_entries delete file_contents closest_copy
file_length file_md5_checksum is_dir is_file
is_revision_root is_txn_root make_dir make_file
node_created_rev node_history node_id node_prop
node_proplist paths_changed revision_link
revision_root_revision /;
*fs = *SVN::Fs::root_fs;
*txn_name = *_p_svn_fs_txn_t::root_name;
for (@methods) {
no strict 'refs';
*{$_} = *{"SVN::Fs::$_"};
}
package _p_svn_fs_history_t;
use SVN::Base qw(Fs svn_fs_history_);
=head1 _p_svn_fs_history_t
=over
=item $history-E<gt>location()
In list context, a list of two items: the path to the node whose history
this is, and the revision number in which it exists. In scalar context
returns only the revision number.
=item $history-E<gt>prev($cross_copies)
=back
=cut
package _p_svn_fs_txn_t;
use SVN::Base qw(Fs svn_fs_txn_);
=head1 _p_svn_fs_txn_t
=over
=item $txn-E<gt>abort()
Abort the transaction. Any changes made in C<$txn> are discarded, and
the filesystem is left unchanged.
Note: This function first sets the state of C<$txn> to 'dead', and
then attempts to purge it and any related data from the filesystem.
If some part of the cleanup process fails, C<$txn> and some portion
of its data may remain in the database after this function returns.
Use C<$fs-E<gt>purge_txn()> to retry the transaction cleanup.
=item $txn-E<gt>base_revision()
The transaction's base revision number.
=item $txn-E<gt>change_prop($name, $value)
Add, change, or remove a property from the transaction.
If C<$value> is C<undef> then the property C<$name> is removed,
if it exists. Otherwise the property C<$name> is set to the
new value.
=item $txn-E<gt>commit
=item $txn-E<gt>name()
Full name of the revision, in the same format as can be passed
to C<$fs-E<gt>open_txn()>.
=item $txn-E<gt>prop($name)
The value of the transaction's C<$name> property.
=item $txn-E<gt>proplist()
A reference to a hash containing all the transaction's properties,
keyed by name.
=item $txn-E<gt>root()
The root directory of the transaction, as a C<_p_svn_fs_root_t> object.
=back
=cut
*commit = *SVN::Fs::commit_txn;
*abort = *SVN::Fs::abort_txn;
*change_prop = *SVN::Fs::change_txn_prop;
package _p_svn_fs_access_t;
use SVN::Base qw(Fs svn_fs_access_);
=head1 _p_svn_fs_access_t
=head2 SYNOPSIS
my $access = SVN::Fs::create_access($username);
my $access = $fs->get_access;
$fs->set_access($access);
my $username = $access->get_username;
$access->add_lock_token($token);
=head2 METHODS
=over
=item $access-E<gt>add_lock_token($token)
Push a lock-token into the access context. The
context remembers all tokens it receives, and makes them available
to fs functions.
=item $access-E<gt>get_username
The username represented by the access context.
=back
=cut
package _p_svn_fs_dirent_t;
use SVN::Base qw(Fs svn_fs_dirent_t_);
=head1 svn_fs_dirent_t
An object representing a directory entry. Values of this type are returned
as the values in the hash returned by C<$root-E<gt>dir_entries()>. They
are like L<svn_dirent_t|SVN::Core/svn_dirent_t> objects, but have less
information.
=over
=item $dirent-E<gt>id()
TODO
=item $dirent-E<gt>kind()
Node kind. A number which matches one of these constants:
$SVN::Node::none, $SVN::Node::file,
$SVN::Node::dir, $SVN::Node::unknown.
=item $dirent-E<gt>name()
The filename of the directory entry.
=back
=cut
package _p_svn_fs_path_change_t;
use SVN::Base qw(Fs svn_fs_path_change_t_);
=head1 _p_svn_fs_path_change_t
=over
=item $change-E<gt>change_kind()
The type of change made. A number which matches one of the following:
=over
=item $SVN::Fs::PathChange::modify
Content at path modified.
=item $SVN::Fs::PathChange::add
Path added in transaction.
=item $SVN::Fs::PathChange::delete
Path removed in transaction.
=item $SVN::Fs::PathChange::replace
Path removed and re-added in transaction.
=item $SVN::Fs::PathChange::reset
Ignore all previous change items for path (internal-use only).
=back
=item $change-E<gt>node_rev_id()
Node revision id of changed path. A C<_p_svn_fs_id_t> object.
=item $change-E<gt>prop_mod()
True if the properties were modified.
=item $change-E<gt>text_mod()
True if the text (content) was modified.
=back
=head1 COPYRIGHT
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.
=cut
package SVN::Fs::PathChange;
use SVN::Base qw(Fs svn_fs_path_change_);
1;

View File

@ -0,0 +1,685 @@
use strict;
use warnings;
package SVN::Ra;
use SVN::Base qw(Ra);
use File::Temp;
=head1 NAME
SVN::Ra - Subversion remote access functions
=head1 SYNOPSIS
use SVN::Core;
use SVN::Ra;
my $ra = SVN::Ra->new('file:///tmp/svntest');
print $ra->get_latest_revnum;
=head1 DESCRIPTION
SVN::Ra wraps the object-oriented C<svn_ra_plugin_t> functions,
providing access to a Subversion repository though a URL, using
whichever repository access module is appropriate.
=head1 SVN::Ra
=head2 SVN::Ra-E<gt>new(...)
The constructor creates an RA object and calls C<open> for it. Its parameters
are either a hash of options or a single value containing the URL of the
repository. Valid options are:
=over
=item url
The URL of the repository.
=item auth
An C<auth_baton> could be given to the SVN::RA object. Defaults to an
C<auth_provider> with a C<username_provider>. See L<SVN::Client> for how to
create C<auth_baton>.
=item pool
The pool for the RA session to use. Member functions will also be
called with this pool. Defaults to a newly created root pool.
=item config
The config hash that could be obtained by calling
C<SVN::Core::config_get_config(undef)>.
=item callback
The C<ra_callback> namespace to use. Defaults to SVN::Ra::Callbacks.
=back
The following examples will both do the same thing, with all the optional
arguments taking their defaults:
my $ra = SVN::Ra->new('file:///tmp/repos');
my $ra = SVN::Ra->new(url => 'file:///tmp/repos');
=head2 METHODS
Please consult the svn_ra.h section in the Subversion API. Member
functions of C<svn_ra_plugin_t> can be called as methods of SVN::Ra
objects, with the C<session_baton> and C<pool> arguments omitted.
=over
=item $ra-E<gt>change_rev_prop($revnum, $name, $value)
Sets the revision (unversioned) property C<$name> to C<$value> on
revision C<$revnum>, or removes the property if C<$value> is undef.
$ra->change_rev_prop(123, 'svn:log', 'New log message.');
Of course this will only work if there is a C<pre-revprop-change>
hook available.
=item $ra-E<gt>check_path($path, $revnum)
Kind of node at C<$path> in revision C<$revnum>. A number which matches one
of these constants:
$SVN::Node::none, $SVN::Node::file,
$SVN::Node::dir, $SVN::Node::unknown.
=item $ra-E<gt>do_diff($revision, $target, $recurse, $ignore_ancestry, $versus_url, $editor)
=item $ra-E<gt>do_diff2($revision, $target, $recurse, $ignore_ancestry, $text_deltas, $versus_url, $editor)
Both of these return a L<SVN::Ra::Reporter> with which you can describe
a working copy. It will then call methods on C<$editor> to indicates
the differences between the repository and the working copy.
The C<do_diff2> method was added in S<Subversion 1.4>. It adds the
C<$text_deltas> option, which if false disables the generation of text
deltas on the editor. With C<do_diff> text deltas are always generated.
my $reporter = $ra->do_diff(1, '', 1, 0, $repos_url,
MyEditor->new);
$reporter->set_path(...);
$reporter->finish_report;
=item $ra-E<gt>do_status($target, $revision, $recurse, $editor)
Returns a L<SVN::Ra::Reporter> to which you can describe the status of
a working copy. It will then call methods on C<$editor> to describe
the current status of the working copy compared to the repository.
=item $ra-E<gt>do_switch($revnum, $target, $recurse, $repos_url, $editor)
Returns a L<SVN::Ra::Reporter> with which you can describe a working copy.
It will then call methods on C<$editor> to indicate how to adjust the working
copy to switch it to revision C<$revnum> of C<$repos_url>.
=item $ra-E<gt>do_update($revision_to_update_to, $target, $recurse, $editor)
Returns a L<SVN::Ra::Reporter> object. Call methods on the reporter to
describe the current state of your working copy (or whatever you're
updating). After calling the reporter's C<finish_report()> method,
Subversion will generate calls to your C<$editor> to describe the
differences between what you already have and the state of the repository in
C<$revision_to_update_to>.
To update to the latest revision, pass C<$SVN::Core::INVALID_REVNUM> for
the first argument.
C<$target> should be the path to the part of the repository you are
interested in. You won't be given information about changes outside this
path. If you want everything, pass an empty string.
If C<$recurse> is true and the target is a directory, update
recursively; otherwise, update just the target and its immediate
entries, but not its child directories (if any).
All paths are relative to the URL used to open C<$ra>.
The caller may not perform any RA operations using C<$ra> before
finishing the report, and may not perform any RA operations using
C<$ra> from within the editing operations of C<$editor>.
This example shows the simplest update, where the client tells the reporter
that it has nothing to start with:
my $reporter = $ra->do_update($revnum, '', 1, MyEditor->new);
$reporter->set_path('', 0, 1, undef);
$reporter->finish_report;
=item $ra-E<gt>get_commit_editor($logmsg, $callback, $callback_baton, $lock_tokens, $keep_locks)
=item $ra-E<gt>get_commit_editor2($logmsg, $callback, $callback_baton, $lock_tokens, $keep_locks)
Return an opaque editor object for committing a new revision to the
repository. The return values should be passed to the
L<SVN::Delta::Editor|SVN::Delta/SVN::Delta::Editor> constructor to create an
editor object you can actually use. For example:
my $editor = SVN::Delta::Editor->new(
$ra->get_commit_editor(
"I'm going to commit some changes from within my Perl code.",
\&commit_callback, undef, {}, 0));
Now that you've got your editor you can call methods on it to describe
changes in the tree you want to make, such as adding directories, changing
file contents, etc. See L<SVN::Delta> for documentation of the editor
interface.
The C<$callback> function will be called during your call to the
C<$ed-E<gt>close_edit()> method, after the commit has succeeded. It will
not be called if there were no changes to commit. If you don't need it,
pass undef instead of a code ref.
C<get_commit_editor2> is identical to C<get_commit_editor> except for
the information passed to the callback function. The new version, added
in S<Subversion 1.4>, will pass the callback a single value (TODO: I
can' test this, but it's probably an object or hash ref) which contains
all the information. It also includes the error message from the
post-commit hook script, which is not available with C<get_commit_editor>.
The callback for the original version will be passed three arguments:
=over
=item *
Number of the new revision.
=item *
Date and time that the revision was committed, which will be exactly
the same value as its C<svn:date> revision property. It will be in
this format: C<2006-04-05T12:17:48.180320Z>
=item *
The name of the author who committed the revision, which will be the same
as the C<svn:author> revision property.
=back
The undef in the argument list in the example above is the baton which is
meant to be passed to the commit callback, but it isn't. This isn't a
problem since you can supply a closure as the callback so that it can get to
whatever variables you need.
The C<$logmsg> value should be a string which will be stored in the
C<svn:log> revision property. If undef is passed instead then the
new revision won't have a C<svn:log> property.
C<$lock_tokens> should be a reference to a hash mapping the paths to
lock tokens to use for them. I seems that with S<Subversion 1.2> this is
required, so if you aren't using any locks simply pass C<{}>. In
S<Subversion 1.3.1> though it seems to be necessary to I<not> pass this
argument at all.
If C<$keep_locks> is true then locks on the files committed won't be
released by the commit.
The C<get_commit_editor()> method itself returns a list of two items, the
first of which (a C<_p_svn_delta_editor_t> object) is the actual editor.
The second is the editor baton. Neither is of any use without wrapping the
pair of them in a L<SVN::Delta::Editor>.
=item $ra-E<gt>get_dated_revision($time)
TODO - this doesn't seem to work in S<Subversion 1.3>.
=item $ra-E<gt>get_dir($path, $revnum)
=item $ra-E<gt>get_dir2($path, $revnum, $dirent_fields)
Fetch the directory entries and properties of the directory at C<$path>
in revision C<$revnum>
A list of three values are returned. The first is a reference to a hash
of directory entries. The keys are the names of all the files and
directories in C<$path> (not full paths, just the filenames). The values
are L<_p_svn_dirent_t|SVN::Core/_p_svn_dirent_t> objects, with all their
fields filled in. The third parameter to C<get_dir2> allows you to
select particular fields. TODO: I don't think the constants you'd use
to construct the C<$dirent_fields> value are provided in the Perl API.
The second value is a number, which is only valid if C<$revnum> is
C<$SVN::Core::INVALID_REVNUM>. If that is the case then the latest revision
will be fetched, and the revision number (the HEAD revision) will be returned
as the second value. Otherwise the revision number returned will be
completely arbitrary.
The third value returned will be a reference to a hash of all properties
on the directory. This means I<all> properties: not just ones controlled by
the user and stored in the repository fs, but non-tweakable ones
generated by the SCM system itself (e.g. 'wcprops', 'entryprops', etc).
my ($dirents, undef, $props) = $ra->get_dir('trunk/dir', 123);
my ($dirents, $fetched_revnum, $props) = $ra->get_dir(
'trunk/dir', $SVN::Core::INVALID_REVNUM);
=item $ra-E<gt>get_file($path, $revnum, $fh)
Fetch the contents and properties of the file at C<$path> in revision
C<$revnum>. C<$fh> should be a Perl filehandle, to which the contents
of the file will be written, or undef if you don't need the file contents.
Note that C<$path> cannot end in a slash unless it is just '/'.
A list of two values are returned. The first is a number, which is only
valid if C<$revnum> is C<$SVN::Core::INVALID_REVNUM>. If that is the
case then the latest revision will be fetched, and the revision number
(the HEAD revision) will be returned as the first value. Otherwise the
number returned will be completely arbitrary.
The second value returned will be a reference to a hash of all properties
on the file. This means I<all> properties: not just ones controlled by
the user and stored in the repository fs, but non-tweakable ones
generated by the SCM system itself (e.g. 'wcprops', 'entryprops', etc).
my (undef, $props) = $ra->get_file(
'trunk/foo', 123, undef);
open my $fh, '>', 'tmp_out'
or die "error opening file: $!";
my (undef, $props) = $ra->get_file(
'trunk/foo', 123, $fh);
my ($fetched_revnum, $props) = $ra->get_file(
'trunk/foo', $SVN::Core::INVALID_REVNUM, $fh);
=item $ra-E<gt>get_file_revs($path, $start, $end, \&callback)
TODO - doesn't seem to work in Subversion 1.3
=item $ra-E<gt>get_latest_revnum
Return the number of the latest revision in the repository (HEAD).
=item $ra-E<gt>get_locations($path, $peg_revnum, \@location_revisions)
TODO - doesn't seem to work in Subversion 1.3
=item $ra-E<gt>get_lock($path)
Returns a L<_p_svn_lock_t|SVN::Core/_p_svn_lock_t> object containing
information about the lock at C<$path>, or undef if that path isn't
currently locked.
=item $ra-E<gt>get_locks($path)
TODO - doesn't seem to work in Subversion 1.3
=item $ra-E<gt>get_log(\@paths, $start, $end, $limit, $discover_changed_paths, $strict_node_history, \&callback)
For C<$limit> revisions from C<$start> to C<$end>, invoke the receiver
C<callback()> with information about the changes made in the revision
(log message, time, etc.).
The caller may not invoke any RA operations using C<$ra> from
within the callback function. They may work in some situations, but
it's not guaranteed.
The first argument can be either a single string or a reference to an
array of strings. Each of these indicates a path in the repository
which you are interested in. Revisions which don't change any of these
paths (or files below them) will be ignored. Simply pass '' if you don't
want to limit by path.
C<$start> and C<$end> should be revision numbers. If C<$start> has a lower
value than C<$end> then the revisions will be produced in ascending order
(r1, r2, ...), otherwise in descending order. If C<$start> is
C<$SVN::Core::INVALID_REVNUM> then it defaults to the latest revision.
TODO - the previous sentence should also be true of $end, but doing that
gets an error message in Subversion 1.3.
C<$limit> is a number indicating the maximum number of times that the
receiver C<callback()> should be called. If it is 0, there will be no
limit.
If C<$discover_changed_paths> is true, then information about which changes
were made to which paths is passed to C<callback()>.
If C<$strict_node_history> is true, copy history will not be traversed
(if any exists) when harvesting the revision logs for each path.
The callback function will be given the following arguments:
=over
=item *
A reference to a hash of paths changed by the revision. Only passed if
C<$discover_changed_paths> is true, otherwise undef is passed in its
place.
The hash's keys are the full paths to the files and directories changed.
The values are L<_p_svn_log_changed_path_t|SVN::Core/_p_svn_log_changed_path_t>
objects.
=item *
Revision number.
=item *
Name of user who made the change, or undef if not known.
=item *
Date and time the revision was committed.
=item *
Log message as a single string, or undef.
=item *
A pool object.
=back
This example prints some of the information received in a simple format,
showing which paths were changed in each revision, for all revisions starting
from the first:
$ra->get_log('', 1, $ra->get_latest_revnum, 0, 1, 0,
\&log_callback);
sub log_callback
{
my ($paths, $revnum, $user, $datetime, $logmsg) = @_;
print "$datetime - $user - r$revnum\n";
while (my ($path, $changes) = each %$paths) {
print $changes->action, " $path\n";
if ($changes->copyfrom_path) {
print " from ", $changes->copyfrom_path,
" r", $changes->copyfrom_rev, "\n"
}
}
print "\n";
}
=item $ra-E<gt>get_repos_root
Returns the repository's root URL. The value will not include
a trailing '/'. The returned URL is guaranteed to be a prefix of the
session's URL.
=item $ra-E<gt>get_uuid
Returns the repository's UUID as a string.
=item $ra-E<gt>lock(\%path_revs, $comment, $steal_lock, \&callback)
TODO - doesn't seem to work in Subversion 1.3.2
=item $ra-E<gt>reparent($url)
Change the root URL of the session in C<$ra> to point to a different
path. C<$url> must be in the same repository as the one C<$ra> is
already accessing.
New in S<Subversion 1.4>.
=item $ra-E<gt>replay($revnum, $low_water_mark, $send_deltas, $editor)
Call methods on C<$editor> to describe the changes made in the revisions
after C<$low_water_mark>, up to revision C<$revnum>. This is like using
C<do_update()>, except that it doesn't return a reporter object, and so
you don't have to describe a working copy to it. It assumes that you've
already got everything up to C<$low_water_mark>.
If C<$send_deltas> is true then file contents and property values will
be supplied, otherwise just filename changes.
New in S<Subversion 1.4>.
=item $ra-E<gt>rev_prop($revnum, $name)
Return the value of the unversioned property C<$name> from revision C<$revnum>.
Returns undef if there is no such property.
print $ra->rev_prop(123, 'svn:date');
=item $ra-E<gt>rev_proplist($revnum)
Returns a reference to a hash containing all the unversioned properties
of revision C<$revnum>.
my $props = $ra->rev_proplist(123);
print $props->{'svn:log'};
=item $ra-E<gt>stat($path, $revnum)
Returns a L<_p_svn_dirent_t|SVN::Core/_p_svn_dirent_t> object containing
information about the file at C<$path> in revision C<$revnum>.
=item $ra-E<gt>unlock(\%path_tokens, $break_lock, \&callback)
TODO - doesn't seem to work in Subversion 1.3.2
=back
=cut
require SVN::Client;
my $ralib = SVN::_Ra::svn_ra_init_ra_libs(SVN::Core->gpool);
# Ra methods that returns reporter
my %reporter = map { $_ => 1 } qw(do_diff do_switch do_status do_update);
our $AUTOLOAD;
sub AUTOLOAD {
my $class = ref($_[0]);
my $method = $AUTOLOAD;
$method =~ s/.*:://;
return unless $method =~ m/[^A-Z]/;
my $self = shift;
no strict 'refs';
my $func = $self->{session}->can($method)
or die "no such method $method";
my @ret = $func->($self->{session}, @_);
# XXX - is there any reason not to use \@ret in this line:
return bless [@ret], 'SVN::Ra::Reporter' if $reporter{$method};
return $#ret == 0 ? $ret[0] : @ret;
}
sub new {
my $class = shift;
my $self = bless {}, $class;
%$self = $#_ ? @_ : (url => $_[0]);
if (defined($self->{auth})) {
if (ref($self->{auth}) ne '_p_svn_auth_baton_t') {
# If the auth is already set to a auth_baton ignore it
# otherwise make an auth_baton and store the callbacks
my ($auth_baton, $auth_callbacks) =
SVN::Core::auth_open_helper($self->{auth});
$self->{auth} = $auth_baton;
$self->{auth_provider_callbacks} = $auth_callbacks;
}
} else {
# no callback to worry about with a username provider so just call
# auth_open directly
$self->{auth} = SVN::Core::auth_open(
[SVN::Client::get_username_provider()]);
}
my $pool = $self->{pool} ||= SVN::Pool->new;
my $callback = 'SVN::Ra::Callbacks';
# custom callback namespace
if ($self->{callback} && !ref($self->{callback})) {
$callback = delete $self->{callback};
}
# instantiate callbacks
$callback = (delete $self->{callback}) || $callback->new(auth => $self->{auth});
$self->{session} = SVN::_Ra::svn_ra_open($self->{url}, $callback, $self->{config} || {}, $pool);
return $self;
}
sub DESTROY { }
package _p_svn_ra_session_t;
use SVN::Base qw(Ra svn_ra_);
package SVN::Ra::Reporter;
use SVN::Base qw(Ra svn_ra_reporter2_);
=head1 SVN::Ra::Reporter
The L<SVN::Ra> methods C<do_diff>, C<do_status>, C<do_switch>, and
C<do_update> all return a SVN::Ra::Reporter object, which can be used
to describe the working copy (or other available data) which the client has.
Subversion uses this to figure out what new information should be provided
through a tree delta editor.
Objects of this class are actually simple wrappers around underlying
C<svn_ra_reporter2_t> objects and their associated baton.
=head2 METHODS
=over
=item $reporter-E<gt>set_path($path, $revision, $start_empty, $lock_token, $pool)
Describe a working copy C<$path> as being at a particular C<$revision>.
If C<$start_empty> is true and C<$path> is a directory, the
implementor should assume the directory has no entries or properties.
This will I<override> any previous C<set_path()> calls made on parent
paths. C<$path> is relative to the URL specified in C<SVN::Ra-E<gt>open()>
or C<SVN::Ra-E<gt>new()>.
If C<$lock_token> is not undef, it is the lock token for C<$path> in the WC.
All temporary allocations are done in C<$pool>.
=item $reporter-E<gt>delete_path($path, $pool)
Describe a working copy C<$path> as missing.
All temporary allocations are done in C<$pool>.
=item $reporter-E<gt>link_path($path, $url, $revision, $start_empty, $lock_token, $pool)
Like C<set_path()>, but differs in that C<$path> in the working copy
(relative to the root of the report driver) isn't a reflection of
C<$path> in the repository (relative to the URL specified when
opening the RA layer), but is instead a reflection of a different
repository C<$url> at C<$revision>.
If C<$start_empty> is true and C<$path> is a directory,
the implementor should assume the directory has no entries or props.
If C<$lock_token> is not undef, it is the lock token for C<$path> in the WC.
All temporary allocations are done in C<$pool>.
=item $reporter-E<gt>finish_report($pool)
Call this when the state report is finished; any directories
or files not explicitly 'set' are assumed to be at the
baseline revision originally passed into C<do_update()>. No other
reporting functions, including C<abort_report()>, should be called after
calling this function.
=item $reporter-E<gt>abort_report($pool)
If an error occurs during a report, this method should cause the
filesystem transaction to be aborted and cleaned up. No other reporting
methods should be called after calling this method.
=back
=cut
our $AUTOLOAD;
sub AUTOLOAD {
my $class = ref($_[0]);
$AUTOLOAD =~ s/^${class}::(SUPER::)?//;
return if $AUTOLOAD =~ m/^[A-Z]/;
my $self = shift;
no strict 'refs';
my $method = $self->can("invoke_$AUTOLOAD")
or die "no such method $AUTOLOAD";
no warnings 'uninitialized';
$method->(@$self, @_);
}
package SVN::Ra::Callbacks;
=head1 SVN::Ra::Callbacks
This is the wrapper class for C<svn_ra_callback_t>. To supply custom
callbacks to SVN::Ra, subclass this class and override the member
functions.
=cut
require SVN::Core;
sub new {
my $class = shift;
my $self = bless {}, $class;
%$self = @_;
return $self;
}
sub open_tmp_file {
local $^W; # silence the warning for unopened temp file
my ($self, $pool) = @_;
my ($fd, $name) = SVN::Core::io_open_unique_file(
( File::Temp::tempfile(
'XXXXXXXX', OPEN => 0, DIR => File::Spec->tmpdir
))[1], 'tmp', 1, $pool
);
return $fd;
}
sub get_wc_prop {
return undef;
}
=head1 AUTHORS
Chia-liang Kao E<lt>clkao@clkao.orgE<gt>
=head1 COPYRIGHT
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.
=cut
1;

View File

@ -0,0 +1,310 @@
use strict;
use warnings;
package SVN::Repos;
use SVN::Base qw(Repos svn_repos_);
=head1 NAME
SVN::Repos - Subversion repository functions
=head1 SYNOPSIS
use SVN::Core;
use SVN::Repos;
use SVN::Fs;
my $repos = SVN::Repos::open('/path/to/repos');
print $repos->fs()->youngest_rev;
=head1 DESCRIPTION
SVN::Repos wraps the object-oriented C<svn_repos_t> functions, providing
access to a Subversion repository on the local filesystem.
=head2 CONSTRUCTORS
=over
=item SVN::Repos::open($path)
This function opens an existing repository, and returns an
C<SVN::Repos> object.
=item create($path, undef, undef, $config, $fs_config)
This function creates a new repository, and returns an C<SVN::Repos>
object.
=back
=head2 METHODS
=over
=item $repos-E<gt>dump_fs($dump_fh, $feedback_fh, $start_rev, $end_rev, $incremental, $cancel_callback)
=item $repos-E<gt>dump_fs2($dump_fh, $feedback_fh, $start_rev, $end_rev, $incremental, $deltify, $cancel_callback)
Create a dump file of the repository from revision C<$start_rev> to C<$end_rev>
, store it into the filehandle C<$dump_fh>, and write feedback on the progress
of the operation to filehandle C<$feedback_fh>.
If C<$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).
If C<$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.
If C<$cancel_callback> is not C<undef>, it must be a code reference
that is called periodically to determine whether the client wishes
to cancel the dump. See L<SVN::Client/"CANCELLATION CALLBACK"> for details.
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); # Cancel Callback
close $fh;
=item $repos-E<gt>load_fs($dumpfile_fh, $feedback_fh, $uuid_action, $parent_dir, $cancel_callback);
=item $repos-E<gt>load_fs2($dumpfile_fh, $feedback_fh, $uuid_action, $parent_dir, $use_pre_commit_hook, $use_post_commit_hook, $cancel_callback);
Loads a dumpfile specified by the C<$dumpfile_fh> filehandle into the repository.
If the dumpstream contains copy history that is unavailable in the repository,
an error will be thrown.
The repository's UUID will be updated iff the dumpstream contains a UUID and
C<$uuid_action> is not equal to C<$SVN::Repos::load_uuid_ignore> and either the
repository contains no revisions or C<$uuid_action> is equal to
C<$SVN::Repos::load_uuid_force>.
If the dumpstream contains no UUID, then C<$uuid_action> is
ignored and the repository UUID is not touched.
If C<$parent_dir> is not null, then the parser will reparent all the
loaded nodes, from root to @a parent_dir. The directory C<$parent_dir>
must be an existing directory in the repository.
If C<$use_pre_commit_hook> is set, call the repository's pre-commit
hook before committing each loaded revision.
If C<$use_post_commit_hook> is set, call the repository's
post-commit hook after committing each loaded revision.
If C<$cancel_callback> is not C<undef>, it must be a code reference
that is called periodically to determine whether the client wishes
to cancel the load. See L<SVN::Client/"CANCELLATION CALLBACK"> for details.
You must at least provide C<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;
=cut
# Build up a list of methods as we go through the file. Add each method
# to @methods, then document it. The full list of methods is then
# instantiated at the bottom of this file.
#
# This should make it easier to keep the documentation and list of methods
# in sync.
my @methods = (); # List of methods to wrap
push @methods, qw(fs);
=item $repos-E<gt>fs()
Returns the C<SVN::Fs> object for this repository.
=cut
push @methods, qw(get_logs);
=item $repos-E<gt>get_logs([$path, ...], $start, $end, $discover_changed_paths, $strict_node_history, $receiver)
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:
=over
=item $self
The C<SVN::Repos> object.
=item $paths
C<undef> if $discover_changed_paths is false. Otherwise, contains a hash
of paths that have changed in this revision.
=item $rev
The revision this change occurred in.
=item $date
The date and time the revision occurred.
=item $msg
The log message associated with this revision.
=item $pool
An C<SVN::Pool> object which may be used in the function.
=back
If $strict_node_history is true then copies will not be traversed.
=back
=head2 ADDITIONAL METHODS
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.
=over
=item $repos-E<gt>get_commit_editor(...)
=item $repos-E<gt>get_commit_editor2(...)
=item $repos-E<gt>path(...)
=item $repos-E<gt>db_env(...)
=item $repos-E<gt>lock_dir(...)
=item $repos-E<gt>db_lockfile(...)
=item $repos-E<gt>hook_dir(...)
=item $repos-E<gt>start_commit_hook(...)
=item $repos-E<gt>pre_commit_hook(...)
=item $repos-E<gt>post_commit_hook(...)
=item $repos-E<gt>pre_revprop_change(...)
=item $repos-E<gt>post_revprop_change(...)
=item $repos-E<gt>dated_revision(...)
=item $repos-E<gt>fs_commit_txn(...)
=item $repos-E<gt>fs_being_txn_for_commit(...)
=item $repos-E<gt>fs_being_txn_for_update(...)
=item $repos-E<gt>fs_change_rev_prop(...)
=item $repos-E<gt>node_editor(...)
=item $repos-E<gt>dump_fs(...)
=item $repos-E<gt>load_fs(...)
=item $repos-E<gt>get_fs_build_parser(...)
=back
=cut
push @methods,
qw( version open create delete hotcopy recover3 recover2
recover db_logfiles path db_env conf_dir svnserve_conf
get_commit_editor get_commit_editor2 fs_commit_txn
lock_dir db_lockfile db_logs_lockfile hook_dir
pre_revprop_change_hook pre_lock_hook pre_unlock_hook
begin_report2 begin_report link_path3 link_path2 link_path
delete_path finish_report dir_delta2 dir_delta replay2 replay
dated_revision stat deleted_rev history2 history
trace_node_locations fs_begin_txn_for_commit2
fs_begin_txn_for_commit fs_begin_txn_for_update fs_lock
fs_unlock fs_change_rev_prop3 fs_change_rev_prop2
fs_change_rev_prop fs_revision_prop fs_revision_proplist
fs_change_node_prop fs_change_txn_prop node_editor
node_from_baton dump_fs2 dump_fs load_fs2 load_fs
authz_check_access check_revision_access invoke_authz_func
invoke_authz_callback invoke_file_rev_handler
invoke_history_func);
{
no strict 'refs';
for (@methods) {
*{"_p_svn_repos_t::$_"} = *{$_};
}
}
=head1 AUTHORS
Chia-liang Kao E<lt>clkao@clkao.orgE<gt>
=head1 COPYRIGHT
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.
=cut
1;

View File

@ -0,0 +1,557 @@
use strict;
use warnings;
package SVN::Wc;
use SVN::Base qw(Wc svn_wc_);
use SVN::Core;
=head1 NAME
SVN::Wc - Subversion working copy functions
=head1 SYNOPSIS
Incomplete
=cut
swig_init_asp_dot_net_hack($SVN::Core::gpool);
=head1 FUNCTIONS
=over 4
=item SVN::Wc::parse_externals_description3($parent_directory, $desc, $canonicalize_url, $pool);
Parse the string $desc as an C<svn:externals> value and return a reference
to an array of L<_p_svn_wc_external_item2_t|svn_wc_external_item2_t> objects.
If $canonicalize_url is true, canonicalize the C<url> member of those objects.
$parent_directory is only used in constructing error strings.
=back
=cut
=head1 OBJECTS
=cut
package _p_svn_wc_t;
=head2 svn_wc_status2_t
=over 4
=item $wcstat-E<gt>entry()
A svn_wc_entry_t object for the item. Can be undef if not under version
control.
=item $wcstat-E<gt>text_status()
An integer representing the status of the item's text. Can be one of the
$SVN::Wc::Status::* constants.
=item $wcstat-E<gt>prop_status()
An integer representing the status of the item's properties. Can be one of the
$SVN::Wc::Status::* constants.
=item $wcstat-E<gt>locked()
A boolean telling if the item is locked. A directory can be locked if a
working copy update was interrupted.
=item $wcstat-E<gt>copied()
A boolean telling if the item was copied. A file or directory can be copied if
it's scheduled for addition-with-history (or part of a subtree that is
scheduled as such).
=item $wcstat-E<gt>switched()
A boolean telling if the item was switched. A file or directory can be
switched if the switch command has been used.
=item $wcstat-E<gt>repos_text_status()
An integer representing the status of the item's text in the repository. Can
be one of the $SVN::Wc::Status::* constants.
=item $wcstat-E<gt>repos_prop_status()
An integer representing the status of the item's properties in the repository.
Can be one of the $SVN::Wc::Status::* constants.
=item $wcstat-E<gt>repos_lock()
A svn_lock_t object representing the entry's lock in the repository, if any.
=item $wcstat-E<gt>url()
The url (actual or expected) of the item.
=item $wcstat-E<gt>ood_last_cmt_rev()
An integer representing the youngest committed revision or $SVN::Core::INVALID_REVNUM is not out of date.
=item $wcstat-E<gt>ood_last_cmt_date()
The date of the most recent commit as microseconds since 00:00:00 January 1, 1970 UTC or 0 if not out of date.
=item $wcstat-E<gt>ood_kind()
An integer representing the kind of the youngest commit. Can be any of the $SVN::Node::* constants. Will be $SVN::Node::none if not out of date.
=item $wcstat-E<gt>tree_conflict()
A svn_wc_conflict_description_t object if the entry is the victim of a tree conflict or undef.
=item $wcstat-E<gt>file_external()
A boolean telling if the item is a file that was added to the working copy as an svn:externals. If file_external is TRUE, then switched is always FALSE.
=item $wcstat-E<gt>pristine_text_status()
An integer representing the status of the item's text as compared to the pristine base of the file. Can be one of the $SVN::Wc::Status::* constants.
=item $wcstat-E<gt>pristine_prop_status()
An integer representing the status of the item's properties as compared to the pristine base of the node. Can be one of the $SVN::Wc::Status::* constants.
=back
=cut
package _p_svn_wc_status2_t;
use SVN::Base qw(Wc svn_wc_status2_t_);
=head2 svn_wc_status_t
Same as svn_wc_status2_t, but without the repos_lock, url, ood_last_cmt_rev, ood_last_cmt_date, ood_kind, ood_last_cmt_author, tree_conflict, file_external, pristine_text_status, pristine_prop_status fields.
=cut
package _p_svn_wc_status_t;
use SVN::Base qw(Wc svn_wc_status_t_);
=head2 svn_wc_entry_t
=over 4
=item $wcent-E<gt>name()
Entry's name.
=item $wcent-E<gt>revision()
Base revision.
=item $wcent-E<gt>url()
URL in repository.
=item $wcent-E<gt>repos()
Canonical repository URL.
=item $wcent-E<gt>uuid()
Repository uuid.
=item $wcent-E<gt>kind()
The kind of node. One of the following constants:
$SVN::Node::none, $SVN::Node::file,
$SVN::Node::dir, $SVN::Node::unknown.
=item $wcent-E<gt>schedule()
Scheduling. One of the SVN::Wc::Schedule::* constants.
=item $wcent-E<gt>copied()
In a copied state.
=item $wcent-E<gt>deleted()
Deleted, but parent rev lags behind.
=item $wcent-E<gt>absent()
Absent -- we know an entry of this name exists, but that's all (usually this
happens because of authz restrictions)
=item $wcent-E<gt>incomplete()
For THIS_DIR entry, implies whole entries file is incomplete.
=item $wcent-E<gt>copyfrom_url()
Copyfrom location.
=item $wcent-E<gt>copyfrom_rev()
Copyfrom revision.
=item $wcent-E<gt>conflict_old()
Old version of conflicted file.
=item $wcent-E<gt>conflict_new()
New version of conflicted file.
=item $wcent-E<gt>conflict_wrk()
Working version of conflicted file.
=item $wcent-E<gt>prejfile()
Property reject file.
=item $wcent-E<gt>text_time()
Last up-to-date time for text contents (0 means no information available).
=item $wcent-E<gt>prop_time()
Last up-to-date time for properties (0 means no information available).
=item $wcent-E<gt>checksum()
Base-64 encoded checksum for the untranslated text base file, can be undef for
backwards compatibility.
=item $wcent-E<gt>cmt_rev()
Last revision this was changed.
=item $wcent-E<gt>cmt_date()
Last date this was changed.
=item $wcent-E<gt>cmt_author()
Last commit author of this item.
=back
=cut
package _p_svn_wc_entry_t;
# still need to check if the function prototype allows it to be called
# as method.
use SVN::Base qw(Wc svn_wc_entry_t_);
=head2 svn_wc_external_item2_t
=over 4
=item $ext-E<gt>target_dir()
The name of the subdirectory into which this external should be
checked out. This is relative to the parent directory that
holds this external item.
=item $ext-E<gt>url()
Where to check out from. This is possibly a relative external URL, as
allowed in externals definitions, but without the peg revision.
=item $ext-E<gt>revision()
What revision to check out,
a L<svn_opt_revision_t|SVN::Core/svn_opt_revision_t> object.
The only valid kind()s for this are $SVN::Core::opt_revision_number,
$SVN::Core::opt_revision_date, and $SVN::Core::opt_revision_head.
=item $ext-E<gt>peg_revision()
The peg revision to use when checking out,
a L<svn_opt_revision_t|SVN::Core/svn_opt_revision_t> object.
The only valid kind()s for this are $SVN::Core::opt_revision_number,
$SVN::Core::opt_revision_date, and $SVN::Core::opt_revision_head.
=back
=cut
package _p_svn_wc_external_item2_t;
use SVN::Base qw(Wc svn_wc_external_item2_t_);
=head1 CONSTANTS
=head2 SVN::Wc::Notify::Action
=over 4
=item $SVN::Wc::Notify::Action::add
Adding a path to revision control.
=item $SVN::Wc::Notify::Action::copy
Copying a versioned path.
=item $SVN::Wc::Notify::Action::delete
Deleting a versioned path.
=item $SVN::Wc::Notify::Action::restore
Restoring a missing path from the pristine text-base.
=item $SVN::Wc::Notify::Action::revert
Reverting a modified path.
=item $SVN::Wc::Notify::Action::failed_revert
A revert operation has failed.
=item $SVN::Wc::Notify::Action::resolved
Resolving a conflict.
=item $SVN::Wc::Notify::Action::skip
Skipping a path.
=item $SVN::Wc::Notify::Action::update_delete
Got a delete in an update.
=item $SVN::Wc::Notify::Action::update_add
Got an add in an update.
=item $SVN::Wc::Notify::Action::update_update
Got any other action in an update.
=item $SVN::Wc::Notify::Action::update_completed
The last notification in an update (including updates of externals).
=item $SVN::Wc::Notify::Action::update_external
Updating an external module.
=item $SVN::Wc::Notify::Action::status_completed
The last notification in a status (including status on externals).
=item $SVN::Wc::Notify::Action::status_external
Running status on an external module.
=item $SVN::Wc::Notify::Action::commit_modified
Committing a modification.
=item $SVN::Wc::Notify::Action::commit_added
Committing an addition.
=item $SVN::Wc::Notify::Action::commit_deleted
Committing a deletion.
=item $SVN::Wc::Notify::Action::commit_replaced
Committing a replacement.
=item $SVN::Wc::Notify::Action::commit_postfix_txdelta
Transmitting post-fix text-delta data for a file.
=item $SVN::Wc::Notify::Action::blame_revision
Processed a single revision's blame.
=back
=cut
# no reasonable prefix for these enums
# so we have to do them one by one to import.
package SVN::Wc::Notify::Action;
our $add = $SVN::Wc::notify_add;
our $copy = $SVN::Wc::notify_copy;
our $delete = $SVN::Wc::notify_delete;
our $restore = $SVN::Wc::notify_restore;
our $revert = $SVN::Wc::notify_revert;
our $failed_revert = $SVN::Wc::notify_failed_revert;
our $resolved = $SVN::Wc::notify_resolved;
our $skip = $SVN::Wc::notify_skip;
our $update_delete = $SVN::Wc::notify_update_delete;
our $update_add = $SVN::Wc::notify_update_add;
our $update_update = $SVN::Wc::notify_update_update;
our $update_completed = $SVN::Wc::notify_update_completed;
our $update_external = $SVN::Wc::notify_update_external;
our $status_completed = $SVN::Wc::notify_status_completed;
our $status_external = $SVN::Wc::notify_status_external;
our $commit_modified = $SVN::Wc::notify_commit_modified;
our $commit_added = $SVN::Wc::notify_commit_added;
our $commit_deleted = $SVN::Wc::notify_commit_deleted;
our $commit_replaced = $SVN::Wc::notify_commit_replaced;
our $commit_postfix_txdelta = $SVN::Wc::notify_commit_postfix_txdelta;
our $blame_revision = $SVN::Wc::notify_blame_revision;
=head2 SVN::Wc::Notify::State
=over 4
=item $SVN::Wc::Notify::State::unknown
Notifier doesn't know or isn't saying.
=item $SVN::Wc::Notify::State::unchanged
The state did not change.
=item $SVN::Wc::Notify::State::missing
The item wasn't present.
=item $SVN::Wc::Notify::State::obstructed
An unversioned item obstructed work.
=item $SVN::Wc::Notify::State::changed
Pristine state was modified.
=item $SVN::Wc::Notify::State::merged
Modified state had mods merged in.
=item $SVN::Wc::Notify::State::conflicted
Modified state got conflicting mods.
=back
=cut
package SVN::Wc::Notify::State;
use SVN::Base qw(Wc svn_wc_notify_state_);
=head2 SVN::Wc::Schedule
=over 4
=item $SVN::Wc::Schedule::normal
Nothing special here.
=item $SVN::Wc::Schedule::add
Slated for addition.
=item $SVN::Wc::Schedule::delete
Slated for deletion.
=item $SVN::Wc::Schedule::replace
Slated for replacement (delete + add)
=back
=cut
package SVN::Wc::Schedule;
use SVN::Base qw(Wc svn_wc_schedule_);
=head2 SVN::Wc::Status
=over 4
=item $SVN::Wc::Status::none
Does not exist.
=item $SVN::Wc::Status::unversioned
Is not a versioned node in this working copy.
=item $SVN::Wc::Status::normal
Exists, but uninteresting.
=item $SVN::Wc::Status::added
Is scheduled for addition.
=item $SVN::Wc::Status::missing
Under version control but missing.
=item $SVN::Wc::Status::deleted
Scheduled for deletion.
=item $SVN::Wc::Status::replaced
Was deleted and then re-added.
=item $SVN::Wc::Status::modified
Text or props have been modified.
=item $SVN::Wc::Status::merged
Local mods received repos mods.
=item $SVN::Wc::Status::conflicted
Local mods received conflicting mods.
=item $SVN::Wc::Status::ignored
A node marked as ignored.
=item $SVN::Wc::Status::obstructed
An unversioned resource is in the way of the versioned resource.
=item $SVN::Wc::Status::external
An unversioned path populated by an svn:externals property.
=item $SVN::Wc::Status::incomplete
A directory doesn't contain a complete entries list.
=back
=cut
package SVN::Wc::Status;
use SVN::Base qw(Wc svn_wc_status_);
=head1 COPYRIGHT
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.
=cut
1;