1native::Client(3) User Contributed Perl Documentation native::Client(3)
2
3
4
6 SVN::Client - Subversion client functions
7
9 use SVN::Client;
10 my $ctx = new SVN::Client(
11 auth => [SVN::Client::get_simple_provider(),
12 SVN::Client::get_simple_prompt_provider(\&simple_prompt,2),
13 SVN::Client::get_username_provider()]
14 );
15
16 $ctx->cat(\*STDOUT, 'http://svn.apache.org/repos/asf/subversion/trunk/README',
17 'HEAD');
18
19 sub simple_prompt {
20 my $cred = shift;
21 my $realm = shift;
22 my $default_username = shift;
23 my $may_save = shift;
24 my $pool = shift;
25
26 print "Enter authentication info for realm: $realm\n";
27 print "Username: ";
28 my $username = <>;
29 chomp($username);
30 $cred->username($username);
31 print "Password: ";
32 my $password = <>;
33 chomp($password);
34 $cred->password($password);
35 }
36
38 SVN::Client wraps the highest level of functions provided by subversion
39 to accomplish specific tasks in an object oriented API. Methods are
40 similar to the functions provided by the C API and as such the
41 documentation for it may be helpful in understanding this interface.
42
43 There are a few notable differences from the C API. Most C function
44 calls take a svn_client_ctx_t pointer as the next to last parameter.
45 The Perl method calls take a SVN::Client object as the first parameter.
46 This allows method call invocation of the methods to be possible. For
47 example, the following are equivalent:
48
49 SVN::Client::add($ctx,$path, $recursive, $pool);
50 $ctx->add($path, $recursive, $pool);
51
52 Many of the C API calls also take a apr_pool_t pointer as their last
53 argument. The Perl bindings generally deal with this for you and you
54 do not need to pass a pool parameter. However, you may still pass a
55 pool parameter as the last parameter to override the automatic handling
56 of this for you.
57
58 Users of this interface should not directly manipulate the underlying
59 hash values but should use the respective attribute methods. Many of
60 these attribute methods do other things, especially when setting an
61 attribute, besides simply manipulating the value in the hash.
62
64 The client methods described below take a variety of parameters. Many
65 of them are similar. Methods accepting parameters named below will
66 follow the rules below or will be noted otherwise in the method
67 description.
68
69 $ctx
70 An SVN::Client object that you get from the constructor.
71
72 $url
73 This is a URL to a subversion repository.
74
75 $path
76 This is a path to a file or directory on the local file system.
77
78 $paths
79 This argument can either be a single path to a file or directory on
80 the local file system, or it can be a reference to an array of
81 files or directories on the local file system.
82
83 $target
84 This is a path to a file or directory in a working copy or a URL to
85 a file or directory in a subversion repository.
86
87 $targets
88 This argument can either be a single $target (as defined above) or
89 a reference to an array of them.
90
91 $revision
92 This specifies a revision in the subversion repository. You can
93 specify a revision in several ways. The easiest and most obvious
94 is to directly provide the revision number. You may also use the
95 strings (aka revision keywords) 'HEAD', 'BASE', 'COMMITTED', and
96 'PREV' which have the same meanings as in the command line client.
97 When referencing a working copy you can use the string 'WORKING" to
98 reference the BASE plus any local modifications. undef may be used
99 to specify an unspecified revision. Finally you may pass a date by
100 specifying the date inside curly braces '{}'. The date formats
101 accepted are the same as the command line client accepts.
102
103 $recursive $nonrecursive.
104 A boolean parameter that specifies if the action should follow
105 directories. It should only be 1 or 0. $recursive means, 1 means
106 to descend into directories, 0 means not to. $nonrecursive has the
107 inverse meaning.
108
109 $pool
110 Pool is always an option parameter. If you wish to pass a pool
111 parameter it should be a SVN::Pool or an apr_pool_t object.
112
114 The following methods are available:
115
116 $ctx = SVN::Client->new( %options );
117 This class method constructs a new "SVN::Client" object and returns
118 a reference to it.
119
120 Key/value pair arguments may be provided to set up the initial
121 state of the user agent. The following methods correspond to
122 attribute methods described below:
123
124 KEY DEFAULT
125 ---------- ----------------------------------------
126 auth auth_baton initiated with providers that
127 read cached authentication options from
128 the subversion config only.
129
130 cancel undef
131
132 config Hash containing the config from the
133 default subversion config file location.
134
135 log_msg undef
136
137 notify undef
138
139 pool A new pool is created for the context.
140
141 $ctx->add($path, $recursive, $pool);
142 Schedule a working copy $path for addition to the repository.
143
144 $path's parent must be under revision control already, but $path is
145 not. If $recursive is set, then assuming $path is a directory, all
146 of its contents will be scheduled for addition as well.
147
148 Calls the notify callback for each added item.
149
150 Important: this is a scheduling operation. No changes will happen
151 to the repository until a commit occurs. This scheduling can be
152 removed with $ctx->revert().
153
154 No return.
155
156 $ctx->blame($target, $start, $end, \&receiver, $pool);
157 Invoke \&receiver subroutine on each line-blame item associated
158 with revision $end of $target, using $start as the default source
159 of all blame.
160
161 An Error will be raised if either $start or $end is undef.
162
163 No return.
164
165 The blame receiver subroutine receives the following arguments:
166 $line_no, $revision, $author, $date, $line, $pool
167
168 $line_no is the line number of the file (starting with 0). The
169 line was last changed in revision number $revision by $author on
170 $date and the contents were $line.
171
172 The blame receiver subroutine can return an svn_error_t object to
173 return an error. All other returns will be ignored. You can
174 create an svn_error_t object with SVN::Error::create().
175
176 $ctx->cat(\*FILEHANDLE, $target, $revision, $pool);
177 Outputs the content of the file identified by $target and $revision
178 to the FILEHANDLE. FILEHANDLE is a reference to a filehandle.
179
180 If $target is not a local path and if $revision is 'PREV' (or some
181 other kind that requires a local path), then an error will be
182 raised, because the desired revision can not be determined.
183
184 $ctx->checkout($url, $path, $revision, $recursive, $pool);
185 Checkout a working copy of $url at $revision using $path as the
186 root directory of the newly checked out working copy.
187
188 $revision must be a number, 'HEAD', or a date. If $revision does
189 not meet these requirements the $SVN::Error::CLIENT_BAD_REVISION is
190 raised.
191
192 Returns the value of the revision actually checked out of the
193 repository.
194
195 $ctx->cleanup($dir, $pool);
196 Recursively cleanup a working copy directory, $dir, finishing any
197 incomplete operations, removing lockfiles, etc.
198
199 $ctx->commit($targets, $nonrecursive, $pool);
200 Commit files or directories referenced by target. Will use the
201 log_msg callback to obtain the log message for the commit.
202
203 If $targets contains no paths (zero elements), then does nothing
204 and immediately returns without error.
205
206 Calls the notify callback as the commit progresses with any of the
207 following actions: $SVN::Wc::Notify::Action::commit_modified,
208 $SVN::Wc::Notify::Action::commit_added,
209 $SVN::Wc::Notify::Action::commit_deleted,
210 $SVN::Wc::Notify::Action::commit_replaced,
211 $SVN::Wc::Notify::Action::commit_postfix_txdelta.
212
213 Use $nonrecursive to indicate that subdirectories of directory
214 targets should be ignored.
215
216 Returns a svn_client_commit_info_t object. If the revision member
217 of the commit information object is $SVN::Core::INVALID_REVNUM and
218 no error was raised, then the commit was a no-op; nothing needed to
219 be committed.
220
221 $ctx->copy($src_target, $src_revision, $dst_target, $pool);
222 Copies $src_target to $dst_target.
223
224 $src_target must be a file or directory under version control, or
225 the URL of a versioned item in the repository. If $src_target is a
226 URL, $src_revision is used to choose the revision from which to
227 copy the $src_target. $dst_path must be a file or directory under
228 version control, or a repository URL, existing or not.
229
230 If $dst_target is a URL, immediately attempt to commit the copy
231 action to the repository. The log_msg callback will be called to
232 query for a commit log message. If the commit succeeds, return a
233 svn_client_commit_info_t object.
234
235 If $dst_target is not a URL, then this is just a variant of
236 $ctx->add(), where the $dst_path items are scheduled for addition
237 as copies. No changes will happen to the repository until a commit
238 occurs. This scheduling can be removed with $ctx->revert(). undef
239 will be returned in this case.
240
241 Calls the notify callback for each item added at the new location,
242 passing the new, relative path of the added item.
243
244 $ctx->delete($targets, $force, $pool);
245 Delete items from a repository or working copy.
246
247 If the paths in $targets are URLs, immediately attempt to commit a
248 deletion of the URLs from the repository. The log_msg callback
249 will be called to query for a commit log message. If the commit
250 succeeds, return a svn_client_commit_info_t object. Every path
251 must belong to the same repository.
252
253 Else, schedule the working copy paths in $targets for removal from
254 the repository. Each path's parent must be under revision control.
255 This is just a scheduling operation. No changes will happen to the
256 repository until a commit occurs. This scheduling can be removed
257 with $ctx->revert(). If a path is a file it is immediately removed
258 from the working copy. If the path is a directory it will remain
259 in the working copy but all the files, and all unversioned items it
260 contains will be removed. If $force is not set then this operation
261 will fail if any path contains locally modified and/or unversioned
262 items. If $force is set such items will be deleted.
263
264 The notify callback is called for each item deleted with the path
265 of the deleted item.
266
267 Has no return.
268
269 $ctx->diff($diff_options, $target1, $revision1, $target2, $revision2,
270 $recursive, $ignore_ancestry, $no_diff_deleted, $outfile, $errfile,
271 $pool);
272 Produces diff output which describes the delta between $target1 at
273 $revision1 and $target2 at $revision2. They both must represent
274 the same node type (i.e. they most both be directories or files).
275 The revisions must not be undef.
276
277 Prints the output of the diff to the filename or filehandle passed
278 as $outfile, and any errors to the filename or filehandle passed as
279 $errfile.
280
281 Use $ignore_ancestry to control whether or not items being diffed
282 will be checked for relatedness first. Unrelated items are
283 typically transmitted to the editor as a deletion of one thing and
284 the addition of another, but if this flag is true, unrelated items
285 will be diffed as if they were related.
286
287 If $no_diff_deleted is true, then no diff output will be generated
288 on deleted files.
289
290 $diff_options is a reference to an array of additional arguments to
291 pass to diff process invoked to compare files. You'll usually just
292 want to use [] to pass an empty array to return a unified context
293 diff (like `diff -u`).
294
295 Has no return.
296
297 $ctx->diff_summarize($target1, $revision1, $target2, $revision2,
298 $recursive, $ignore_ancestry, \&summarize_func, $pool);
299 Produce a diff summary which lists the changed items between
300 $target1 at $revision1 and $target2 at $revision2 without creating
301 text deltas. $target1 and $target2 can be either working-copy
302 paths or URLs.
303
304 The function may report false positives if $ignore_ancestry is
305 false, since a file might have been modified between two revisions,
306 but still have the same contents.
307
308 Calls \&summarize_func with with a svn_client_diff_summarize_t
309 structure describing the difference.
310
311 See diff() for a description of the other parameters.
312
313 Has no return.
314
315 $ctx->export($from, $to, $revision, $force, $pool);
316 Export the contents of either a subversion repository or a
317 subversion working copy into a 'clean' directory (meaning a
318 directory with no administrative directories).
319
320 $from is either the path to the working copy on disk, or a URL to
321 the repository you wish to export.
322
323 $to is the path to the directory where you wish to create the
324 exported tree.
325
326 $revision is the revision that should be exported, which is only
327 used when exporting from a repository. It may be undef otherwise.
328
329 The notify callback will be called for the items exported.
330
331 Returns the value of the revision actually exported or
332 $SVN::Core::INVALID_REVNUM for local exports.
333
334 $ctx->import($path, $url, $nonrecursive, $pool);
335 Import file or directory $path into repository directory $url at
336 head.
337
338 If some components of $url do not exist then create parent
339 directories as necessary.
340
341 If $path is a directory, the contents of that directory are
342 imported directly into the directory identified by $url. Note that
343 the directory $path itself is not imported; that is, the basename
344 of $path is not part of the import.
345
346 If $path is a file, then the dirname of $url is the directory
347 receiving the import. The basename of $url is the filename in the
348 repository. In this case if $url already exists, raise an error.
349
350 The notify callback (if defined) will be called as the import
351 progresses, with any of the following actions:
352 $SVN::Wc::Notify::Action::commit_added,
353 $SVN::Wc::Notify::Action::commit_postfix_txdelta.
354
355 Use $nonrecursive to indicate that imported directories should not
356 recurse into any subdirectories they may have.
357
358 Uses the log_msg callback to determine the log message for the
359 commit when one is needed.
360
361 Returns a svn_client_commit_info_t object.
362
363 $ctx->log($targets, $start, $end, $discover_changed_paths,
364 $strict_node_history, \&log_receiver, $pool);
365 Invoke the log_receiver subroutine on each log_message from $start
366 to $end in turn, inclusive (but will never invoke receiver on a
367 given log message more than once).
368
369 $targets is a reference to an array containing all the paths or
370 URLs for which the log messages are desired. The log_receiver is
371 only invoked on messages whose revisions involved a change to some
372 path in $targets.
373
374 If $discover_changed_paths is set, then the changed_paths argument
375 to the log_receiver routine will be passed on each invocation.
376
377 If $strict_node_history is set, copy history (if any exists) will
378 not be traversed while harvesting revision logs for each target.
379
380 If $start or $end is undef the arp_err code will be set to:
381 $SVN::Error::CLIENT_BAD_REVISION.
382
383 Special case for repositories at revision 0:
384
385 If $start is 'HEAD' and $end is 1, then handle an empty (no
386 revisions) repository specially: instead of erroring because
387 requested revision 1 when the highest revision is 0, just invoke
388 $log_receiver on revision 0, passing undef to changed paths and
389 empty strings for the author and date. This is because that
390 particular combination of $start and $end usually indicates the
391 common case of log invocation; the user wants to see all log
392 messages from youngest to oldest, where the oldest commit is
393 revision 1. That works fine, except there are no commits in the
394 repository, hence this special case.
395
396 Calls the notify subroutine with a $SVN::Wc::Notify::Action::skip
397 signal on any unversioned targets.
398
399 The log_receiver takes the following arguments: $changed_paths,
400 $revision, $author, $date, $message, $pool
401
402 It is called once for each log $message from the $revision on $date
403 by $author. $author, $date or $message may be undef.
404
405 If $changed_paths is defined it references a hash with the keys
406 every path committed in $revision; the values are
407 svn_log_changed_path_t objects.
408
409 $ctx->ls($target, $revision, $recursive, $pool);
410 Returns a hash of svn_dirent_t objects for $target at $revision.
411
412 If $target is a directory, returns entries for all of the
413 directories' contents. If $recursive is true, it will recurse
414 subdirectories in $target.
415
416 If $target is a file only return an entry for the file.
417
418 If $target is non-existent, raises the $SVN::Error::FS_NOT_FOUND
419 error.
420
421 $ctx->merge($src1, $rev1, $src2, $rev2, $target_wcpath, $recursive,
422 $ignore_ancestry, $force, $dry_run, $pool);
423 Merge changes from $src1/$rev1 to $src2/$rev2 into the working-copy
424 path $target_wcpath.
425
426 $src1 and $src2 are either URLs that refer to entries in the
427 repository, or paths to entries in the working copy.
428
429 By 'merging', we mean: apply file differences and schedule
430 additions & deletions when appropriate.
431
432 $src1 and $src2 must both represent the same node kind; that is, if
433 $src1 is a directory, $src2 must also be, and if $src1 is a file,
434 $src2 must also be.
435
436 If either $rev1 or $rev2 is undef raises the
437 $SVN::Error::CLIENT_BAD_REVISION error.
438
439 If $recursive is true (and the URLs are directories), apply changes
440 recursively; otherwise, only apply changes in the current
441 directory.
442
443 Use $ignore_ancestry to control whether or not items being diffed
444 will be checked for relatedness first. Unrelated items are
445 typically transmitted to the editor as a deletion of one thing and
446 the addition of another, but if this flag is true, unrelated items
447 will be diffed as if they were related.
448
449 If $force is not set and the merge involves deleting locally
450 modified or unversioned items the operation will raise an error.
451 If $force is set such items will be deleted.
452
453 Calls the notify callback once for each merged target, passing the
454 targets local path.
455
456 If $dry_run is true the merge is carried out, and the full
457 notification feedback is provided, but the working copy is not
458 modified.
459
460 Has no return.
461
462 $ctx->mkdir($targets, $pool);
463 Create a directory, either in a repository or a working copy.
464
465 If $targets contains URLs, immediately attempts to commit the
466 creation of the directories in $targets in the repository. Returns
467 a svn_client_commit_info_t object.
468
469 Else, create the directories on disk, and attempt to schedule them
470 for addition. In this case returns undef.
471
472 Calls the notify callback when the directory has been created
473 (successfully) in the working copy, with the path of the new
474 directory. Note this is only called for items added to the working
475 copy.
476
477 $ctx->move($src_path, $src_revision, $dst_path, $force, $pool);
478 Move $src_path to $dst_path.
479
480 $src_path must be a file or directory under version control, or the
481 URL of a versioned item in the repository.
482
483 If $src_path is a repository URL:
484
485 * $dst_path must also be a repository URL (existent or not).
486
487 * $src_revision is used to choose the revision from which to copy
488 the $src_path.
489
490 * The log_msg callback will be called for the commit log message.
491
492 * The move operation will be immediately committed. If the commit
493 succeeds, returns a svn_client_commit_info_t object.
494
495 If $src_path is a working copy path
496
497 * $dst_path must also be a working copy path (existent or not).
498
499 * $src_revision is ignored and may be undef. The log_msg callback
500 will not be called.
501
502 * This is a scheduling operation. No changes will happen to the
503 repository until a commit occurs. This scheduling can be removed
504 with $ctx->revert(). If $src_path is a file it is removed from the
505 working copy immediately. If $src_path is a directory it will
506 remain in the working copy but all files, and unversioned items, it
507 contains will be removed.
508
509 * If $src_path contains locally modified and/or unversioned items
510 and $force is not set, the copy will raise an error. If $force is
511 set such items will be removed.
512
513 The notify callback will be called twice for each item moved, once
514 to indicate the deletion of the moved node, and once to indicate
515 the addition of the new location of the node.
516
517 $ctx->propget($propname, $target, $revision, $recursive, $pool);
518 Returns a reference to a hash containing paths or URLs, prefixed by
519 $target (a working copy or URL), of items for which the property
520 $propname is set, and whose values represent the property value for
521 $propname at that path.
522
523 $ctx->proplist($target, $revision, $recursive, $pool);
524 Returns a reference to an array of svn_client_proplist_item_t
525 objects.
526
527 For each item the node_name member of the proplist_item object
528 contains the name relative to the same base as $target.
529
530 If $revision is undef, then get properties from the working copy,
531 if $target is a working copy, or from the repository head if
532 $target is a URL. Else get the properties as of $revision.
533
534 If $recursive is false, or $target is a file, the returned array
535 will only contain a single element. Otherwise, it will contain one
536 entry for each versioned entry below (and including) $target.
537
538 If $target is not found, raises the $SVN::Error::ENTRY_NOT_FOUND
539 error.
540
541 $ctx->propset($propname, $propval, $target, $recursive, $pool);
542 Set $propname to $propval on $target (a working copy or URL path).
543
544 If $recursive is true, then $propname will be set recursively on
545 $target and all children. If $recursive is false, and $target is a
546 directory, $propname will be set on only $target.
547
548 A $propval of undef will delete the property.
549
550 If $propname is an svn-controlled property (i.e. prefixed with
551 svn:), then the caller is responsible for ensuring that $propval is
552 UTF8-encoded and uses LF line-endings.
553
554 $ctx->relocate($dir, $from, $to, $recursive, $pool);
555 Modify a working copy directory $dir, changing any repository URLs
556 that begin with $from to begin with $to instead, recursing into
557 subdirectories if $recursive is true.
558
559 Has no return.
560
561 $ctx->resolved($path, $recursive, $pool);
562 Removed the 'conflicted' state on a working copy path.
563
564 This will not semantically resolve conflicts; it just allows $path
565 to be committed in the future. The implementation details are
566 opaque. If $recursive is set, recurse below $path, looking for
567 conflicts to resolve.
568
569 If $path is not in a state of conflict to begin with, do nothing.
570
571 If $path's conflict state is removed, call the notify callback with
572 the $path.
573
574 $ctx->revert($paths, $recursive, $pool);
575 Restore the pristine version of a working copy $paths, effectively
576 undoing any local mods.
577
578 For each path in $paths, if it is a directory and $recursive is
579 true, this will be a recursive operation.
580
581 $ctx->revprop_get($propname, $url, $revision, $pool);
582 Returns two values, the first of which is the value of $propname on
583 revision $revision in the repository represented by $url. The
584 second value is the actual revision queried.
585
586 Note that unlike its cousin $ctx->propget(), this routine doesn't
587 affect working copy at all; it's a pure network operation that
588 queries an unversioned property attached to a revision. This can
589 be used to query log messages, dates, authors, and the like.
590
591 $ctx->revprop_list($url, $revision, $pool);
592 Returns two values, the first of which is a reference to a hash
593 containing the properties attached to $revision in the repository
594 represented by $url. The second value is the actual revision
595 queried.
596
597 Note that unlike its cousin $ctx->proplist(), this routine doesn't
598 read a working copy at all; it's a pure network operation that
599 reads unversioned properties attached to a revision.
600
601 $ctx->revprop_set($propname, $propval, $url, $revision, $force, $pool);
602 Set $propname to $propval on revision $revision in the repository
603 represented by $url.
604
605 Returns the actual revision affected. A $propval of undef will
606 delete the property.
607
608 If $force is true, allow newlines in the author property.
609
610 If $propname is an svn-controlled property (i.e. prefixed with
611 svn:), then the caller is responsible for ensuring that the value
612 is UTF8-encoded and uses LF line-endings.
613
614 Note that unlike its cousin $ctx->propset(), this routine doesn't
615 affect the working copy at all; it's a pure network operation that
616 changes an unversioned property attached to a revision. This can
617 be used to tweak log messages, dates, authors, and the like. Be
618 careful: it's a lossy operation, meaning that any existing value is
619 replaced with the new value, with no way to retrieve the prior
620 value.
621
622 Also note that unless the administrator creates a pre-revprop-
623 change hook in the repository, this feature will fail.
624
625 $ctx->status($path, $revision, \&status_func, $recursive, $get_all,
626 $update, $no_ignore, $pool);
627 Given $path to a working copy directory (or single file), call
628 status_func() with a set of svn_wc_status_t objects which describe
629 the status of $path and its children.
630
631 If $recursive is true, recurse fully, else do only immediate
632 children.
633
634 If $get_all is set, retrieve all entries; otherwise, retrieve only
635 'interesting' entries (local mods and/or out-of-date).
636
637 If $update is set, contact the repository and augment the status
638 objects with information about out-of-dateness (with respect to
639 $revision). Also, will return the value of the actual revision
640 against with the working copy was compared. (The return will be
641 undef if $update is not set).
642
643 The function recurses into externals definitions ('svn:externals')
644 after handling the main target, if any exist. The function calls
645 the notify callback with $SVN::Wc::Notify::Action::status_external
646 action before handling each externals definition, and with
647 $SVN::Wc::Notify::Action::status_completed after each.
648
649 The status_func subroutine takes the following parameters: $path,
650 $status
651
652 $path is the pathname of the file or directory which status is
653 being reported. $status is a svn_wc_status_t object.
654
655 The return of the status_func subroutine is ignored.
656
657 $ctx->info($path_or_url, $peg_revision, $revision, \&receiver,
658 $recurse);
659 Invokes \&receiver passing it information about $path_or_url for
660 $revision. The information returned is system-generated metadata,
661 not the sort of "property" metadata created by users. For methods
662 available on the object passed to \&receiver, see svn_info_t.
663
664 If both revision arguments are either svn_opt_revision_unspecified
665 or NULL, then information will be pulled solely from the working
666 copy; no network connections will be made.
667
668 Otherwise, information will be pulled from a repository. The
669 actual node revision selected is determined by the $path_or_url as
670 it exists in $peg_revision. If $peg_revision is undef, then it
671 defaults to HEAD for URLs or WORKING for WC targets.
672
673 If $path_or_url is not a local path, then if $revision is PREV (or
674 some other kind that requires a local path), an error will be
675 returned, because the desired revision cannot be determined.
676
677 Uses the authentication baton cached in ctx to authenticate against
678 the repository.
679
680 If $recurse is true (and $path_or_url is a directory) this will be
681 a recursive operation, invoking $receiver on each child.
682
683 my $receiver = sub {
684 my( $path, $info, $pool ) = @_;
685 print "Current revision of $path is ", $info->rev, "\n";
686 };
687 $ctx->info( 'foo/bar.c', undef, 'WORKING', $receiver, 0 );
688
689 $ctx->switch($path, $url, $revision, $recursive, $pool);
690 Switch working tree $path to $url at $revision.
691
692 $revision must be a number, 'HEAD', or a date, otherwise it raises
693 the $SVN::Error::CLIENT_BAD_REVISION error.
694
695 Calls the notify callback on paths affected by the switch. Also
696 invokes the callback for files that may be restored from the text-
697 base because they were removed from the working copy.
698
699 Summary of purpose: This is normally used to switch a working
700 directory over to another line of development, such as a branch or
701 a tag. Switching an existing working directory is more efficient
702 than checking out $url from scratch.
703
704 Returns the value of the revision to which the working copy was
705 actually switched.
706
707 $ctx->update($path, $revision, $recursive, $pool)
708 Update a working copy $path to $revision.
709
710 $revision must be a revision number, 'HEAD', or a date or this
711 method will raise the $SVN::Error::CLIENT_BAD_REVISION error.
712
713 Calls the notify callback for each item handled by the update, and
714 also for files restored from the text-base.
715
716 Returns the revision to which the working copy was actually
717 updated.
718
719 $ctx->url_from_path($target, $pool); or
720 SVN::Client::url_from_path($target, $pool);
721 Returns the URL for $target.
722
723 If $target is already a URL it returns $target.
724
725 If $target is a versioned item, it returns $target's entry URL.
726
727 If $target is unversioned (has no entry), returns undef.
728
729 $ctx->uuid_from_path($path, $adm_access, $pool);
730 Return the repository uuid for working-copy $path, allocated in
731 $pool.
732
733 Use $adm_access to retrieve the uuid from $path's entry; if not
734 present in the entry, then call $ctx->uuid_from_url() to retrieve,
735 using the entry's URL.
736
737 Note: The only reason this function falls back on
738 $ctx->uuid_from_url is for compatibility purposes. Old working
739 copies may not have uuids in the entries files.
740
741 Note: This method probably doesn't work right now without a lot of
742 pain, because SVN::Wc is incomplete and it requires an adm_access
743 object from it.
744
745 $ctx->uuid_from_url($url, $pool);
746 Return repository uuid for url.
747
749 The following attribute methods are provided that allow you to set
750 various configuration or retrieve it. They all take value(s) to set
751 the attribute and return the new value of the attribute or no
752 parameters which returns the current value.
753
754 $ctx->auth(SVN::Client::get_username_provider());
755 Provides access to the auth_baton in the svn_client_ctx_t attached
756 to the SVN::Client object.
757
758 This method will accept an array or array ref of values returned
759 from the authentication provider functions see "AUTHENTICATION
760 PROVIDERS", which it will convert to an auth_baton for you. This
761 is the preferred method of setting the auth_baton.
762
763 It will also accept a scalar that references a _p_svn_auth_baton_t
764 such as those returned from SVN::Core::auth_open and
765 SVN::Core::auth_open_helper.
766
767 $ctx->notify(\¬ify);
768 Sets the notify callback for the client context to a code reference
769 that you pass. It always returns the current codereference set.
770
771 The subroutine pointed to by this reference will be called when a
772 change is made to the working copy. The return value of this
773 function is ignored. It's only purpose is to notify you of the
774 change.
775
776 The subroutine will receive 6 parameters. The first parameter will
777 be the path of the changed file (absolute or relative to the cwd).
778 The second is an integer specifying the type of action taken. See
779 SVN::Wc for a list of the possible actions values and what they
780 mean. The 3rd is an integer specifying the kind of node the path
781 is, which can be: $SVN::Node::none, $SVN::Node::file,
782 $SVN::Node::dir, $SVN::Node::unknown. The fourth parameter is the
783 mime-type of the file or undef if the mime-type is unknown (it will
784 always be undef for directories). The 5th parameter is the state
785 of the file, again see SVN::Wc for a list of the possible states.
786 The 6th and final parameter is the numeric revision number of the
787 changed file. The revision number will be -1 except when the
788 action is $SVN::Wc::Notify::Action::update_completed.
789
790 $ctx->log_msg(\&log_msg)
791 Sets the log_msg callback for the client context to a code
792 reference that you pass. It always returns the current
793 codereference set.
794
795 The subroutine pointed to by this coderef will be called to get the
796 log message for any operation that will commit a revision to the
797 repo.
798
799 It receives 4 parameters. The first parameter is a reference to a
800 scalar value in which the callback should place the log_msg. If
801 you wish to cancel the commit you can set this scalar to undef.
802 The 2nd value is a path to any temporary file which might be
803 holding that log message, or undef if no such file exists (though,
804 if log_msg is undef, this value is undefined). The log message
805 MUST be a UTF8 string with LF line separators. The 3rd parameter
806 is a reference to an array of svn_client_commit_item3_t objects,
807 which may be fully or only partially filled-in, depending on the
808 type of commit operation. The 4th and last parameter will be a
809 pool.
810
811 If the function wishes to return an error it should return a
812 svn_error_t object made with SVN::Error::create. Any other return
813 value will be interpreted as SVN_NO_ERROR.
814
815 $ctx->cancel(\&cancel)
816 Sets the cancellation callback for the client context to a code
817 reference that you pass. It always returns the current
818 codereference set.
819
820 The subroutine pointed to by this value will be called to see if
821 the operation should be canceled. If the operation should be
822 canceled, the function may return one of the following values:
823
824 An svn_error_t object made with SVN::Error::create.
825
826 Any true value, in which case the bindings will generate an
827 svn_error_t object for you with the error code of SVN_ERR_CANCELLED
828 and the string set to "By cancel callback".
829
830 A string, in which case the bindings will generate an svn_error_t
831 object for you with the error code of SVN_ERR_CANCELLED and the
832 string set to the string you returned.
833
834 Any other value will be interpreted as wanting to continue the
835 operation. Generally, it's best to return 0 to continue the
836 operation.
837
838 $ctx->pool(new SVN::Pool);
839 Method that sets or gets the default pool that is passed to method
840 calls requiring a pool, but which were not explicitly passed one.
841
842 See SVN::Core for more information about how pools are managed in
843 this interface.
844
845 $ctx->config(SVN::Core::config_get_config(undef));
846 Method that allows access to the config member of the
847 svn_client_ctx_t. Accepts a Perl hash to set, which is what
848 functions like SVN::Core:config_get_config() will return.
849
850 It will return a _p_arp_hash_t scalar. This is a temporary
851 situation. The return value is not particular useful. In the
852 future, this value will be tied to the actual hash used by the C
853 API.
854
856 The following functions get authentication providers for you. They
857 come in two forms. Standard or File versions, which look for
858 authentication information in the subversion configuration directory
859 that was previously cached, or Prompt versions which call a subroutine
860 to allow you to prompt the user for the information.
861
862 The functions that return the svn_auth_provider_object_t for prompt
863 style providers take a reference to a Perl subroutine to use for the
864 callback. The first parameter each of these subroutines receive is a
865 credential object. The subroutines return the response by setting
866 members of that object. Members may be set like so:
867 $cred->username("breser"); These functions and credential objects
868 always have a may_save member which specifies if the authentication
869 data will be cached.
870
871 The providers are as follows:
872
873 NAME WHAT IT HANDLES
874 ---------------- ----------------------------------------
875 simple username and password pairs
876
877 username username only
878
879 ssl_server_trust server certificates and failures
880 authenticating them
881
882 ssl_client_cert client side certificate files
883
884 ssl_client_cert_pw password for a client side certificate file.
885
886 SVN::Client::get_simple_provider
887 Returns a simple provider that returns information from previously
888 cached sessions. Takes no parameters or one pool parameter.
889
890 SVN::Client::get_simple_prompt_provider
891 Returns a simple provider that prompts the user via a callback.
892 Takes two or three parameters, the first is the callback
893 subroutine, the 2nd is the number of retries to allow, the 3rd is
894 optionally a pool. The subroutine gets called with the following
895 parameters: a svn_auth_cred_simple_t object, a realm string, a
896 default username, may_save, and a pool. The svn_auth_cred_simple
897 has the following members: username, password, and may_save.
898
899 SVN::Client::get_username_provider
900 Returns a username provider that returns information from a
901 previously cached sessions. Takes no parameters or one pool
902 parameter.
903
904 SVN::Client::get_username_prompt_provider
905 Returns a username provider that prompts the user via a callback.
906 Takes two or three parameters, the first is the callback
907 subroutine, the 2nd is the number of retries to allow, the 3rd is
908 optionally a pool. The subroutine gets called with the following
909 parameters: a svn_auth_cred_username_t object, a realm string, a
910 default username, may_save, and a pool. The svn_auth_cred_username
911 has the following members: username and may_save.
912
913 SVN::Client::get_ssl_server_trust_file_provider
914 Returns a server trust provider that returns information from
915 previously cached sessions. Takes no parameters or optionally a
916 pool parameter.
917
918 SVN::Client::get_ssl_server_trust_prompt_provider
919 Returns a server trust provider that prompts the user via a
920 callback. Takes one or two parameters the callback subroutine and
921 optionally a pool parameter. The subroutine gets called with the
922 following parameters. A svn_auth_cred_ssl_server_trust_t object, a
923 realm string, an integer specifying how the certificate failed
924 authentication, a svn_auth_ssl_server_cert_info_t object, may_save,
925 and a pool. The svn_auth_cred_ssl_server_trust_t object has the
926 following members: may_save and accepted_failures. The
927 svn_auth_ssl_server_cert_info_t object has the following members
928 (and behaves just like cred objects though you can't modify it):
929 hostname, fingerprint, valid_from, valid_until, issuer_dname,
930 ascii_cert.
931
932 The masks used for determining the failures are in SVN::Auth::SSL
933 and are named:
934
935 $SVN::Auth::SSL::NOTYETVALID $SVN::Auth::SSL::EXPIRED
936 $SVN::Auth::SSL::CNMISMATCH $SVN::Auth::SSL::UNKNOWNCA
937 $SVN::Auth::SSL::OTHER
938
939 You reply by setting the accepted_failures of the cred object with
940 an integer of the values for what you want to accept bitwise AND'd
941 together.
942
943 SVN::Client::get_ssl_client_cert_file_provider
944 Returns a client certificate provider that returns information from
945 previously cached sessions. Takes no parameters or optionally a
946 pool parameter.
947
948 SVN::Client::get_ssl_client_cert_prompt_provider
949 Returns a client certificate provider that prompts the user via a
950 callback. Takes two or three parameters: the first is the callback
951 subroutine, the 2nd is the number of retries to allow, the 3rd is
952 optionally a pool parameter. The subroutine gets called with the
953 following parameters. A svn_auth_cred_ssl_client_cert object, a
954 realm string, may_save, and a pool. The
955 svn_auth_cred_ssl_client_cert the following members: cert_file and
956 may_save.
957
958 SVN::Client::get_ssl_client_cert_pw_file_provider
959 Returns a client certificate password provider that returns
960 information from previously cached sessions. Takes no parameters
961 or optionally a pool parameter.
962
963 SVN::Client::get_ssl_client_cert_pw_prompt_provider
964 Returns a client certificate password provider that prompts the
965 user via a callback. Takes two or three parameters, the first is
966 the callback subroutine, the 2nd is the number of retries to allow,
967 the 3rd is optionally a pool parameter. The subroutine gets called
968 with the following parameters. A svn_auth_cred_ssl_client_cert_pw
969 object, a realm string, may_save, and a pool. The
970 svn_auth_cred_ssl_client_cert_pw has the following members:
971 password and may_save.
972
974 These are some of the object types that are returned from the methods
975 and functions. Others are documented in SVN::Core and SVN::Wc. If an
976 object is not documented, it is more than likely opaque and not
977 something you can do anything with, except pass to other functions that
978 require such objects.
979
980 svn_info_t
981 $info->URL()
982 Where the item lives in the repository.
983
984 $info->rev()
985 The revision of the object. If path_or_url is a working-copy
986 path, then this is its current working revnum. If path_or_url
987 is a URL, then this is the repos revision that path_or_url
988 lives in.
989
990 $info->kind()
991 The node's kind.
992
993 $info->repos_root_URL()
994 The root URL of the repository.
995
996 $info->repos_UUID()
997 The repository's UUID.
998
999 $info->last_changed_rev()
1000 The last revision in which this object changed.
1001
1002 $info->last_changed_date()
1003 The date of the last_changed_rev.
1004
1005 $info->last_changed_author()
1006 The author of the last_changed_rev.
1007
1008 $info->lock()
1009 An exclusive lock, if present. Could be either local or
1010 remote.
1011
1012 See SVN::Wc::svn_wc_entry_t for the rest of these. svn_client.h
1013 indicates that these were copied from that struct and mean the same
1014 things. They are also only useful when working with a WC.
1015
1016 $info->has_wc_info()
1017 $info->schedule()
1018 $info->copyfrom_url()
1019 $info->copyfrom_rev()
1020 $info->text_time()
1021 $info->prop_time()
1022 $info->checksum()
1023 $info->conflict_old()
1024 $info->conflict_new()
1025 $info->conflict_wrk()
1026 $info->prejfile()
1027
1028 svn_client_commit_item3_t
1029 $citem->path()
1030 Absolute working-copy path of item.
1031
1032 $citem->kind()
1033 An integer representing the type of node it is (file/dir). Can
1034 be one of the following constants: $SVN::Node::none
1035 $SVN::Node::file $SVN::Node::dir $SVN::Node::unknown
1036
1037 $citem->url()
1038 Commit URL for this item.
1039
1040 $citem->revision()
1041 Revision (copyfrom_rev if state_flags has IS_COPY set).
1042
1043 $citem->copyform_url();
1044 CopyFrom URL
1045
1046 $citem->state_flags();
1047 One of several state flags: $SVN::Client::COMMIT_ITEM_ADD
1048 $SVN::Client::COMMIT_ITEM_DELETE
1049 $SVN::Client::COMMIT_ITEM_TEXT_MODS
1050 $SVN::Client::COMMIT_ITEM_PROP_MODS
1051 $SVN::Client::COMMIT_ITEM_IS_COPY
1052
1053 $citem>incoming_prop_changes()
1054 A reference to an array of svn_prop_t objects representing
1055 changes to WC properties.
1056
1057 $citem>outgoing_prop_changes()
1058 A reference to an array of svn_prop_t objects representing
1059 extra changes to properties in the repository (which are not
1060 necessarily reflected by the WC).
1061
1062 svn_client_commit_info_t
1063 $cinfo->revision()
1064 Just committed revision.
1065
1066 $cinfo->date()
1067 Server-Side date of the commit as a string.
1068
1069 $cinfo->author()
1070 Author of the commit.
1071
1072 svn_client_proplist_item_t
1073 $proplist->node_name()
1074 The name of the node on which these properties are set.
1075
1076 $proplist->prop_hash()
1077 A reference to a hash of property names and values.
1078
1079 svn_client_diff_summarize_kind_t - SVN::Summarize
1080 An enum of the following constants:
1081
1082 $SVN::Client::Summarize::normal, $SVN::Client::Summarize::added,
1083 $SVN::Client::Summarize::modified, $SVN::Client::Summarize::deleted.
1084
1085 svn_client_diff_summarize_t
1086 $diff_summarize->path()
1087 Path relative to the target. If the target is a file, path is
1088 the empty string.
1089
1090 $diff_summarize->summarize_kind()
1091 Change kind.
1092
1093 $diff_summarize->prop_changed()
1094 Properties changed?
1095
1096 $diff_summarize->node_kind()
1097 File or dir?
1098
1100 * Better support for the config.
1101
1102 * Unit tests for cleanup, diff, export, merge, move, relocate, resolved
1103 and switch. This may reveal problems for using these methods as I
1104 haven't tested them yet that require deeper fixes.
1105
1107 Chia-liang Kao <clkao@clkao.org>
1108
1109 Ben Reser <ben@reser.org>
1110
1112 Licensed to the Apache Software Foundation (ASF) under one
1113 or more contributor license agreements. See the NOTICE file
1114 distributed with this work for additional information
1115 regarding copyright ownership. The ASF licenses this file
1116 to you under the Apache License, Version 2.0 (the
1117 "License"); you may not use this file except in compliance
1118 with the License. You may obtain a copy of the License at
1119
1120 http://www.apache.org/licenses/LICENSE-2.0
1121
1122 Unless required by applicable law or agreed to in writing,
1123 software distributed under the License is distributed on an
1124 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1125 KIND, either express or implied. See the License for the
1126 specific language governing permissions and limitations
1127 under the License.
1128
1129
1130
1131perl v5.16.3 2011-07-16 native::Client(3)