Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/swig/perl/native/Ra.pm  view on Meta::CPAN

            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;



( run in 0.509 second using v1.01-cache-2.11-cpan-39bf76dae61 )