Package trac :: Package versioncontrol :: Module api :: Class Node

Class Node

source code

object --+
         |
        Node
Known Subclasses:

Represents a directory or file in the repository at a given revision.
Instance Methods
 
__init__(self, repos, path, rev, kind)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
can_view(self, perm)
Return True if view permission is granted on the node.
source code
 
get_annotations(self)
Provide detailed backward history for the content of this Node.
source code
 
get_content(self)
Return a stream for reading the content of the node.
source code
 
get_content_length(self)
The length in bytes of the content.
source code
 
get_content_type(self)
The MIME type corresponding to the content, if known.
source code
 
get_entries(self)
Generator that yields the immediate child entries of a directory.
source code
 
get_history(self, limit=None)
Provide backward history for this Node.
source code
 
get_last_modified(self) source code
 
get_name(self) source code
 
get_previous(self)
Return the change event corresponding to the previous revision.
source code
 
get_processed_content(self, keyword_substitution=True, eol_hint=None)
Return a stream for reading the content of the node, with some standard processing applied.
source code
 
get_properties(self)
Returns the properties (meta-data) of the node, as a dictionary.
source code
 
is_viewable(self, perm)
Return True if view permission is granted on the node.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  DIRECTORY = 'dir'
  FILE = 'file'
  created_path = None
hash(x)
  created_rev = None
hash(x)
Properties
  content_length
  content_type
  isdir
  isfile
  last_modified
  name
  resource

Inherited from object: __class__

Method Details

__init__(self, repos, path, rev, kind)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

get_annotations(self)

source code 

Provide detailed backward history for the content of this Node.

Retrieve an array of revisions, one rev for each line of content for that node. Only expected to work on (text) FILE nodes, of course.

get_content(self)

source code 

Return a stream for reading the content of the node.

This method will return None for directories. The returned object must support a read([len]) method.

get_content_length(self)

source code 

The length in bytes of the content.

Will be None for a directory.

get_content_type(self)

source code 

The MIME type corresponding to the content, if known.

Will be None for a directory.

get_entries(self)

source code 

Generator that yields the immediate child entries of a directory.

The entries are returned in no particular order. If the node is a file, this method returns None.

get_history(self, limit=None)

source code 

Provide backward history for this Node.

Generator that yields (path, rev, chg) tuples, one for each revision in which the node was changed. This generator will follow copies and moves of a node (if the underlying version control system supports that), which will be indicated by the first element of the tuple (i.e. the path) changing. Starts with an entry for the current revision.

Parameters:
  • limit - if given, yield at most limit results.

get_previous(self)

source code 

Return the change event corresponding to the previous revision.

This returns a (path, rev, chg) tuple.

get_processed_content(self, keyword_substitution=True, eol_hint=None)

source code 
Return a stream for reading the content of the node, with some standard processing applied.
Parameters:
  • keyword_substitution - if True, meta-data keywords present in the content like $Rev$ are substituted (which keyword are substituted and how they are substituted is backend specific)
  • eol_hint - which style of line ending is expected if None was explicitly specified for the file itself in the version control backend (for example in Subversion, if it was set to 'native'). It can be None, 'LF', 'CR' or 'CRLF'.

get_properties(self)

source code 

Returns the properties (meta-data) of the node, as a dictionary.

The set of properties depends on the version control system.


Property Details

content_length

Get Method:
unreachable(self)

content_type

Get Method:
unreachable(self)

isdir

Get Method:
unreachable(self)

isfile

Get Method:
unreachable(self)

last_modified

Get Method:
unreachable(self)

name

Get Method:
unreachable(self)

resource

Get Method:
unreachable(self)