SVN-Mirror

 view release on metacpan or  search on metacpan

t/test_repo.dump  view on Meta::CPAN

* [=svn status]

  $ svn status
    L    ./abc.c               # svn ¦b .svn ¥Ø¿ý¤¤, ¦³ abc.c ªºÂê©w
  M      ./bar.c               # bar.c ªº¤º®e, ¦³¥»¦aºÝªºÅܧó
   M     ./baz.c               # baz.c ¤wÅܧó¤F©Ê½è, ¦ý¬O¨S¦³¤º®eªº§ó°Ê
  ?      ./foo.o               # svn ¨Ã¥¼ºÞ²z foo.o
  !      ./some_dir            # svn ºÞ²z¥¦, ¦ý¬O¤£¬O¤£¨£¤F, ´N¬O¤£§¹¾ã
  ~      ./qux                 # ¯Ç¤JºÞ²zªº¬O¥Ø¿ý, ¦ý¬O³o¸Ì¬OÀÉ®×, ©Î¬O¬Û¤Ïªº±¡ªp
  A  +   ./moved_dir           # ·s¼W¶µ¥Ø, ¨Ã¥H¨Ó·½ªº¾ú¥v¬ö¿ý¬°¨ä¾ú¥v¬ö¿ý
  M  +   ./moved_dir/README    # ·s¼W¶µ¥Ø, ¨Ï¥Î¨Ó·½ªº¾ú¥v¬ö¿ý, ¦A¥[¤W¥»¦a§ó°Ê
  D      ./stuff/fish.c        # ¥»Àɮפw¹w©w­n³Q§R°£
  A      ./stuff/loot/bloo.h   # ¥»Àɮפw¹w©w­n³Q·s¼W
  C      ./stuff/loot/lump.c   # ³o­ÓÀɮצ³¦]§ó·s¦Ó²£¥Íªº½Ä¬ð
      S  ./stuff/squawk        # ³o­ÓÀɮשΥؿý¤w¤Á´«¨ì¤À¤ä

----
== À˵ø§ó°Ê (II) ==
** [=svn status]: ¥[¤W -v Åã¥Ü§ó¦hªº¸ê°T

  $ svn status --verbose
  M               44        23    sally     ./README
                  44        30    sally     ./INSTALL
  M               44        20    harry     ./bar.c
                  44        18    ira       ./stuff
                  44        35    harry     ./stuff/trout.c
  D               44        19    ira       ./stuff/fish.c
                  44        21    sally     ./stuff/things
  A                0         ?     ?        ./stuff/things/bloo.h
                  44        36    harry     ./stuff/things/gloo.c

*** Åã¥Ü­×­qª©½s¸¹
*** Åã¥Ü§ó°ÊÀɮתº¤H
----
== À˵ø§ó°Ê (III) ==
* À˵ø§Aªº§ó°Ê
** svn diff: Åã¥Ü©Ò§@ªº§ó°Ê
*** ³s©Ê½èªº§ó°Ê¤]·|Åã¥Ü
*** Åã¥Ü©Ò¦³¥»¦a¤u§@½Æ¥»ªº¥Ø¿ý»PÀÉ®×®t²§
      % svn diff
*** Åã¥ÜÀÉ®×®wªº 3 ¸¹­×­qª©ªº foo.pl »P¤u§@½Æ¥»ªº foo.pl ¤§¶¡ªº®t²§
      % svn diff -r 3 foo.pl
*** Åã¥ÜÀÉ®×®w¤¤ªº foo.pl ªº 2 ¸¹»P 3 ¸¹­×­qª©¤§¶¡ªº®t²§, µL»Ý¦s¨ú¥»¦a½Æ¥»
      % svn diff -r 2:3 foo.pl
----
== ¦^´_§ó°Ê ==
* ¦^´_¬YÀɮתº§ó°Ê
** §¹¥þ¤£»Ý­nºô¸ô
    % svn revert foo.pl
----
== °e¥æ§ó°Ê ==
* °e¥æ§Ú­Ì©Ò§@ªº§ó°Ê
    % svn commit
* ¦b©R¥O¦C´£¨Ñ°e¥æ°T®§
    % svn commit -m "Commit log message"
* °e¥æ¤§«á, ¤u§@½Æ¥»¥Ø¿ý¤£·|¦Û°Ê§ó·s
----
== ÃöÁä¦r®i¶} ==
* ¦p¦ó¨Ï¥ÎÃöÁä¦r®i¶}
** ³]©wÀɮתº©Ê½è
  % svn propset svn:keywords Id foo.pl
