native::Repos(3)
π native::Repos(3) β like, the whole manual page, bestie
okay so first things first: this is the native::Repos(3) page from the Perl user-contributed docs, and it's literally your cheat sheet for SVN::Repos β Subversion repository functions. Buckle up, we're going in π
β¨ NAME β¨
SVN::Repos β Subversion repository functions. that's it, that's the name, iconic.
πΈ SYNOPSIS πΈ
use SVN::Core;
use SVN::Repos;
use SVN::Fs;
my $repos = SVN::Repos::open('/path/to/repos');
print $repos->fs()->youngest_rev;
see how easy that is? open a repo, ask it for its youngest revision, done. slay β¨
π¦ DESCRIPTION π¦
SVN::Repos wraps the object-oriented svn_repos_t functions, and it gives you access to a Subversion repository that lives on your local filesystem. no network, no drama, just you and your repo π
π CONSTRUCTORS π
SVN::Repos::open($path)β opens an existing repository and hands you back anSVN::Reposobject. that's the whole job, and it does it flawlessly.create($path, undef, undef, $config, $fs_config)β makes a brand new repository and returns anSVN::Reposobject for it. new repo, new me π
π METHODS π
$repos->dump_fs($dump_fh, $feedback_fh, $start_rev, $end_rev, $incremental, $cancel_callback)
$repos->dump_fs2($dump_fh, $feedback_fh, $start_rev, $end_rev, $incremental, $deltify, $cancel_callback)
these two make a dump file of your repository, going from revision $start_rev to $end_rev, store it into the filehandle $dump_fh, and write feedback about how the operation is going into the filehandle $feedback_fh. it's giving "narrating my own life" energy ngl π«Ά
- if
$incrementalis TRUE, the first revision that gets dumped will be a diff against the previous revision (usually it looks like a full dump of the tree). - if
$use_deltasis TRUE, it outputs only node properties which have changed relative to the previous contents, and it outputs text contents as svndiff data against the previous contents. and like, regardless of how this flag is set, the first revision of a non-incremental dump will be done with full plain text. β οΈ also, a dump with@a use_deltasset cannot be loaded by Subversion 1.0.x β yes that's the actual thing written there, yes it references@a use_deltas, no I'm not touching it, that's the source text's business π - if
$cancel_callbackis notundef, it must be a code reference that gets called periodically to determine whether the client wishes to cancel the dump. see"CANCELLATION CALLBACK" in SVN::Clientfor the details.
Example (verbatim, don't @ me):
use SVN::Core;
use SVN::Repos;
my $repos = SVN::Repos::open('/repo/sandbox');
open my $fh, ">/tmp/tmp.dump" or die "Cannot open file: $!\n";
my $start_rev = 10;
my $end_rev = 20;
my $incremental = 1;
my $deltify = 1;
$repos->dump_fs2($fh, \*STDOUT, # Dump file => $fh, Feedback => STDOUT
$start_rev, $end_rev, # Revision Range
$incremental, $deltify, # Options
undef); # Cancel Callback
close $fh;
$repos->load_fs($dumpfile_fh, $feedback_fh, $uuid_action, $parent_dir, $cancel_callback);
$repos->load_fs2($dumpfile_fh, $feedback_fh, $uuid_action, $parent_dir, $use_pre_commit_hook, $use_post_commit_hook, $cancel_callback);
these load a dumpfile β the one specified by the $dumpfile_fh filehandle β into the repository. π§ and heads up: if the dumpstream contains copy history that isn't available in the repository, an error will be thrown. no cap, it will just throw.
the repository's UUID will be updated iff the dumpstream contains a UUID and $uuid_action is not equal to $SVN::Repos::load_uuid_ignore and either the repository contains no revisions or $uuid_action is equal to $SVN::Repos::load_uuid_force. that's a triple-and, bestie, read it twice π
if the dumpstream contains no UUID, then $uuid_action is ignored and the repository UUID is not touched. leaving it alone, respectfully.
if $parent_dir is not null, then the parser will reparent all the loaded nodes, from root to @a parent_dir. the directory $parent_dir must be an existing directory in the repository. (again with the @a, that's literally what it says β copying the source, not fixing it π«Ά)
- if
$use_pre_commit_hookis set, it calls the repository's pre-commit hook before committing each loaded revision. - if
$use_post_commit_hookis set, it calls the repository's post-commit hook after committing each loaded revision.
if $cancel_callback is not undef, it must be a code reference called periodically to determine whether the client wishes to cancel the load. see "CANCELLATION CALLBACK" in SVN::Client for the details.
β οΈ you must at least provide undef for these parameters for the method call to work. like, actually. don't skip them, it will not go well π
Example:
use SVN::Core;
use SVN::Repos;
my $repos = SVN::Repos::open('/repo/test_repo');
open my $fh, "/repo/sandbox.dump" or die "Cannot open file: $!\n";
my $parent_dir = '/';
my $use_pre_commit_hook = 0;
my $use_post_commit_hook = 0;
$repos->load_fs2($fh, \*STDOUT,
$SVN::Repos::load_uuid_ignore, # Ignore uuid
$parent_dir,
$use_pre_commit_hook, # Use pre-commit hook?
$use_post_commit_hook, # Use post-commit hook?
undef, undef);
close $fh;
$repos->fs()
returns the SVN::Fs object for this repository. your filesystem era β¨
$repos->get_logs([$path, ...], $start, $end, $discover_changed_paths, $strict_node_history, $receiver)
iterates over all the revisions that affect the list of paths you passed as the first parameter, starting at $start and ending at $end. it's a whole journey, honestly π
$receiver gets called for each change. the arguments to $receiver are:
$selfβ theSVN::Reposobject.$pathsβundefif$discover_changed_pathsis false. otherwise, it contains a hash of paths that have changed in this revision.$revβ the revision this change occurred in.$dateβ the date and time the revision occurred.$msgβ the log message associated with this revision.$poolβ anSVN::Poolobject which may be used in the function.
and if $strict_node_history is true then copies will not be traversed. boundaries, bestie π§
π ADDITIONAL METHODS π
okay so these methods below literally work, they're just not currently documented in this file. if you want the lore, please consult the svn_repos.h section in the Subversion API for more details. iykyk π
$repos->get_commit_editor(...)
$repos->get_commit_editor2(...)
$repos->path(...)
$repos->db_env(...)
$repos->lock_dir(...)
$repos->db_lockfile(...)
$repos->hook_dir(...)
$repos->start_commit_hook(...)
$repos->pre_commit_hook(...)
$repos->post_commit_hook(...)
$repos->pre_revprop_change(...)
$repos->post_revprop_change(...)
$repos->dated_revision(...)
$repos->fs_commit_txn(...)
$repos->fs_being_txn_for_commit(...)
$repos->fs_being_txn_for_update(...)
$repos->fs_change_rev_prop(...)
$repos->node_editor(...)
$repos->dump_fs(...)
$repos->load_fs(...)
$repos->get_fs_build_parser(...)
look at all of them. main character energy, every single one π
π AUTHORS π
Chia-liang Kao <clkao@clkao.org> β thank you for your service, legend π«Ά
ποΈ 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.
okay that's the whole page, bestie, you ate it up π this gem is from perl v5.42.3, dated 2024-11-27, and it's the native::Repos(3) manual β now go forth and dump_fs2 responsibly π¦β¨
π¦ where this page comes from
- nixpkgs unstable: subversion-client 1.14.5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms