Mercurial Backend

Created on Apr 8, 2010

author:marcink,lukaszb

MercurialRepository

class vcs.backends.hg.MercurialRepository(repo_path, create=False, baseui=None, clone_url=None)

Mercurial repository backend

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
  • baseui=None – user data
  • clone_url=None – would try to clone repository from given location
get_changeset(revision=None)

Returns MercurialChangeset object representing repository’s changeset at the given revision.

get_changesets(limit=10, offset=None)

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

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

pull(url)

Tries to pull changes from external location.

MercurialChangeset

class vcs.backends.hg.MercurialChangeset(repository, revision)

Bases: vcs.backends.base.BaseChangeset

Represents state of the repository at the single revision.

id

Returns shorter version of mercurial’s changeset hexes.

raw_id

Returns raw string identifing this changeset (40-length hex)

short_id

Returns shortened version of raw_id (first 12 characters)

parents

Returns list of parents changesets.

added

Returns list of added FileNode objects.

changed

Returns list of changed FileNode objects.

removed

Returns list of removed RemovedFileNode objects.

Note

Remember that those RemovedFileNode instances are only dummy FileNode objects and trying to access most of it’s attributes or methods would raise NodeError exception.

get_file_annotate(path)

Returns a list of three element tuples with lineno,changeset and line

get_file_changeset(path)

Returns last commit of the file at the given path.

get_file_content(path)

Returns content of the file at 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_revision(path)

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

get_file_size(path)

Returns size of the file at 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.

walk(topurl='')

Similar to os.walk method. Insted of filesystem it walks through changeset starting at given topurl. Returns list of tuples (topnode, dirnodes, filenodes).

Table Of Contents

Previous topic

Backends

Next topic

Utils

This Page