Alien-SVN

 view release on metacpan or  search on metacpan

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

use strict;
use warnings;

use SVN::Core;
use SVN::Wc;

package SVN::Client;
my @_all_fns;
BEGIN {
    @_all_fns =
        qw( add add2 add3 add4 add_to_changelist blame blame2 blame3 blame4
            cat cat2 checkout checkout2 checkout3 cleanup
            commit commit2 commit3 commit4 copy copy2 copy3 copy4
            create_context delete delete2 delete3 diff diff2 diff3 diff4
            diff_peg diff_peg2 diff_peg3 diff_peg4
            diff_summarize diff_summarize2 diff_summarize_dup
            diff_summarize_peg diff_summarize_peg2
            export export2 export3 export4 import import2 import3
            info info2 invoke_blame_receiver invoke_blame_receiver2
            invoke_diff_summarize_func list list2 lock
            log log2 log3 log4 log5 ls ls2 ls3
            merge merge2 merge3 merge_peg merge_peg2 merge_peg3
            mkdir mkdir2 mkdir3 mkdir4 move move2 move3 move4 move5
            open_ra_session propget propget2 propget3
            proplist proplist2 proplist3 propset propset2 propset3
            relocate remove_from_changelist resolve resolved
            revert revert2 revprop_get revprop_list revprop_set
            status status2 status3 status4 switch switch2
            unlock update update2 update3 update4
            url_from_path uuid_from_path uuid_from_url version
          );

    require SVN::Base;
    import SVN::Base (qw(Client svn_client_), @_all_fns);
}

=head1 NAME

SVN::Client - Subversion client functions

=head1 SYNOPSIS

    use SVN::Client;
    my $client = new SVN::Client(
      auth => [
          SVN::Client::get_simple_provider(),
          SVN::Client::get_simple_prompt_provider(\&simple_prompt,2),
          SVN::Client::get_username_provider()
      ]);

    $client->cat(\*STDOUT, 
              'http://svn.apache.org/repos/asf/subversion/trunk/README', 'HEAD');

    sub simple_prompt {
      my ($cred, $realm, $default_username, $may_save, $pool) = @_;

      print "Enter authentication info for realm: $realm\n";
      print "Username: ";
      my $username = <>;
      chomp($username);
      $cred->username($username);
      print "Password: ";
      my $password = <>;
      chomp($password);
      $cred->password($password);
    }

=head1 DESCRIPTION

SVN::Client wraps the highest level of functions provided by
subversion to accomplish specific tasks in an object oriented API.
Methods are similar to the functions provided by the C API and
as such the documentation for it may be helpful in understanding
this interface.

There are a few notable differences from the C API.  Most C function
calls take a svn_client_ctx_t pointer as the next to last parameter.
The Perl method calls take a SVN::Client object as the first parameter.
This allows method call invocation of the methods to be possible.  For
example, the following are equivalent:

  SVN::Client::add($client,$path, $recursive, $pool);
  $client->add($path, $recursive, $pool);

Many of the C API calls also take a apr_pool_t pointer as their last
argument.  The Perl bindings generally deal with this for you and

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

returns a svn_client_commit_info_t object.

If $src_path is a working copy path

* $dst_path must also be a working copy path (existent or not).

* $src_revision is ignored and may be undef.  The log_msg callback will
not be called.

* This is a scheduling operation.  No changes will happen to the repository
until a commit occurs.  This scheduling can be removed with $client-E<gt>revert().
If $src_path is a file it is removed from the working copy immediately.
If $src_path is a directory it will remain in the working copy but all
files, and unversioned items, it contains will be removed.

* If $src_path contains locally modified and/or unversioned items and $force is
not set, the copy will raise an error.  If $force is set such items will be
removed.

The notify callback will be called twice for each item moved, once to
indicate the deletion of the moved node, and once to indicate the addition
of the new location of the node.

=item $client-E<gt>propget($propname, $target, $revision, $recursive, $pool);

Returns a reference to a hash containing paths or URLs, prefixed by $target (a
working copy or URL), of items for which the property $propname is set, and
whose values represent the property value for $propname at that path.

=item $client-E<gt>proplist($target, $revision, $recursive, $pool);

Returns a reference to an array of svn_client_proplist_item_t objects.

For each item the node_name member of the proplist_item object contains
the name relative to the same base as $target.

If $revision is undef, then get properties from the working copy, if
$target is a working copy, or from the repository head if $target is a URL.
Else get the properties as of $revision.

