⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.pm

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PM
📖 第 1 页 / 共 4 页
字号:
The status_func subroutine takes the following parameters:$path, $status$path is the pathname of the file or directory which status is beingreported.  $status is a svn_wc_status_t object.The return of the status_func subroutine is ignored.=item $ctx-E<gt>info($path_or_url, $peg_revision, $revision, \&receiver, $recurse);Invokes \&receiver passing it information about $path_or_url for $revision.The information returned is system-generated metadata, not the sort of"property" metadata created by users.  For methods available on the objectpassed to \&receiver, B<see svn_info_t>.If both revision arguments are either svn_opt_revision_unspecified or NULL,then information will be pulled solely from the working copy; no networkconnections will be made.Otherwise, information will be pulled from a repository.  The actual noderevision selected is determined by the $path_or_url as it exists in$peg_revision.  If $peg_revision is undef, then it defaults to HEAD for URLsor WORKING for WC targets.If $path_or_url is not a local path, then if $revision is PREV (or some otherkind that requires a local path), an error will be returned, because thedesired revision cannot be determined.Uses the authentication baton cached in ctx to authenticate against therepository.If $recurse is true (and $path_or_url is a directory) this will be a recursiveoperation, invoking $receiver on each child. my $receiver = sub {     my( $path, $info, $pool ) = @_;     print "Current revision of $path is ", $info->rev, "\n"; }; $ctx->info( 'foo/bar.c', undef, 'WORKING', $receiver, 0 );=item $ctx-E<gt>switch($path, $url, $revision, $recursive, $pool);Switch working tree $path to $url at $revision.$revision must be a number, 'HEAD', or a date, otherwise it raises the $SVN::Error::CLIENT_BAD_REVISION error.Calls the notify callback on paths affected by the switch.  Also invokesthe callback for files that may be restored from the text-base because theywere removed from the working copy.Summary of purpose: This is normally used to switch a working directoryover to another line of development, such as a branch or a tag.  Switchingan existing working directory is more efficient than checking out $url fromscratch.Returns the value of the revision to which the working copy was actuallyswitched. =item $ctx-E<gt>update($path, $revision, $recursive, $pool)Update a working copy $path to $revision.$revision must be a revision number, 'HEAD', or a date or this method willraise the $SVN::Error::CLIENT_BAD_REVISION error. Calls the notify callback for each item handled by the update, andalso for files restored from the text-base.Returns the revision to which the working copy was actually updated.=item $ctx-E<gt>url_from_path($target, $pool); or SVN::Client::url_from_path($target, $pool);Returns the URL for $target.If $target is already a URL it returns $target.If $target is a versioned item, it returns $target's entry URL.If $target is unversioned (has no entry), returns undef.=item $ctx-E<gt>uuid_from_path($path, $adm_access, $pool);Return the repository uuid for working-copy $path, allocated in $pool.Use $adm_access to retrieve the uuid from $path's entry; if not present in theentry, then call $ctx-E<gt>uuid_from_url() to retrieve, using the entry's URL.Note: The only reason this function falls back on $ctx-E<gt>uuid_from_url is forcompatibility purposes.  Old working copies may not have uuids in the entriesfiles.Note: This method probably doesn't work right now without a lot of pain,because SVN::Wc is incomplete and it requires an adm_access object from it.=item $ctx-E<gt>uuid_from_url($url, $pool);Return repository uuid for url.=back=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                       propget uuid_from_url uuid_from_path                       url_from_path revprop_get revprop_list                       info)){    no strict 'refs';    my $real_function = \&{"SVN::_Client::svn_client_$function"};    *{"SVN::Client::$function"} = sub    {        my ($self, $ctx);        my @args;            # Don't shift the first param if it isn't a SVN::Client        # object.  This lets the old style interface still work.          # And is useful for functions like url_from_path which        # don't take a ctx param, but might be called in method        # invocation style or as a normal function.        for (my $index = $[; $index <= $#_; $index++)        {            if (ref($_[$index]) eq 'SVN::Client')            {                ($self) = splice(@_,$index,1);                $ctx = $self->{'ctx'};                last;            } elsif (ref($_[$index]) eq '_p_svn_client_ctx_t') {                $self = undef;                ($ctx) = splice(@_,$index,1);                last;            }        }        if (!defined($ctx))        {            # Allows import to work while not breaking use SVN::Client.            if ($function eq 'import')            {                return;            }        }        if (ref($_[$#_]) eq '_p_apr_pool_t' ||            ref($_[$#_]) eq 'SVN::Pool')        {            # if we got a pool passed 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 =~ /^(?:propset|url_from_path)$/)            {                # propset and url_from_path don't take a ctx argument                push @args, $ctx;            }            push @args, $_[$#_];        } else {            push @args, @_;            unless ($function =~ /^(?:propset|url_from_path)$/)            {                push @args,$ctx;            }            if (defined($self->{'pool'}) &&                 (ref($self->{'pool'}) eq '_p_apr_pool_t' ||                 ref($self->{'pool'}) eq 'SVN::Pool'))            {                # allow the pool entry in the SVN::Client                # object to override the default pool.                push @args, $self->{'pool'};            }        }        return $real_function->(@args);    }}=head1 ATTRIBUTE METHODSThe following attribute methods are provided that allow you to set variousconfiguration or retrieve it.  They all take value(s) to set the attribute andreturn the new value of the attribute or no parameters which returns thecurrent value.=over 4=item $ctx-E<gt>auth(SVN::Client::get_username_provider());Provides access to the auth_baton in the svn_client_ctx_t attached to theSVN::Client object.This method will accept an array or array ref of values returned from theauthentication provider functions see L</"AUTHENTICATION PROVIDERS">, whichit will convert to an auth_baton for you.  This is the preferred method ofsetting the auth_baton.It will also accept a scalar that references a _p_svn_auth_baton_t such asthose returned from SVN::Core::auth_open and SVN::Core::auth_open_helper.=cutsub 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);    return $self->{'ctx'}->auth_baton();}=item $ctx-E<gt>notify(\&notify);Sets the notify callback for the client context to a code reference thatyou pass.  It always returns the current codereference set.The subroutine pointed to by this reference will be called when a changeis made to the working copy.  The return value of this function is ignored.It's only purpose is to notify you of the change.The subroutine will receive 6 parameters.  The first parameter will be the pathof the changed file (absolute or relative to the cwd).  The second is aninteger specifying the type of action taken.  See L<SVN::Wc> for a list of thepossible actions values and what they mean.  The 3rd is an integer specifyingthe kind of node the path is, which can be: $SVN::Node::none, $SVN::Node::file,$SVN::Node::dir, $SVN::Node::unknown.  The fourth parameter is the mime-type ofthe file or undef if the mime-type is unknown (it will always be undef fordirectories).  The 5th parameter is the state of the file, again see L<SVN::Wc>for a list of the possible states.  The 6th and final parameter is the numericrevision number of the changed file.  The revision number will be -1 exceptwhen the action is $SVN::Wc::Notify::Action::update_completed.=cut sub notify {    my $self = shift;    if (scalar(@_) == 1) {        $self->{'notify_callback'} = $self->{'ctx'}->notify_baton(shift);    }    return ${$self->{'notify_callback'}};}=item $ctx-E<gt>log_msg(\&log_msg)Sets the log_msg callback for the client context to a code reference that youpass.  It always returns the current codereference set.The subroutine pointed to by this coderef will be called to get the logmessage for any operation that will commit a revision to the repo.It receives 4 parameters.  The first parameter is a reference to a scalarvalue in which the callback should place the log_msg.  If you wish to cancelthe commit you can set this scalar to undef.  The 2nd value is a path to atemporary file which might be holding that log message, or undef if no suchfield exists (though, if log_msg is undef, this value is undefined).  The log message B<MUST> be a UTF8 string with LF line separators.  The 3rd parameteris a reference to an array of svn_client_commit_item_t objects, which maybe fully or only partially filled-in, depending on the type of commitoperation.  The 4th and last parameter will be a pool.If the function wishes to return an error it should return a svn_error_tobject made with SVN::Error::create.  Any other return value will beinterpreted as SVN_NO_ERROR.=cutsub log_msg {    my $self = shift;    if (scalar(@_) == 1) {        $self->{'log_msg_callback'} = $self->{'ctx'}->log_msg_baton(shift);    }    return ${$self->{'log_msg_callback'}};}=item $ctx-E<gt>cancel(\&cancel)Sets the log_msg callback for the client context to a code reference that youpass.  It always returns the current codereference set.The subroutine pointed to by this value will be called to see if the operationshould be canceled.  If the operation should be canceled, the function mayreturn one of the following values:An svn_error_t object made with SVN::Error::create.Any true value, in which case the bindings will generate an svn_error_t objectfor you with the error code of SVN_ERR_CANCELLED and the string set to "Bycancel callback".A string, in which case the bindings will generate an svn_error_t object for youwith the error code of SVN_ERR_CANCELLED and the string set to the string youreturned.Any other value will be interpreted as wanting to continue the operation.Generally, it's best to return 0 to continue the operation.=cutsub cancel {    my $self = shift;    if (scalar(@_) == 1) {        $self->{'cancel_callback'} = $self->{'ctx'}->cancel_baton(shift);    }    return ${$self->{'cancel_callback'}};}=item $ctx-E<gt>pool(new SVN::Pool);Method that sets or gets the default pool that is passed to method callsrequiring a pool, but which were not explicitly passed one.See L<SVN::Core> for more information about how pools are managedin this interface.=cutsub pool{    my $self = shift;    if (scalar(@_) == 0)    {        $self->{'pool'};    } else {        return $self->{'pool'} = shift;    }}=item $ctx-E<gt>config(SVN::Core::config_get_config(undef));Method that allows access to the config member of the svn_client_ctx_t.Accepts a Perl hash to set, which is what functions likeSVN::Core:config_get_config() will return.It will return a _p_arp_hash_t scalar.  This is a temporarysituation.  The return value is not particular useful.  In

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -