Backends

Base Backend

Created on Apr 8, 2010

@author: marcink,lukaszb

class vcs.backends.base.BaseChangeset

Each backend should implement it’s changeset representation.

Attribute :revision: revision number as integer
Attribute :files: list of Node objects with NodeKind.FILE
Attribute :dirs: list of Node objects with NodeKind.DIR
Attribute :nodes: combined list of Node objects
Attribute :author: author of the changeset
Attribute :message: message of the changeset
Attribute :size: integer size in bytes
Attribute :last: True if this is last changeset in repository, False otherwise; ChangesetError is raised if not related with repository object
get_file_changeset(path)

Returns last commit of the file at the given path.

get_file_content(path)

Returns content of the file at the given path.

get_file_history(path)

Returns history of file as reversed list of Changeset objects for which file at given path has been modified.

get_file_message(path)

Returns message of the last commit related to file at the given path.

get_file_size(path)

Returns size of the file at the given path.

get_node(path)

Returns Node object from the given path. If there is no node at the given path, ChangesetError would be raised.

get_nodes(path)

Returns combined DirNode and FileNode objects list representing state of changeset at the given path. If node at the given path is not instance of DirNode, ChangesetError would be raised.

class vcs.backends.base.BaseRepository(repo_path, create=False, **kwargs)

Base Repository for final backends

Attribute :repo object from external api
Attribute :revisions: list of all available revisions’ ids
Attribute :changesets: storage dict caching returned changesets
Attribute :path: absolute local path to the repository
Attribute :branches: branches as list of changesets
Attribute :tags: tags as list of changesets

Initializes repository. Raises RepositoryError if repository could not be find at the given repo_path.

Parameters:
  • repo_path – local path of the repository
  • create=False – if set to True, would try to craete repository if it does not exist rather than raising exception
get_changeset(revision=None)

Returns instance of Changeset class. If revision is None, most recenent changeset is returned.

get_changesets(limit=10, offset=None)

Return last n number of Changeset objects specified by limit attribute if None is given whole list of revisions is returned

@param limit: int limit or None @param offset: int offset

is_valid()

Validates repository.

Implemented Backends

Table Of Contents

Previous topic

Nodes

Next topic

Mercurial Backend

This Page