SVN::Dumpfile - Perl extension to access and manipulate Subversion dumpfiles
use SVN::Dumpfile;
# Opens existing dumpfile:
my $olddf = SVN::Dumpfile->new(file => "old.dump");
# Creates new dumpfile with same version and UUID as old one:
my $newdf = $olddf->copy->create(file => "new.dump");
# Read old dumpfile node by node
while ( my $node = $olddf->read_node ) {
# Manipulate current node:
$node->header("some header","new value");
$node->property("some property","new value");
$node->changed;
# Write to new dumpfile
$newdf->write_node($node);
}
SVN::Dumpfile represents a Subversion (http://subversion.tigris.org/) dumpfile.
It provides methods to read existing and write modified or new dumpfiles. It
supports dumpfiles with the version number 1 - 3 but was written in a tolerant
way to also support newer versions as long no major changes are made.
This module is a OO redesign and generalisation of SVN::Dumpfilter
v0.21. Newer versions of SVN::Dumpfilter are using it to access the input
and output dumpfiles.
The ability to create new dumpfiles sets it apart from the similar
module SVN::Dump. The submodule SVN::Dumpfile::Node::Properties also allows
the processing of Subversion revision property files (i.e. the files lying
in the $REPOSITORY/db/revprops/ directory holding
the author, date and log entry of every revision).
Nothing, because it's an Object Oriented module.
Authors Module Website: <http://www.scharrer-online.de/svn/>
Other man pages of sub-classes:
- SVN::Dumpfile::Node
- SVN::Dumpfile::Node::Headers
- SVN::Dumpfile::Node::Properties
- SVN::Dumpfile::Node::Content
Martin Scharrer, <martin@scharrer-online.de>;
<http://www.scharrer-online.de/>
Copyright (C) 2006-2008 by Martin Scharrer
This library is free software; you can redistribute it and/or
modify it under the GPL v3 or the same terms as Subversion or Perl itself,
either Perl version 5.8.8 or, at your option, any later version of Perl 5
you may have available.
- new()
- Constructor. Returns a new SVN::Dumpfile object. Attributes can be given
as hash reference or as even array with key/value pairs. If only one
argument is given it will be taken as dumpfile name. The following
attributes can be used:
- file
- The file name of the dumpfile.
- version
- The version number of the dumpfile.
- UUID
- The UUID of the dumpfile.
Please note that if the represented dumpfile is given by name it
is not opened yet. open() has to be called first.
- uuid()
- Returns or sets the UUID of the dumpfile. A lvalue of the internal UUID is
returned, so the new UUID can be given as the first argument or assigned
directly to the function:
$df->uuid # Returns uuid
$df->uuid($newuuid) # Set new uuid
$df->uuid = $newuuid # Set new uuid
- version()
- Returns or sets the version of the dumpfile. A lvalue of the internal
version is returned, so the new version can be given as the first argument
or assigned directly to the function:
$df->version # Returns version
$df->version($newuuid) # Sets new version
$df->version = $newuuid # Sets new version
- open()
- Opens a existing dumpfile. The file name can be given as argument or is
taken from the instance. Will reopen the file if called a second time. Can
be called as class or instance method. Returns a reference on the new or
calling object or undef on failure.
- copy()
- Creates a new SVN::Dumpfile instance with the same version and UUID as the
instance it was called upon. No other informations are copied.
- create()
- Creates and opens a new dumpfile on the harddisk. Can be called as class
or instance method. The file name can be given as an argument or is taken
from the instance. Returns a reference on the new or calling object or
undef on failure.
- as_string()
- to_string()
- Returns the dumpfile header lines as string. These are the first lines of
the dumpfile and do not hold any node information, i.e. this doesn't
return the whole dumpfile. At the moment the only header lines are the
dumpfile version and, starting from version 2, the UUID. This method is
called by create() to write out the dumpfile head.
- read_node()
- next_node()
- get_node()
- Returns the next node of the dumpfile as SVN::Dumpfile::Node instance.
Alternative names are "get_node" or
"next_node".
- write_node()
- Awaits a SVN::Dumpfile::Node instance and writes this to the
dumpfile.
- close()
- Closes the dumpfile. This will be called automatically when the dumpfile
reference is going out of scope.
- version_supported()
- Returns true if given version number is supported by SVN::Dumpfile. Can be
called as class or instance method. If called on an instance and the
version number is not given as an argument the internal version is
taken.
- dump()
- Dumps the object to STDERR using Data::Dumper for debugging.