asv.repo

Exceptions

NoSuchNameError

Exception raised if requested branch or commit does not exist.

Classes

Repo

Base class for repository handlers.

NoRepository

Project installed in the current environment

Functions

get_repo(conf)

Get a Repo subclass for the given configuration.

Module Contents

exception asv.repo.NoSuchNameError[source]

Exception raised if requested branch or commit does not exist.

class asv.repo.Repo(url, mirror_path)[source]

Base class for repository handlers.

There are no commands that modify the source repository.

_default_branch = None[source]
_raise_bad_mirror_error(path)[source]

Internal routine for raising an error message if mirror directory already exists, but appears incorrect.

abstract checkout(path, commit_hash)[source]

Check out a clean working tree from the current repository to the given path

Parameters

pathstr

The local path to check out into

commit_hashstr

The commit hash to check out

classmethod url_match(url)[source]
Abstractmethod:

Returns True if the url is of the right type for this kind of repository.

get_branch_name(branch=None)[source]

Returns the given branch name or the default branch name if branch is None or not specified.

abstract get_range_spec(commit_a, commit_b)[source]

Returns a formatted string giving the results between commit_a (exclusive) and commit_b (inclusive).

abstract get_new_range_spec(latest_result, branch=None)[source]

Returns a formatted string giving the results between the latest result and the newest hash in a given branch. If no branch given, use the ‘main’ branch.

abstract get_date(hash)[source]

Get a JavaScript timestamp for a particular commit.

abstract get_hashes_from_range(range)[source]

Get a list of commit hashes given a range specifier. The syntax of the range specifier will depend on the DVCS used.

abstract get_hash_from_name(name)[source]

Get a hash from a given tag, branch or hash. The acceptable syntax will depend on the DVCS used.

abstract get_hash_from_parent(name)[source]

Checkout the parent of the currently checked out commit.

abstract get_name_from_hash(commit)[source]

Get a symbolic name for a commit, if it exists. The name is resolvable back to the has via get_hash_form_name. If there is no symbolic name, returns None.

get_decorated_hash(commit, hash_length=8)[source]

Return commit hash with possible branch/tag information added, for displaying to the user.

abstract get_tags()[source]

Get a dict of all of the tags defined in the repo and their corresponding commit hash

abstract get_date_from_name(name)[source]

Get a JavaScript timestamp for a particular name.

abstract get_branch_commits(branch)[source]

Returns the ordered list (last commit first) of all commits in branch following first parent in case of merge

get_new_branch_commits(branches, existing)[source]

Return a set of new commits on branches that are successors of all existing commits.

Returns

commit_hashes

New commit hashes

all_commit_hashes

All branch commit hashes

filter_date_period(commits, period, old_commits=None)[source]

Pick a subset of commits such that the dates are spaced at least by period seconds.

If old_commits are given, consider also them in the selection, but omit them from the returned list.

The initial part of the selection remains stable if new commits with newer dates are added.

class asv.repo.NoRepository(url=None, path=None)[source]

Project installed in the current environment

dvcs = 'none'[source]
_default_branch = 'master'[source]
url = None[source]
path = None[source]
_raise_error()[source]
_check_branch(branch)[source]
classmethod url_match(url)[source]

Returns True if the url is of the right type for this kind of repository.

checkout(path, commit_hash)[source]

Check out a clean working tree from the current repository to the given path

Parameters

pathstr

The local path to check out into

commit_hashstr

The commit hash to check out

get_date(hash)[source]

Get a JavaScript timestamp for a particular commit.

get_hashes_from_range(range)[source]

Get a list of commit hashes given a range specifier. The syntax of the range specifier will depend on the DVCS used.

get_hash_from_name(name)[source]

Get a hash from a given tag, branch or hash. The acceptable syntax will depend on the DVCS used.

get_hash_from_parent(name)[source]

Checkout the parent of the currently checked out commit.

get_name_from_hash(commit)[source]

Get a symbolic name for a commit, if it exists. The name is resolvable back to the has via get_hash_form_name. If there is no symbolic name, returns None.

get_tags()[source]

Get a dict of all of the tags defined in the repo and their corresponding commit hash

get_date_from_name(name)[source]

Get a JavaScript timestamp for a particular name.

pull()[source]
get_branch_commits(branch)[source]

Returns the ordered list (last commit first) of all commits in branch following first parent in case of merge

get_new_branch_commits(branches, existing)[source]

Return a set of new commits on branches that are successors of all existing commits.

Returns

commit_hashes

New commit hashes

all_commit_hashes

All branch commit hashes

asv.repo.get_repo(conf)[source]

Get a Repo subclass for the given configuration.

If the configuration does not explicitly specify a repository type, it will attempt to automatically determine one from the conf.repo URL.