Package svndump :: Module node :: Class SvnDumpNode
[show private | hide private]
[frames | no frames]

Class SvnDumpNode


A node of a svn dump file.
Method Summary
  __init__(self, path, action, kind)
Initializes a new SvnDumpNode.
  __del__(self)
Delete method, cleanup temp file if needed.
  del_property(self, name)
Deletes a property of this node.
string get_action(self)
Returns the action of this node.
string get_copy_from_path(self)
Returns the path the node has been copied from or an empty string.
integer get_copy_from_rev(self)
Returns the revision the node has been copied from or zero.
string get_kind(self)
Returns the kind of this node.
string get_name(self)
Returns the name of this node.
string get_path(self)
Returns the path of this node.
dict( string -> string ) get_properties(self)
Returns the properties as a dict.
string get_property(self, name)
Returns the value of the property with the given name.
integer get_text_length(self)
Returns the length of the text.
string get_text_md5(self)
Returns the MD5 hash of the text.
bool has_copy_from(self)
Returns True when this node has copy-from-path and copy-from-rev.
bool has_md5(self)
Returns true when this node has a MD5 sum.
bool has_properties(self)
Returns True if this node has properties.
bool has_text(self)
Returns true when this node has text.
  set_copy_from(self, path, revnr)
Sets copy-from-path and copy-from-rev.
  set_kind(self, kind)
Set the kind of this node.
  set_path(self, path)
Sets the path of this node.
  set_properties(self, properties)
Sets the properties for this node.
  set_property(self, name, value)
Sets a property of this node.
  set_text_file(self, filename, length, md5, delete)
Sets the text for this node.
  set_text_fileobj(self, fileobj, offset, length, md5)
Sets the text for this node.
  set_text_node(self, node)
Sets the text for this node.
  text_close(self, handle)
Close the handle.
'opaque handle' text_open(self)
Open text and return a handle for text read functions.
string text_read(self, handle, count)
Read some text from a handle.
  text_reopen(self, handle)
Reopen the handle.
  write_text_to_file(self, outfile)
Writes the text to the given file object.

Method Details

__init__(self, path, action, kind)
(Constructor)

Initializes a new SvnDumpNode.
Parameters:
path - Path of this node.
           (type=string)
action - Action of this node. Valid actions are:
  • 'add'
  • 'delete'
  • 'change'
  • 'replace'

           (type=string)
kind - Kind of this node ('dir' or 'file'). If action is 'delete' kind may be the empty string.
           (type=string)

__del__(self)
(Destructor)

Delete method, cleanup temp file if needed.

del_property(self, name)

Deletes a property of this node.
Parameters:
name - Name of the property to delete.
           (type=string)

get_action(self)

Returns the action of this node.
Returns:
Either 'add', 'change', 'delete' or 'replace'.
           (type=string)

get_copy_from_path(self)

Returns the path the node has been copied from or an empty string.
Returns:
copy-from-path.
           (type=string)

get_copy_from_rev(self)

Returns the revision the node has been copied from or zero.
Returns:
copy-from-rev.
           (type=integer)

get_kind(self)

Returns the kind of this node.
Returns:
Either 'file', 'dir' or ''.
           (type=string)

get_name(self)

Returns the name of this node.
Returns:
The name of this node.
           (type=string)

get_path(self)

Returns the path of this node.
Returns:
The path of this node.
           (type=string)

get_properties(self)

Returns the properties as a dict.
Returns:
The properties of this node.
           (type=dict( string -> string ))

get_property(self, name)

Returns the value of the property with the given name.

If the property does not exist None is returned.
Parameters:
name - A property name.
           (type=string)
Returns:
Value of the property.
           (type=string)

get_text_length(self)

Returns the length of the text.
Returns:
Length of the text.
           (type=integer)

get_text_md5(self)

Returns the MD5 hash of the text.
Returns:
MD5 sum of the text.
           (type=string)

has_copy_from(self)

Returns True when this node has copy-from-path and copy-from-rev.
Returns:
True if this node has copy-from rev and path.
           (type=bool)

has_md5(self)

Returns true when this node has a MD5 sum.
Returns:
True when this node has a MD5 sum.
           (type=bool)

has_properties(self)

Returns True if this node has properties.
Returns:
True if this node has properties.
           (type=bool)

has_text(self)

Returns true when this node has text.
Returns:
True when this node has text.
           (type=bool)

set_copy_from(self, path, revnr)

Sets copy-from-path and copy-from-rev.

Only nodes with action 'add' or 'replace' may have copy-from revision and path.
Parameters:
path - copy-from-path
           (type=string)
revnr - copy-from-rev
           (type=integer)

set_kind(self, kind)

Set the kind of this node.

The kind can only be set if it was empty.
Parameters:
kind - New kind, either 'file' or 'dir'.
           (type=string)

set_path(self, path)

Sets the path of this node.
Parameters:
path - New path of this node.
           (type=string)

set_properties(self, properties)

Sets the properties for this node.
Parameters:
properties - A dict containing the properties.
           (type=dict( string -> string ))

set_property(self, name, value)

Sets a property of this node.

Nodes with action 'delete' cannot have properties.
Parameters:
name - Name of the property.
           (type=string)
value - Value of the property.
           (type=string)

set_text_file(self, filename, length=-1, md5='', delete=False)

Sets the text for this node.

The text will be read from the specified file.
Parameters:
filename - Name of the file containing the text.
           (type=string)
length - Length of the file.
           (type=integer, optional)
md5 - MD5 sum of the text if known.
           (type=string, optional)
delete - When True delete the file.
           (type=bool)

set_text_fileobj(self, fileobj, offset, length, md5)

Sets the text for this node.

The text will be read from the specified file object.
Parameters:
fileobj - A file object opened for reading and containing the text.
           (type=file object)
offset - Offset of the text.
           (type=integer)
length - Length of the text.
           (type=integer)
md5 - MD5 sum of the text.
           (type=string)

set_text_node(self, node)

Sets the text for this node.

The text will be that of the specified node.
Parameters:
node - An other node.
           (type=SvnDumpNode)

text_close(self, handle)

Close the handle.

See also: text_open(), text_reopen() and text_read().
Parameters:
handle - A handle opened with text_open().
           (type=handle)

text_open(self)

Open text and return a handle for text read functions.

Only one handle per dump file should be opened at the same time. A node for which the text has been set with set_text_node() virtually belongs also to the dump file of the node specified to set_text_node().

Also while the handle is open write_text_to_file() should not be called.

See also: text_reopen(), text_read() and text_close().
Returns:
A handle for the text read functions.
           (type='opaque handle')

text_read(self, handle, count=16384)

Read some text from a handle.

See also: text_open(), text_reopen() and text_close().
Parameters:
handle - A handle opened with text_open().
           (type=handle)
count - Count of bytes to read.
           (type=integer, optional)
Returns:
The data read.
           (type=string)

text_reopen(self, handle)

Reopen the handle.

Repositions the handle to the start of the text.

See also: text_open(), text_read() and text_close().
Parameters:
handle - A handle opened with text_open().
           (type=handle)

write_text_to_file(self, outfile)

Writes the text to the given file object.
Parameters:
outfile - A file object opened for writing.
           (type=file object)

Generated by Epydoc 2.1 on Fri Aug 14 23:53:11 2009 http://epydoc.sf.net