GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SVN::Dump(3) User Contributed Perl Documentation SVN::Dump(3)

SVN::Dump - A Perl interface to Subversion dumps

version 0.08

    #!/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;

An SVN::Dump object represents a Subversion dump.

This module follow the semantics used in the reference document (the file notes/fs_dumprestore.txt in the Subversion source tree):

  • A dump is a collection of records (SVN::Dump::Record objects).
  • A record is composed of a set of headers (a SVN::Dump::Headers object), a set of properties (a SVN::Dump::Property object) and an optional bloc of text (a SVN::Dump::Text object).
  • Some special records ("delete" records with a "Node-kind" header) recursively contain included records.

Each class has a "as_string()" method that prints its content in the dump format.

The most basic thing you can do with SVN::Dump is simply copy a dump:

    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.

SVN::Dump provides the following methods:
new( \%args )
Return a new SVN::Dump object.

The argument list is a hash reference.

If the SVN::Dump object will read information from a file, the arguments "file" is used (as usal, "-" means "STDIN"); if the dump is read from a filehandle, "fh" is used.

Extra options will be passed to the SVN::Dump::Reader object that is created.

If the SVN::Dump isn't used to read information, the parameters "version" and "uuid" can be used to initialise the values of the "SVN-fs-dump-format-version" and "UUID" headers.

next_record()
Return the next record read from the dump. This is a SVN::Dump::Record object.
version()
format()
Return the dump format version, if the version record has already been read, or if it was given in the constructor.
uuid()
Return the dump UUID, if there is an UUID record and it has been read, or if it was given in the constructor.
as_string()
Return a string representation of the dump specific blocks (the "format" and "uuid" blocks only).

SVN::Dump::Reader, SVN::Dump::Record.

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

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

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2020-03-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.