NAME

SVN::Dumpfile::Node - Represents a node in a subversion dumpfile.

SYNOPSIS

Objects of this class are returned by SVN::Dumpfile method read_node():

use SVN::Dumpfile;
my $df = new SVN::Dumpfile ('filename');
my $node = $df->read_node();

DESCRIPTION, SEE ALSO, AUTHOR, COPYRIGHT

See SVN::Dumpfile.

METHODS

new()

Returns new node object. A node consists out of a header ('key: value' lines), optional properties and optional content. All three can be given by providing a hash (as reference or list) or by extra methods (see below).

my $enode = new SVN::Dumpfile::Node();   # Empty node
my $fnode = new SVN::Dumpfile::Node(     # Filled node
    headers => {
            'Node-path' => 'a/path',
            ....
            },
    properties => { # can be [ to maintain given order
            'svn:keywords' => 'Author Id',
            ....
            },      # or ]
    content => "some text or binary content"
);
newrev()

Returns a new revision node which represents the start of a new revision. This is a special node which has a 'Revision-number' header line and normaly the 'svn:author', 'svn:date' and 'svn:log' properties. All can be given by providing a hash (as reference or list) or by extra methods (see below).

my $rev = newrev SVN::Dumpfile::Node (
    number => 123,
    author => 'martin',
    date   => time,
    log    => 'Implemented feature XYZ.',
);

Note that date must be either an Unix time integer or a string with the format 'YYYY-MM-DDTHH:MM:SS.SFRACTZ' ('T' and 'Z' are literals), e.g.: '2006-05-10T13:31:40.486172Z'. The date string is in GMT ("Zulu") time.

content()
content('new content')
content() = 'new content'

Returns or sets the node content. The new value can be set by providing it as argument or by assigning it to the method which returns an lvalue.

contents()

Returns a reference to the node content object which is from the class SVN::Dumpfile::Node::Content. Because the stringification operator of this class is overloaded it returns as_string() in string context, i.e.:

$node->contents . 'some string, can be empty'
has_contents()

Returns true if the node has content.

header('name')
header('name', 'new value')
header('name') = 'new value'

Returns or sets a node header line. The new value can be set by providing it as argument or by assigning it to the method which returns an lvalue.

headers()

Returns a reference to the node header object which is from the class SVN::Dumpfile::Node::Headers.

has_header('header')

Returns true if the node has the the given header line.

has_headers()

Returns number of header lines and so true if the node has header lines. Without correct header lines the node is not valid and properties and content will not be written with write().

property('name')
property('name', 'new value')
property('name') = 'new value'

Returns or sets a node property. The new value can be set by providing it as argument or by assigning it to the method which returns an lvalue.

has_property('name')

Returns true if the node has the given property.

properties()

Returns a reference to the node properties object which is from the class SVN::Dumpfile::Node::Properties.

has_properties()

Returns true if the node has properties.

changed()

Marks the node as changed, e.g. the content and properties header are out-of-date. This will cause an recalc_headers() call at write() or as_string().

has_changed()

Returns true if the node is marked as changed. Call recall_headers() to unmark the note. See also changed.

is_rev()

Returns true if the node is a revision node.

revnum()
revnum($new_revnum)
revnum() = $new_revnum

Returns or sets the revision number if the node is a revision node. Otherwise the method call is ignore and does return undef. The new number can be set by providing it as argument or by assigning it to the method which returns an lvalue.

read($filehandle)

Reads the node from the given filehandle. This is normally called from a SVN::Dumpfile object.

write($filehandle)

Writes the node to the given filehandle. This is normally called from a SVN::Dumpfile object.

as_string()

Returns the whole node as string like it would be written to the dumpfile.

recalc_headers()

Recalculates all content and property header lines. This is needed to have correct length and MD5 header lines after properties and/or content have changed.

recalc_content_header()

Recalculates content header lines. This method is also called by the two following methods.

recalc_textcontent_header()

Recalculates text content header lines.

recalc_prop_header()

Recalculates properties header lines.