If $recursive is false, or $target is a file, the returned array will only
contain a single element.  Otherwise, it will contain one entry for each
versioned entry below (and including) $target.

If $target is not found, raises the $SVN::Error::ENTRY_NOT_FOUND error.

=item $client-E<gt>propset($propname, $propval, $target, $recursive, $pool);

Set $propname to $propval on $target (a working copy or URL path).

If $recursive is true, then $propname will be set recursively on $target
and all children.  If $recursive is false, and $target is a directory,
$propname will be set on B<only> $target.

A $propval of undef will delete the property.

If $propname is an svn-controlled property (i.e. prefixed with svn:),
then the caller is responsible for ensuring that $propval is UTF8-encoded
and uses LF line-endings.

=item $client-E<gt>relocate($dir, $from, $to, $recursive, $pool);

Modify a working copy directory $dir, changing any repository URLs that
begin with $from to begin with $to instead, recursing into subdirectories if
$recursive is true.

Has no return.

=item $client-E<gt>resolved($path, $recursive, $pool);

Removed the 'conflicted' state on a working copy path.

This will not semantically resolve conflicts; it just allows $path to be
committed in the future.  The implementation details are opaque.  If
$recursive is set, recurse below $path, looking for conflicts to
resolve.

If $path is not in a state of conflict to begin with, do nothing.

If $path's conflict state is removed, call the notify callback with the
$path.

=item $client-E<gt>revert($paths, $recursive, $pool);

Restore the pristine version of a working copy $paths, effectively undoing
any local mods.

For each path in $paths, if it is a directory and $recursive
is true, this will be a recursive operation.

=item $client-E<gt>revprop_get($propname, $url, $revision, $pool);

Returns two values, the first of which is the value of $propname on revision
$revision in the repository represented by $url.  The second value is the
actual revision queried.

Note that unlike its cousin $client-E<gt>propget(), this routine doesn't affect
working copy at all; it's a pure network operation that queries an
B<unversioned> property attached to a revision.  This can be used to query
log messages, dates, authors, and the like.

=item $client-E<gt>revprop_list($url, $revision, $pool);

Returns two values, the first of which is a reference to a hash containing
the properties attached to $revision in the repository represented by $url.
The second value is the actual revision queried.

Note that unlike its cousin $client-E<gt>proplist(), this routine doesn't read a
working copy at all; it's a pure network operation that reads B<unversioned>
properties attached to a revision.

=item $client-E<gt>revprop_set($propname, $propval, $url, $revision, $force, $pool);

Set $propname to $propval on revision $revision in the repository represented
by $url.

Returns the actual revision affected.  A $propval of undef will delete the
property.

If $force is true, allow newlines in the author property.

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

=item $client-E<gt>invoke_diff_summarize_func(...)

=item $client-E<gt>list(...)

=item $client-E<gt>list2(...)

=item $client-E<gt>ls2(...)

=item $client-E<gt>ls3(...)

=item $client-E<gt>merge2(...)

=item $client-E<gt>merge3(...)

=item $client-E<gt>merge_peg(...)

=item $client-E<gt>merge_peg2(...)

=item $client-E<gt>merge_peg3(...)

=item $client-E<gt>move2(...)

=item $client-E<gt>move3(...)

=item $client-E<gt>move4(...)

=item $client-E<gt>move5(...)

=item $client-E<gt>open_ra_session(...)

=item $client-E<gt>propget2(...)

=item $client-E<gt>propget3(...)

=item $client-E<gt>proplist2(...)

=item $client-E<gt>proplist3(...)

=item $client-E<gt>propset2(...)

=item $client-E<gt>propset3(...)

=item $client-E<gt>remove_from_changelist(...)

=item $client-E<gt>resolve(...)

=item $client-E<gt>revert2(...)

=item $client-E<gt>switch2(...)

=item $client-E<gt>unlock(...)

=item $client-E<gt>version(...)

=back

=head1 TODO

* Better support for the config.

* Unit tests for cleanup, diff, export, merge, move, relocate, resolved
and switch.  This may reveal problems for using these methods as I haven't
tested them yet that require deeper fixes.

=head1 AUTHORS

Chia-liang Kao E<lt>clkao@clkao.orgE<gt>

Ben Reser E<lt>ben@reser.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;



( run in 0.425 second using v1.01-cache-2.11-cpan-71847e10f99 )