Remove no-longer-used svn_*_get_mergeinfo_for_tree APIs.
[svn.git] / subversion / bindings / swig / perl / native / Repos.pm
blob9b7f513940ed78e78a05516c18ea4ee3d5813329
1 use strict;
2 use warnings;
4 package SVN::Repos;
5 use SVN::Base qw(Repos svn_repos_);
7 =head1 NAME
9 SVN::Repos - Subversion repository functions
11 =head1 SYNOPSIS
13 use SVN::Core;
14 use SVN::Repos;
15 use SVN::Fs;
17 my $repos = SVN::Repos::open('/path/to/repos');
18 print $repos->fs()->youngest_rev;
20 =head1 DESCRIPTION
22 SVN::Repos wraps the object-oriented C<svn_repos_t> functions, providing
23 access to a Subversion repository on the local filesystem.
25 =head2 CONSTRUCTORS
27 =over
29 =item SVN::Repos::open($path)
31 This function opens an existing repository, and returns an
32 C<SVN::Repos> object.
34 =item create($path, undef, undef, $config, $fs_config)
36 This function creates a new repository, and returns an C<SVN::Repos>
37 object.
39 =back
41 =head2 METHODS
43 =over
45 =item $repos-E<gt>dump_fs($dump_fh, $feedback_fh, $start_rev, $end_rev, $incremental, $cancel_func, $cancel_baton)
47 =item $repos-E<gt>dump_fs2($dump_fh, $feedback_fh, $start_rev, $end_rev, $incremental, $deltify, $cancel_func, $cancel_baton)
49 Create a dump file of the repository from revision C<$start_rev> to C<$end_rev>
50 , store it into the filehandle C<$dump_fh>, and write feedback on the progress
51 of the operation to filehandle C<$feedback_fh>.
53 If C<$incremental> is TRUE, the first revision dumped will be a diff
54 against the previous revision (usually it looks like a full dump of
55 the tree).
57 If C<$use_deltas> is TRUE, output only node properties which have
58 changed relative to the previous contents, and output text contents
59 as svndiff data against the previous contents. Regardless of how
60 this flag is set, the first revision of a non-incremental dump will
61 be done with full plain text. A dump with @a use_deltas set cannot
62 be loaded by Subversion 1.0.x.
64 According to svn_repos.h, the C<$cancel_func> is a function that is called
65 periodically and given C<$cancel_baton> as a parameter to determine whether
66 the client wishes to cancel the dump. You must supply C<undef> at the very
67 least.
69 Example:
71 use SVN::Core;
72 use SVN::Repos;
74 my $repos = SVN::Repos::open ('/repo/sandbox');
76 open my $fh, ">/tmp/tmp.dump" or die "Cannot open file: $!\n";
78 my $start_rev = 10;
79 my $end_rev = 20;
80 my $incremental = 1;
81 my $deltify = 1;
83 $repos->dump_fs2($fh, \*STDOUT, # Dump file => $fh, Feedback => STDOUT
84 $start_rev, $end_rev, # Revision Range
85 $incremental, $deltify, # Options
86 undef, undef); # Cancel Function
88 close $fh;
90 =item $repos->load_fs($dumpfile_fh, $feedback_fh, $uuid_action, $parent_dir, $cancel_func, $cancel_baton);
92 =item $repos->load_fs2($dumpfile_fh, $feedback_fh, $uuid_action, $parent_dir, $use_pre_commit_hook, $use_post_commit_hook, $cancel_func, $cancel_baton);
94 Loads a dumpfile specified by the C<$dumpfile_fh> filehandle into the repository.
95 If the dumpstream contains copy history that is unavailable in the repository,
96 an error will be thrown.
98 The repository's UUID will be updated iff the dumpstream contains a UUID and
99 C<$uuid_action> is not equal to C<$SVN::Repos::load_uuid_ignore> and either the
100 repository contains no revisions or C<$uuid_action> is equal to
101 C<$SVN::Repos::load_uuid_force>.
103 If the dumpstream contains no UUID, then C<$uuid_action> is
104 ignored and the repository UUID is not touched.
106 If C<$parent_dir> is not null, then the parser will reparent all the
107 loaded nodes, from root to @a parent_dir. The directory C<$parent_dir>
108 must be an existing directory in the repository.
110 If C<$use_pre_commit_hook> is set, call the repository's pre-commit
111 hook before committing each loaded revision.
113 If C<$use_post_commit_hook> is set, call the repository's
114 post-commit hook after committing each loaded revision.
116 If C<$cancel_func> is not NULL, it is called periodically with
117 C<$cancel_baton> as argument to see if the client wishes to cancel
118 the load.
120 You must at least provide undef for these parameters for the method call
121 to work.
123 Example:
124 use SVN::Core;
125 use SVN::Repos;
127 my $repos = SVN::Repos::open ('/repo/test_repo');
129 open my $fh, "/repo/sandbox.dump" or die "Cannot open file: $!\n";
131 my $parent_dir = '/';
132 my $use_pre_commit_hook = 0;
133 my $use_post_commit_hook = 0;
135 $repos->load_fs2($fh, \*STDOUT,
136 $SVN::Repos::load_uuid_ignore, # Ignore uuid
137 $parent_dir,
138 $use_pre_commit_hook, # Use pre-commit hook?
139 $use_post_commit_hook, # Use post-commit hook?
140 undef, undef);
143 close $fh;
145 =cut
147 # Build up a list of methods as we go through the file. Add each method
148 # to @methods, then document it. The full list of methods is then
149 # instantiated at the bottom of this file.
151 # This should make it easier to keep the documentation and list of methods
152 # in sync.
154 my @methods = (); # List of methods to wrap
156 push @methods, qw(fs);
158 =item $repos-E<gt>fs()
160 Returns the C<SVN::Fs> object for this repository.
162 =cut
164 push @methods, qw(get_logs);
166 =item $repos-E<gt>get_logs([$path, ...], $start, $end, $discover_changed_paths, $strict_node_history, $receiver)
168 Iterates over all the revisions that affect the list of paths passed
169 as the first parameter, starting at $start, and ending at $end.
171 $receiver is called for each change. The arguments to $receiver are:
173 =over
175 =item $self
177 The C<SVN::Repos> object.
179 =item $paths
181 C<undef> if $discover_changed_paths is false. Otherwise, contains a hash
182 of paths that have changed in this revision.
184 =item $rev
186 The revision this change occured in.
188 =item $date
190 The date and time the revision occured.
192 =item $msg
194 The log message associated with this revision.
196 =item $pool
198 An C<SVN::Pool> object which may be used in the function.
200 =back
202 If $strict_node_history is true then copies will not be traversed.
204 =back
206 =head2 ADDITIONAL METHODS
208 The following methods work, but are not currently documented in this
209 file. Please consult the svn_repos.h section in the Subversion API
210 for more details.
212 =over
214 =item $repos-E<gt>get_commit_editor(...)
216 =item $repos-E<gt>get_commit_editor2(...)
218 =item $repos-E<gt>path(...)
220 =item $repos-E<gt>db_env(...)
222 =item $repos-E<gt>lock_dir(...)
224 =item $repos-E<gt>db_lockfile(...)
226 =item $repos-E<gt>hook_dir(...)
228 =item $repos-E<gt>start_commit_hook(...)
230 =item $repos-E<gt>pre_commit_hook(...)
232 =item $repos-E<gt>post_commit_hook(...)
234 =item $repos-E<gt>pre_revprop_change(...)
236 =item $repos-E<gt>post_revprop_change(...)
238 =item $repos-E<gt>dated_revision(...)
240 =item $repos-E<gt>fs_commit_txn(...)
242 =item $repos-E<gt>fs_being_txn_for_commit(...)
244 =item $repos-E<gt>fs_being_txn_for_update(...)
246 =item $repos-E<gt>fs_change_rev_prop(...)
248 =item $repos-E<gt>node_editor(...)
250 =item $repos-E<gt>dump_fs(...)
252 =item $repos-E<gt>load_fs(...)
254 =item $repos-E<gt>get_fs_build_parser(...)
256 =back
258 =cut
260 push @methods,
261 qw( version open create delete hotcopy recover3 recover2
262 recover db_logfiles path db_env conf_dir svnserve_conf
263 lock_dir db_lockfile db_logs_lockfile hook_dir
264 pre_revprop_change_hook pre_lock_hook pre_unlock_hook
265 begin_report2 begin_report link_path3 link_path2 link_path
266 delete_path finish_report dir_delta2 dir_delta replay2 replay
267 dated_revision stat deleted_rev history2 history
268 trace_node_locations fs_begin_txn_for_commit2
269 fs_begin_txn_for_commit fs_begin_txn_for_update fs_lock
270 fs_unlock fs_change_rev_prop3 fs_change_rev_prop2
271 fs_change_rev_prop fs_revision_prop fs_revision_proplist
272 fs_change_node_prop fs_change_txn_prop node_editor
273 node_from_baton dump_fs2 dump_fs load_fs2 load_fs
274 authz_check_access check_revision_access invoke_authz_func
275 invoke_authz_callback invoke_file_rev_handler
276 invoke_history_func);
279 no strict 'refs';
280 for (@methods) {
281 *{"_p_svn_repos_t::$_"} = *{$_};
285 =head1 AUTHORS
287 Chia-liang Kao E<lt>clkao@clkao.orgE<gt>
289 =head1 COPYRIGHT
291 Copyright (c) 2003-2006 CollabNet. All rights reserved.
293 This software is licensed as described in the file COPYING, which you
294 should have received as part of this distribution. The terms are also
295 available at http://subversion.tigris.org/license-1.html. If newer
296 versions of this license are posted there, you may use a newer version
297 instead, at your option.
299 This software consists of voluntary contributions made by many
300 individuals. For exact contribution history, see the revision history
301 and logs, available at http://subversion.tigris.org/.
303 =cut