** ¥i¨Ï¥ÎªºÃöÁä¦r
*** URL, HeadURL
*** Author, LastChangedBy
*** Date, LastChangedDate
*** Rev, LastChangedRevision
*** Id
----
== ÀÉ®×®w¥Ø¿ý¬[ºc ==

* ¨ä¤@
  /repos/project1/trunk
  /repos/project1/branches
  /repos/project1/tags
  /repos/project2/trunk
  /repos/project2/branches
  /repos/project2/tags
* ¨ä¤G
  /repos/trunk/project1
  /repos/trunk/project2
  /repos/branches/project1
  /repos/branches/project2
  /repos/tags/project1
  /repos/tags/project2
----
== ¼Ð°O»P¤À¤ä ==

* ·G»ù½Æ¥»
** ³t«×«Ü§Ö
** ¥u¬O³sµ²¦Ó¤w
* ¼Ð°O»P¤À¤ä´N¥u¬O½Æ»s¦Ó¤w
  % svn cp http://svn.host/repos/proj/trunk \
           http://svn.host/repos/proj/branches/add-new-features
  % svn cp http://svn.host/repos/proj/trunk \
           http://svn.host/repos/proj/tags/0.0.1
* ¼Ð°O»P¤À¤äªº®t§O
** ¼Ð°O¤£¦A§ó°Ê
** ¤À¤ä±N¦¨¬°¥t¤@¤äµo®i½u
----
== ¨Ï¥Î¤À¤ä ==

* ª½±µ¨Ï¥Î checkout ©R¥O
** ª½±µ¨Ï¥Î¤À¤ä¥Ø¿ý
  % svn co http://svn.host/repos/proj/branches/add-new-features
** ¥t¦æ«ü©w¤À¤ä¥Ø¿ý
  % svn co http://svn.host/repos/proj/branches/add-new-features proj
* ¤w¦³¥D¤À¤äªº¤u§@½Æ¥»
** ¨Ï¥Î svn switch
  % svn switch http://svn.host/repos/proj/branches/add-new-features
----
== ¦X¨Ö¤À¤ä ==

* ¤À¤ä¤u§@¤w§¹¦¨, ¸Ó¦X¨Ö¦^¥Dµo®i½u
* ¨Ï¥Î merge ©R¥O
* ³Ì±`¥Çªº¿ù»~
  % svn merge \
    http://svn.host/repos/proj/branches/add-new-features \
    http://svn.host/repos/proj/trunk
* ¥¿½Tªº§@ªk
  % svn merge -r REV1:REV2 \
    http://svn.host/repos/proj/branches/add-new-features

t/test_repo.dump  view on Meta::CPAN

    }

	# 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

Copyright (c) 2003 CollabNet.  All rights reserved.

This software is licensed as described in the file COPYING, which you
should have received as part of this distribution.  The terms are also
available at http://subversion.tigris.org/license-1.html.  If newer
versions of this license are posted there, you may use a newer version
instead, at your option.

This software consists of voluntary contributions made by many
individuals.  For exact contribution history, see the revision history
and logs, available at http://subversion.tigris.org/.

=cut

1;


Node-path: svnperl/perl/Client.pm
Node-kind: file
Node-action: add
Prop-content-length: 35
Text-content-length: 15544
Text-content-md5: a70873df186fb9dda0c7b4f102f58e78
Content-length: 15579

K 12
svn:keywords
V 2
Id
PROPS-END
use SVN::Core;

package SVN::Client;
use SVN::Base(qw(Client svn_client_ checkout update switch add mkdir delete
                 commit status log blame diff merge cleanup relocate
                 revert resolved copy move revprop_set propset
                 proplist revvprop_list export ls cat import)); 

=head1 NAME

SVN::Client - Subversion client functions

=head1 SYNOPSIS

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

    $ctx->cat (\*STDOUT, 'http://svn.collab.net/repos/svn/trunk/README', 
               'HEAD');

    sub simple_prompt {
      my $cred = shift;
      my $realm = shift;
      my $default_username = shift;
      my $may_save = shift;
      my $pool = shift;

      print "Enter authentication info for realm: $realm\n";
      print "Username: ";
      my $username = <>;
      chop($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.

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
you do not need to pass a pool parameter.  However, you may still
pass a pool parameter as the last parameter to override the automatic
handling of this for you.

Users of this interface should not directly manipulate the underlying hash
values but should use the respective attribute methods.  Many of these
attribute methods do other things, especially when setting an attribute,
besides simply manipulating the value in the hash.

t/test_repo.dump  view on Meta::CPAN


=cut

sub new
{
    my $class = shift;
    my $self = bless {}, $class;
    my %args = @_;

    $self->{'ctx'} = SVN::_Client::new_svn_client_ctx_t ();

    if (defined($args{'auth'}))
    {
        $self->auth($args{'auth'});
    } else {
        $self->auth([SVN::Client::get_username_provider(),
                     SVN::Client::get_simple_provider(),
                     SVN::Client::get_ssl_server_trust_file_provider(),
                     SVN::Client::get_ssl_client_cert_file_provider(),
                     SVN::Client::get_ssl_client_cert_pw_file_provider(),
                    ]);
    }

    {
        my $pool_type = ref($args{'pool'});
        if ($pool_type eq 'SVN::Pool' ||
            $pool_type eq '_p_apr_pool_t') 
        {
            $self->{'pool'} = $args{'pool'};
        } else {
            $self->{'pool'} = new SVN::Pool();
        }
    }

    # If we're passed a config use it, otherwise get the default
    # config.
    if (defined($args{'config'}))
    {
        if (ref($args{'config'}) eq 'HASH')
        {
            $self->config($args{'config'});
        }
    } else {
        $self->config(SVN::Core::config_get_config(undef));
    }
    return $self;
}

=item $ctx->cat(\*FILEHANDLE, path_or_url, revision, pool);

Outputs the content of the file identified by path_or_url and revision to the
FILEHANDLE.  FILEHANLDE is a reference to a filehandle.  revision should be a
number or 'HEAD'.  pool is an optional parameter.

=cut

# import methods into our name space and wrap them in a closure
# to support method calling style $ctx->log()
foreach my $function (qw(checkout update switch add mkdir delete commit
                       status log blame diff merge cleanup relocate
                       revert resolved copy move revprop_set propset
                       proplist revvprop_list export ls cat import))
{

    my $real_function = \&{"SVN::_Client::svn_client_$function"};
    *{"SVN::Client::$function"} = sub
    {
        # Allows import to work while not breaking use SVN::Client.
        if ($function eq 'import')
        {
            if (ref($_[$[]) ne 'SVN::Client')
            {
                return;
            }
        }

        my $self = shift;
        my @args;

        if (ref($_[$#_]) eq '_p_apr_pool_t')
        {
            # if we got a pool pased to us we need to
            # leave it off until we add the ctx first
            # so we push only the first arg to the next
            # to last arg.
            push @args, @_[$[ .. ($#_ - 1)];
            unless ($function eq 'propset')
            {
                # propset doesn't take a ctx argument
                push @args, $self->{'ctx'};
            }
            push @args, $_[$#_];
        } else {
            push @args, @_;
            unless ($function eq 'propset')
            {
                push @args,$self->{'ctx'};
            }
            if (defined($self->{'pool'}) && 
                ref($self->{'pool'}) eq '_p_apr_pool_t')
            {
                # allow the pool entry in the SVN::Client
                # object to override the default pool.
                push @args, $self->{'pool'};
            }
        }
        return $real_function->(@args);
    }
}

=head1 ATTRIBUTE METHODS

The following attribute methods are provided that allow you to set various
configuration or retrieve it.  They all take value(s) to set the attribute and
return the new value of the attribute or no paremeters which reuturns the
current value.

=item $ctx->auth(SVN::Client::get_username_provider());

Provides access the auth_baton in the svn_client_ctx_t attached to the
SVN::Client object.

This method will accept an array or array ref of values returned from the
authentication provider functions see L</"AUTHENTICATION PROVIDERS">.  Which it
will convert to an auth_baton for you.  This is the preferred method of setting
the auth_baton.

It will also accept a scalar that references a _p_svn_auth_baton_t such as
those returned from SVN::Core::auth_open and SVN::Core::auth_open_helper.

=cut

sub auth
{
    my $self = shift;
    my $args;
    if (scalar(@_) == 0)
    {
        return $self->{'ctx'}->auth_baton();
    } elsif (scalar(@_) > 1) {
        $args = \@_;
    } else {
        $args = shift;
        if (ref($args) eq '_p_svn_auth_baton_t')
        {
            # 1 arg as an auth_baton so just set
            # the baton.
            $self->{'ctx'}->auth_baton($args);
            return $self->{'ctx'}->auth_baton();
        }
    }

    my ($auth_baton,$callbacks) = SVN::Core::auth_open_helper($args);
    $self->{'auth_provider_callbacks'} = $callbacks;
    $self->{'ctx'}->auth_baton($auth_baton);



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