SVN::Dump(3pm)

πŸ“¦
version 0.08 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ SVN::Dump β€” a Perl interface to Subversion dumps ✨

okay bestie, welcome to the SVN::Dump(3pm) page πŸ’– this is the User Contributed Perl Documentation section, and we're about to make Subversion dump files make sense. no cap.

Version: 0.08 β€” yes she's been around a while and she's still slaying 🫢


🌈 SYNOPSIS 🌈

#!/usr/bin/perl
use strict;
use warnings;
use SVN::Dump;

my $file = shift;
my $dump = SVN::Dump->new( { file => $file } );

# compute some stats
my %type;
my %kind;
while ( my $record = $dump->next_record() ) {
    $type{ $record->type() }++;
    $kind{ $record->get_header('Node-action') }++
        if $record->type() eq 'node';
}

# print the results
print "Statistics for dump $file:\n",
      "  version:   ", $dump->version(), "\n",
      "  uuid:      ", $dump->uuid(), "\n",
      "  revisions: ", $type{revision}, "\n",
      "  nodes:     ", $type{node}, "\n";
print map { sprintf "  - %-7s: %d\n", $_, $kind{$_} } sort keys %kind;

like literally look at her go πŸ’… counting revisions and nodes and printing a whole little report. iconic behaviour.


πŸ¦‹ DESCRIPTION πŸ¦‹

An SVN::Dump object represents a Subversion dump. that's the whole vibe. one object, one dump. πŸŽ€

This module follows the semantics used in the reference document β€” that's the file notes/fs_dumprestore.txt in the Subversion source tree. iykyk.

Here's the mental model, bestie, memorise it:

  • A dump is a collection of records (which are SVN::Dump::Record objects).
  • A record is made of a set of headers (an SVN::Dump::Headers object), a set of properties (an SVN::Dump::Property object), and an optional block of text (an SVN::Dump::Text object).
  • Some special records β€” the "delete" records that have a Node-kind header β€” recursively contain included records. yes, records inside records. nested. main character energy πŸͺ†

Every one of these classes has an as_string() method that prints its content in the dump format. super handy.

The most basic thing you can do with SVN::Dump is simply copy a dump. it's giving "copy-paste but make it architecture":

use SVN::Dump;

my $dump = SVN::Dump->new( { file => 'mydump.svn' } );
$dump->next_record;          # read the format header
$dump->next_record;          # read the uuid header
print $dump->as_string();    # only print the dump header

while( $rec = $dump->next_record() ) {
    print $rec->as_string();
}
After the operation, the resulting dump should be identical to the original dump. take that to the bank, fr fr πŸ’–

πŸ‘‘ METHODS πŸ‘‘

SVN::Dump provides the following methods. let's go through them one by one, no skipping, periodt.

  • new( \%args ) β€” Return a new SVN::Dump object. The argument list is a hash reference. If the SVN::Dump object is going to read information from a file, you use the file argument (and like always, - means STDIN); if the dump is read from a filehandle, you use fh instead. Any extra options get passed along to the SVN::Dump::Reader object that gets created. And if your SVN::Dump isn't being used to read information, you can use the version and uuid parameters to initialise the values of the SVN-fs-dump-format-version and UUID headers. versatile queen ✨
  • next_record() β€” Return the next record read from the dump. That's a SVN::Dump::Record object. one at a time, bestie, we're pacing ourselves πŸ¦‹
  • version() format() β€” Return the dump format version, if the version record has already been read, or if it was given in the constructor. two names, same energy πŸ’…
  • uuid() β€” Return the dump UUID, if there is a UUID record and it has been read, or if it was given in the constructor. she's only speaking up if she actually knows it πŸ”₯
  • as_string() β€” Return a string representation of the dump's specific blocks β€” and that's the format and uuid blocks only. don't come for more, that's not what she does πŸ™ˆ

🌸 SEE ALSO 🌸

  • SVN::Dump::Reader
  • SVN::Dump::Record

The reference document for Subversion dumpfiles lives at: http://svn.apache.org/repos/asf/subversion/trunk/notes/dump-load-format.txt

go read it, it's the source of truth, no cap πŸ“š


Copyright 2006-2020 Philippe Bruhat (BooK), All Rights Reserved.


πŸŽ€ LICENSE πŸŽ€

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


ok that's the whole page bestie, you ate πŸ’– go copy some dumps πŸ’…

and a lil sign-off: this was SVN::Dump(3pm) from the User Contributed Perl Documentation, generated by perl v5.36.0 on 2022-10-14. mwah 😘 πŸ¦‹

πŸ“¦ where this page comes from