Jump to >

This documentation covers Review Board 2.5. You can see the latest Review Board documentation or all other versions.

reviewboard.scmtools.models

class Tool(id, name, class_name)[source]

Bases: django.db.models.base.Model

objects = <reviewboard.scmtools.managers.ToolManager object>[source]
supports_raw_file_urls[source]
supports_ticket_auth[source]
supports_pending_changesets[source]
field_help_text[source]
__str__()[source]
get_scmtool_class()[source]
scmtool_class[source]
__unicode__()[source]
repositories[source]
class Repository(id, name, path, mirror_path, raw_file_url, username, encrypted_password, extra_data, tool_id, hosting_account_id, bug_tracker, encoding, visible, archived, archived_timestamp, local_site_id, public, hooks_uuid)[source]

Bases: django.db.models.base.Model

ENCRYPTED_PASSWORD_PREFIX = u’\t’[source]
tool[source]
hosting_account[source]
local_site[source]
users[source]
review_groups[source]
objects = <reviewboard.scmtools.managers.RepositoryManager object>[source]
BRANCHES_CACHE_PERIOD = 300[source]
COMMITS_CACHE_PERIOD_SHORT = 300[source]
COMMITS_CACHE_PERIOD_LONG = 86400[source]
password[source]

Returns the password for the repository.

If a password is stored and encrypted, it will be decrypted and returned.

If the stored password is in plain-text, then it will be encrypted, stored in the database, and returned.

get_scmtool()[source]
hosting_service[source]

Decorator that converts a method with a single self argument into a property cached on the instance.

bug_tracker_service[source]

Decorator that converts a method with a single self argument into a property cached on the instance.

supports_post_commit[source]

Whether or not this repository supports post-commit creation.

If this is True, the get_branches() and get_commits() methods will be implemented to fetch information about the committed revisions, and get_change will be implemented to fetch the actual diff. This is used by ReviewRequestDraft.update_from_commit_id.

get_credentials()[source]

Returns the credentials for this repository.

This returns a dictionary with ‘username’ and ‘password’ keys. By default, these will be the values stored for the repository, but if a hosting service is used and the repository doesn’t have values for one or both of these, the hosting service’s credentials (if available) will be used instead.

get_or_create_hooks_uuid(max_attempts=20)[source]

Returns a hooks UUID, creating one if necessary.

If a hooks UUID isn’t already saved, then this will try to generate one that doesn’t conflict with any other registered hooks UUID. It will try up to max_attempts times, and if it fails, None will be returned.

archive(save=True)[source]

Archives a repository.

The repository won’t appear in any public lists of repositories, and won’t be used when looking up repositories. Review requests can’t be posted against an archived repository.

New repositories can be created with the same information as the archived repository.

get_file(path, revision, base_commit_id=None, request=None)[source]

Returns a file from the repository.

This will attempt to retrieve the file from the repository. If the repository is backed by a hosting service, it will go through that. Otherwise, it will attempt to directly access the repository.

get_file_exists(path, revision, base_commit_id=None, request=None)[source]

Returns whether or not a file exists in the repository.

If the repository is backed by a hosting service, this will go through that. Otherwise, it will attempt to directly access the repository.

The result of this call will be cached, making future lookups of this path and revision on this repository faster.

get_branches()[source]

Returns a list of branches.

get_commit_cache_key(commit)[source]
get_commits(branch=None, start=None)[source]

Returns a list of commits.

This is paginated via the ‘start’ parameter. Any exceptions are expected to be handled by the caller.

get_change(revision)[source]

Get an individual change.

This returns a tuple of (commit message, diff).

is_accessible_by(user)[source]

Returns whether or not the user has access to the repository.

The repository is accessibly by the user if it is public or the user has access to it (either by being explicitly on the allowed users list, or by being a member of a review group on that list).

is_mutable_by(user)[source]

Returns whether or not the user can modify or delete the repository.

The repository is mutable by the user if the user is an administrator with proper permissions or the repository is part of a LocalSite and the user has permissions to modify it.

save(**kwargs)[source]

Saves the repository.

This will perform any data normalization needed, and then save the repository to the database.

__str__()[source]
get_encoding_list()[source]

Returns a list of candidate text encodings for files

clean()[source]

Clean method for checking null unique_together constraints.

Django has a bug where unique_together constraints for foreign keys aren’t checked properly if one of the relations is null. This means that users who aren’t using local sites could create multiple groups with the same name.

__unicode__()[source]
defaultreviewer_set[source]
diffsets[source]
file_attachments[source]
get_extra_data_json(model_instance)[source]
review_requests[source]
set_extra_data_json(model_instance, json)[source]
webhooks[source]