Remove no-longer-used svn_*_get_mergeinfo_for_tree APIs.
[svn.git] / subversion / bindings / swig / perl / native / Fs.pm
blobe63b445ee1b259664a0ad97c2e9d83d62a8386fe
1 use strict;
2 use warnings;
4 package SVN::Fs;
5 use SVN::Base qw(Fs svn_fs_);
7 =head1 NAME
9 SVN::Fs - Subversion filesystem functions
11 =head1 DESCRIPTION
13 SVN::Fs wraps the functions in svn_fs.h. The actual namespace
14 for filesystem objects is C<_p_svn_fs_t>.
16 =head1 FUNCTIONS
18 =over
20 =item SVN::Fs::berkeley_logfiles($path, $only_unused)
22 =item SVN::Fs::berkeley_recover($path)
24 =item SVN::Fs::check_related($id1, $id2)
26 =item SVN::Fs::compare_ids($id1, $id2)
28 =item SVN::Fs::contents_changed($root1, $path1, $root2, $path2)
30 =item SVN::Fs::create($path, $config)
32 =item SVN::Fs::delete_fs($path)
34 =item SVN::Fs::deltify_revision($fs, $rev)
36 =item SVN::Fs::get_file_delta_stream($source_root, $source_path, $target_root, $target_path)
38 =item SVN::Fs::hotcopy($src_path, $dest_path, $clean)
40 =item SVN::Fs::initialize($pool)
42 =item SVN::Fs::merge($source_root, $source_path, $target_root, $target_path, $ancestor_root, $ancestor_path)
44 =item SVN::Fs::open($path, $config)
46 =item SVN::Fs::path($fs)
48 =item SVN::Fs::print_modules($s)
50 TODO - doesn't work, segfaults if $s is null, doesn't do anything if
51 its an empty string
53 =item SVN::Fs::props_changed($root1, $path1, $root2, $path2)
55 See also C<SVN::Fs::contents_changed>
57 =item SVN::Fs::purge_txn($fs, $txn_id)
59 Cleanup the transaction C<$txn_id>, removing it completely from
60 the filesystem C<$fs>.
62 =item SVN::Fs::set_warning_func($fs, $code, $baton)
64 =item SVN::Fs::unparse_id($id)
66 Return a string containing the unparsed form of the node or node
67 revision id $id, which must be a C<_p_svn_fs_id_t> object.
69 TODO - why isn't this a method of that object?
71 =item SVN::Fs::version()
73 TODO - what can we do with the _p_svn_version_t value returned?
75 =item SVN::Fs::create_access($username)
77 Return a new C<_p_svn_fs_access_t> object representing C<$username>.
78 C<$username> is presumed to have been authenticated by the caller.
80 =back
82 =cut
84 package _p_svn_fs_t;
86 =head1 _p_svn_fs_t
88 =over
90 =item $fs-E<gt>begin_txn($rev)
92 Creates a new transaction in the repository, and returns a
93 C<_p_svn_fs_txn_t> object representing it. The new transaction's
94 base revision will be $rev, which should be a number.
96 =item $fs-E<gt>change_rev_prop
98 =item $fs-E<gt>generate_lock_token()
100 Generate a unique lock-token using C<$fs>.
102 TODO - translate this to apply to Perl:
103 This can be used in to populate lock->token before calling
104 svn_fs_attach_lock().
106 =item $fs-E<gt>get_access()
108 The filesystem's current access context, as a C<_p_svn_fs_access_t>
109 object. Returns undef if no access context has been set with
110 the C<set_access()> method.
112 =item $fs-E<gt>get_lock
114 =item $fs-E<gt>get_locks
116 =item $fs-E<gt>get_uuid()
118 The UUID associated with C<$fs>.
120 =item $fs-E<gt>list_transactions()
122 A reference to an array of all currently active transactions in the
123 filesystem. Each one is a string containing the transaction's ID,
124 suitable for passing to C<$fs-E<gt>open_txn()>.
126 =item $fs-E<gt>lock
128 =item $fs-E<gt>open_txn($name)
130 Get a transaction in the repository by name. Returns a
131 C<_p_svn_fs_txn_t> object.
133 =item $fs-E<gt>revision_prop($rev, $propname)
135 The value of revision property C<$propname> in revision C<$rev>.
137 =item $fs-E<gt>revision_proplist($rev)
139 A hashref containing the names and values of all revision properties
140 from revision C<$rev>.
142 =item $fs-E<gt>revision_root
144 =item $fs-E<gt>set_access($access)
146 Associate an access context with an open filesystem.
148 This method can be run multiple times on the same open
149 filesystem, in order to change the filesystem access context for
150 different filesystem operations. C<$access> should be
151 a C<_p_svn_fs_access_t> object, or undef to disassociate the
152 current access context from the filesystem.
154 =item $fs-E<gt>set_uuid($uuid)
156 Associate C<$uuid> with C<$fs>.
158 =item $fs-E<gt>unlock
160 =item $fs-E<gt>youngest_rev()
162 Return the number of the youngest revision in the filesystem.
163 The oldest revision in any filesystem is numbered zero.
165 =back
167 =cut
169 our @methods = qw/youngest_rev revision_root revision_prop revision_proplist
170 change_rev_prop list_transactions open_txn begin_txn
171 get_uuid set_uuid set_access get_access
172 lock unlock get_lock get_locks generate_lock_token path/;
174 for (@methods) {
175 no strict 'refs';
176 *{$_} = *{"SVN::Fs::$_"};
179 package _p_svn_fs_root_t;
181 =head1 _p_svn_fs_root_t
183 =over
185 =item $root-E<gt>apply_text
187 =item $root-E<gt>apply_textdelta
189 =item $root-E<gt>change_node_prop($path, $propname, $value)
191 =item $root-E<gt>check_path($path)
193 Kind of node at C<$path>. A number which matches one of these constants:
194 $SVN::Node::none, $SVN::Node::file,
195 $SVN::Node::dir, $SVN::Node::unknown.
197 =item $root-E<gt>close_root
199 =item $root-E<gt>closest_copy
201 =item $root-E<gt>copied_from
203 =item $root-E<gt>copy
205 =item $root-E<gt>delete
207 =item $root-E<gt>dir_entries
209 =item $root-E<gt>file_contents
211 =item $root-E<gt>file_length
213 =item $root-E<gt>file_md5_checksum
215 =item $root-E<gt>fs()
217 The filesystem to which C<$root> belongs, as a C<_p_svn_fs_t> object.
219 =item $root-E<gt>is_dir($path)
221 True if there is a node at C<$path> which is a directory.
223 =item $root-E<gt>is_file($path)
225 True if there is a node at C<$path> which is a file.
227 =item $root-E<gt>is_revision_root()
229 True if the root comes from a revision (i.e., the contents has already been
230 committed).
232 =item $root-E<gt>is_txn_root()
234 True if the root comes from a transaction.
236 =item $root-E<gt>make_dir
238 =item $root-E<gt>make_file
240 =item $root-E<gt>node_created_path($path)
242 =item $root-E<gt>node_created_rev($path)
244 =item $root-E<gt>node_history($path)
246 TODO - _p_svn_fs_history_t
248 =item $root-E<gt>node_id($path)
250 =item $root-E<gt>node_prop($path, $propname)
252 =item $root-E<gt>node_proplist($path)
254 =item $root-E<gt>paths_changed()
256 A reference to a hash indicating what changes are made in the root.
257 The keys are the paths of the files changed, starting with C</> to
258 indicate the top-level directory of the repository. The values
259 are C<_p_svn_fs_path_change_t> objects which contain information about
260 what kind of changes are made.
262 =item $root-E<gt>revision_link
264 =item $root-E<gt>revision_root_revision
266 Revision number of the revision the root comes from.
267 For transaction roots, returns C<$SVN::Core::INVALID_REVNUM>.
269 =back
271 =cut
273 our @methods = qw/apply_textdelta apply_text change_node_prop
274 check_path close_root copied_from copy
275 dir_entries delete file_contents closest_copy
276 file_length file_md5_checksum is_dir is_file
277 is_revision_root is_txn_root make_dir make_file
278 node_created_rev node_history node_id node_prop
279 node_proplist paths_changed revision_link
280 revision_root_revision/;
282 *fs = *SVN::Fs::root_fs;
283 *txn_name = *_p_svn_fs_txn_t::root_name;
285 for (@methods) {
286 no strict 'refs';
287 *{$_} = *{"SVN::Fs::$_"};
290 package _p_svn_fs_history_t;
291 use SVN::Base qw(Fs svn_fs_history_);
293 =head1 _p_svn_fs_history_t
295 =over
297 =item $history-E<gt>location()
299 In list context, a list of two items: the path to the node whose history
300 this is, and the revision number in which it exists. In scalar context
301 returns only the revision number.
303 =item $history-E<gt>prev($cross_copies)
305 =back
307 =cut
309 package _p_svn_fs_txn_t;
310 use SVN::Base qw(Fs svn_fs_txn_);
312 =head1 _p_svn_fs_txn_t
314 =over
316 =item $txn-E<gt>abort()
318 Abort the transaction. Any changes made in C<$txn> are discarded, and
319 the filesystem is left unchanged.
321 Note: This function first sets the state of C<$txn> to 'dead', and
322 then attempts to purge it and any related data from the filesystem.
323 If some part of the cleanup process fails, C<$txn> and some portion
324 of its data may remain in the database after this function returns.
325 Use C<$fs-E<gt>purge_txn()> to retry the transaction cleanup.
327 =item $txn-E<gt>base_revision()
329 The transaction's base revision number.
331 =item $txn-E<gt>change_prop($name, $value)
333 Add, change, or remove a property from the transaction.
334 If C<$value> is C<undef> then the property C<$name> is removed,
335 if it exists. Otherwise the property C<$name> is set to the
336 new value.
338 =item $txn-E<gt>commit
340 =item $txn-E<gt>name()
342 Full name of the revision, in the same format as can be passed
343 to C<$fs-E<gt>open_txn()>.
345 =item $txn-E<gt>prop($name)
347 The value of the transaction's C<$name> property.
349 =item $txn-E<gt>proplist()
351 A reference to a hash containing all the transaction's properties,
352 keyed by name.
354 =item $txn-E<gt>root()
356 The root directory of the transaction, as a C<_p_svn_fs_root_t> object.
358 =back
360 =cut
362 *commit = *SVN::Fs::commit_txn;
363 *abort = *SVN::Fs::abort_txn;
364 *change_prop = *SVN::Fs::change_txn_prop;
366 package _p_svn_fs_access_t;
367 use SVN::Base qw(Fs svn_fs_access_);
369 =head1 _p_svn_fs_access_t
371 =head2 SYNOPSIS
373 my $access = SVN::Fs::create_access($username);
375 my $access = $fs->get_access;
376 $fs->set_access($access);
378 my $username = $access->get_username;
380 $access->add_lock_token($token);
382 =head2 METHODS
384 =over
386 =item $access-E<gt>add_lock_token($token)
388 Push a lock-token into the access context. The
389 context remembers all tokens it receives, and makes them available
390 to fs functions.
392 =item $access-E<gt>get_username
394 The username represented by the access context.
396 =back
398 =cut
400 package _p_svn_fs_dirent_t;
401 use SVN::Base qw(Fs svn_fs_dirent_t_);
403 =head1 svn_fs_dirent_t
405 An object representing a directory entry. Values of this type are returned
406 as the values in the hash returned by C<$root-E<gt>dir_entries()>. They
407 are like L<svn_dirent_t|SVN::Core/svn_dirent_t> objects, but have less
408 information.
410 =over
412 =item $dirent-E<gt>id()
414 TODO
416 =item $dirent-E<gt>kind()
418 Node kind. A number which matches one of these constants:
419 $SVN::Node::none, $SVN::Node::file,
420 $SVN::Node::dir, $SVN::Node::unknown.
422 =item $dirent-E<gt>name()
424 The filename of the directory entry.
426 =back
428 =cut
430 package _p_svn_fs_path_change_t;
431 use SVN::Base qw(Fs svn_fs_path_change_t_);
433 =head1 _p_svn_fs_path_change_t
435 =over
437 =item $change-E<gt>change_kind()
439 The type of change made. A number which matches one of the following:
441 =over
443 =item $SVN::Fs::PathChange::modify
445 Content at path modified.
447 =item $SVN::Fs::PathChange::add
449 Path added in transaction.
451 =item $SVN::Fs::PathChange::delete
453 Path removed in transaction.
455 =item $SVN::Fs::PathChange::replace
457 Path removed and re-added in transaction.
459 =item $SVN::Fs::PathChange::reset
461 Ignore all previous change items for path (internal-use only).
463 =back
465 =item $change-E<gt>node_rev_id()
467 Node revision id of changed path. A C<_p_svn_fs_id_t> object.
469 =item $change-E<gt>prop_mod()
471 True if the properties were modified.
473 =item $change-E<gt>text_mod()
475 True if the text (content) was modified.
477 =back
479 =cut
481 package SVN::Fs::PathChange;
482 use SVN::Base qw(Fs svn_fs_path_change_);