use strict; use warnings; package SVN::Fs; use SVN::Base qw(Fs svn_fs_); =head1 NAME SVN::Fs - Subversion filesystem functions =head1 DESCRIPTION SVN::Fs wraps the functions in svn_fs.h. The actual namespace for filesystem objects is C<_p_svn_fs_t>. =head1 FUNCTIONS =over =item SVN::Fs::berkeley_logfiles($path, $only_unused) =item SVN::Fs::berkeley_recover($path) =item SVN::Fs::check_related($id1, $id2) =item SVN::Fs::compare_ids($id1, $id2) =item SVN::Fs::contents_changed($root1, $path1, $root2, $path2) =item SVN::Fs::create($path, $config) =item SVN::Fs::delete_fs($path) =item SVN::Fs::deltify_revision($fs, $rev) =item SVN::Fs::get_file_delta_stream($source_root, $source_path, $target_root, $target_path) =item SVN::Fs::hotcopy($src_path, $dest_path, $clean) =item SVN::Fs::initialize($pool) =item SVN::Fs::merge($source_root, $source_path, $target_root, $target_path, $ancestor_root, $ancestor_path) =item SVN::Fs::open($path, $config) =item SVN::Fs::path($fs) =item SVN::Fs::print_modules($s) TODO - doesn't work, segfaults if $s is null, doesn't do anything if its an empty string =item SVN::Fs::props_changed($root1, $path1, $root2, $path2) See also C =item SVN::Fs::purge_txn($fs, $txn_id) Cleanup the transaction C<$txn_id>, removing it completely from the filesystem C<$fs>. =item SVN::Fs::set_warning_func($fs, $code, $baton) =item SVN::Fs::unparse_id($id) Return a string containing the unparsed form of the node or node revision id $id, which must be a C<_p_svn_fs_id_t> object. TODO - why isn't this a method of that object? =item SVN::Fs::version() TODO - what can we do with the _p_svn_version_t value returned? =item SVN::Fs::create_access($username) Return a new C<_p_svn_fs_access_t> object representing C<$username>. C<$username> is presumed to have been authenticated by the caller. =back =cut package _p_svn_fs_t; =head1 _p_svn_fs_t =over =item $fs-Ebegin_txn($rev) Creates a new transaction in the repository, and returns a C<_p_svn_fs_txn_t> object representing it. The new transaction's base revision will be $rev, which should be a number. =item $fs-Echange_rev_prop =item $fs-Egenerate_lock_token() Generate a unique lock-token using C<$fs>. TODO - translate this to apply to Perl: This can be used in to populate lock-Etoken before calling svn_fs_attach_lock(). =item $fs-Eget_access() The filesystem's current access context, as a C<_p_svn_fs_access_t> object. Returns undef if no access context has been set with the C method. =item $fs-Eget_lock =item $fs-Eget_locks =item $fs-Eget_uuid() The UUID associated with C<$fs>. =item $fs-Elist_transactions() A reference to an array of all currently active transactions in the filesystem. Each one is a string containing the transaction's ID, suitable for passing to C<$fs-Eopen_txn()>. =item $fs-Elock =item $fs-Eopen_txn($name) Get a transaction in the repository by name. Returns a C<_p_svn_fs_txn_t> object. =item $fs-Erevision_prop($rev, $propname) The value of revision property C<$propname> in revision C<$rev>. =item $fs-Erevision_proplist($rev) A hashref containing the names and values of all revision properties from revision C<$rev>. =item $fs-Erevision_root =item $fs-Eset_access($access) Associate an access context with an open filesystem. This method can be run multiple times on the same open filesystem, in order to change the filesystem access context for different filesystem operations. C<$access> should be a C<_p_svn_fs_access_t> object, or undef to disassociate the current access context from the filesystem. =item $fs-Eset_uuid($uuid) Associate C<$uuid> with C<$fs>. =item $fs-Eunlock =item $fs-Eyoungest_rev() Return the number of the youngest revision in the filesystem. The oldest revision in any filesystem is numbered zero. =back =cut our @methods = qw/ youngest_rev revision_root revision_prop revision_proplist change_rev_prop list_transactions open_txn begin_txn get_uuid set_uuid set_access get_access lock unlock get_lock get_locks generate_lock_token path /; for (@methods) { no strict 'refs'; *{$_} = *{"SVN::Fs::$_"}; } package _p_svn_fs_root_t; =head1 _p_svn_fs_root_t =over =item $root-Eapply_text =item $root-Eapply_textdelta =item $root-Echange_node_prop($path, $propname, $value) =item $root-Echeck_path($path) Kind of node at C<$path>. A number which matches one of these constants: $SVN::Node::none, $SVN::Node::file, $SVN::Node::dir, $SVN::Node::unknown. =item $root-Eclose_root =item $root-Eclosest_copy =item $root-Ecopied_from =item $root-Ecopy =item $root-Edelete =item $root-Edir_entries =item $root-Efile_contents =item $root-Efile_length =item $root-Efile_md5_checksum =item $root-Efs() The filesystem to which C<$root> belongs, as a C<_p_svn_fs_t> object. =item $root-Eis_dir($path) True if there is a node at C<$path> which is a directory. =item $root-Eis_file($path) True if there is a node at C<$path> which is a file. =item $root-Eis_revision_root() True if the root comes from a revision (i.e., the contents has already been committed). =item $root-Eis_txn_root() True if the root comes from a transaction. =item $root-Emake_dir =item $root-Emake_file =item $root-Enode_created_path($path) =item $root-Enode_created_rev($path) =item $root-Enode_history($path) TODO - _p_svn_fs_history_t =item $root-Enode_id($path) =item $root-Enode_prop($path, $propname) =item $root-Enode_proplist($path) =item $root-Epaths_changed() A reference to a hash indicating what changes are made in the root. The keys are the paths of the files changed, starting with C to indicate the top-level directory of the repository. The values are C<_p_svn_fs_path_change_t> objects which contain information about what kind of changes are made. =item $root-Erevision_link =item $root-Erevision_root_revision Revision number of the revision the root comes from. For transaction roots, returns C<$SVN::Core::INVALID_REVNUM>. =back =cut our @methods = qw/ apply_textdelta apply_text change_node_prop check_path close_root copied_from copy dir_entries delete file_contents closest_copy file_length file_md5_checksum is_dir is_file is_revision_root is_txn_root make_dir make_file node_created_rev node_history node_id node_prop node_proplist paths_changed revision_link revision_root_revision /; *fs = *SVN::Fs::root_fs; *txn_name = *_p_svn_fs_txn_t::root_name; for (@methods) { no strict 'refs'; *{$_} = *{"SVN::Fs::$_"}; } package _p_svn_fs_history_t; use SVN::Base qw(Fs svn_fs_history_); =head1 _p_svn_fs_history_t =over =item $history-Elocation() In list context, a list of two items: the path to the node whose history this is, and the revision number in which it exists. In scalar context returns only the revision number. =item $history-Eprev($cross_copies) =back =cut package _p_svn_fs_txn_t; use SVN::Base qw(Fs svn_fs_txn_); =head1 _p_svn_fs_txn_t =over =item $txn-Eabort() Abort the transaction. Any changes made in C<$txn> are discarded, and the filesystem is left unchanged. Note: This function first sets the state of C<$txn> to 'dead', and then attempts to purge it and any related data from the filesystem. If some part of the cleanup process fails, C<$txn> and some portion of its data may remain in the database after this function returns. Use C<$fs-Epurge_txn()> to retry the transaction cleanup. =item $txn-Ebase_revision() The transaction's base revision number. =item $txn-Echange_prop($name, $value) Add, change, or remove a property from the transaction. If C<$value> is C then the property C<$name> is removed, if it exists. Otherwise the property C<$name> is set to the new value. =item $txn-Ecommit =item $txn-Ename() Full name of the revision, in the same format as can be passed to C<$fs-Eopen_txn()>. =item $txn-Eprop($name) The value of the transaction's C<$name> property. =item $txn-Eproplist() A reference to a hash containing all the transaction's properties, keyed by name. =item $txn-Eroot() The root directory of the transaction, as a C<_p_svn_fs_root_t> object. =back =cut *commit = *SVN::Fs::commit_txn; *abort = *SVN::Fs::abort_txn; *change_prop = *SVN::Fs::change_txn_prop; package _p_svn_fs_access_t; use SVN::Base qw(Fs svn_fs_access_); =head1 _p_svn_fs_access_t =head2 SYNOPSIS my $access = SVN::Fs::create_access($username); my $access = $fs->get_access; $fs->set_access($access); my $username = $access->get_username; $access->add_lock_token($token); =head2 METHODS =over =item $access-Eadd_lock_token($token) Push a lock-token into the access context. The context remembers all tokens it receives, and makes them available to fs functions. =item $access-Eget_username The username represented by the access context. =back =cut package _p_svn_fs_dirent_t; use SVN::Base qw(Fs svn_fs_dirent_t_); =head1 svn_fs_dirent_t An object representing a directory entry. Values of this type are returned as the values in the hash returned by C<$root-Edir_entries()>. They are like L objects, but have less information. =over =item $dirent-Eid() TODO =item $dirent-Ekind() Node kind. A number which matches one of these constants: $SVN::Node::none, $SVN::Node::file, $SVN::Node::dir, $SVN::Node::unknown. =item $dirent-Ename() The filename of the directory entry. =back =cut package _p_svn_fs_path_change_t; use SVN::Base qw(Fs svn_fs_path_change_t_); =head1 _p_svn_fs_path_change_t =over =item $change-Echange_kind() The type of change made. A number which matches one of the following: =over =item $SVN::Fs::PathChange::modify Content at path modified. =item $SVN::Fs::PathChange::add Path added in transaction. =item $SVN::Fs::PathChange::delete Path removed in transaction. =item $SVN::Fs::PathChange::replace Path removed and re-added in transaction. =item $SVN::Fs::PathChange::reset Ignore all previous change items for path (internal-use only). =back =item $change-Enode_rev_id() Node revision id of changed path. A C<_p_svn_fs_id_t> object. =item $change-Eprop_mod() True if the properties were modified. =item $change-Etext_mod() True if the text (content) was modified. =back =head1 COPYRIGHT Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =cut package SVN::Fs::PathChange; use SVN::Base qw(Fs svn_fs_path_change_); 1;