API

stashy.connect(url, username, password, verify=True)[source]

Connect to a Stash instance given a username and password.

This is only recommended via SSL. If you need are using self-signed certificates, you can use verify=False to ignore SSL verifcation.

class stashy.admin.users.Users(url, client, parent, api_path=None, branches_api_path=None)[source]
add(name, password, displayName, emailAddress, addToDefaultGroup=True)[source]

Add a user, returns a dictionary containing information about the newly created user

add_group(user, group)[source]

Add the given user to the given user.

credentials(name, new_password)[source]

Update a user’s password.

delete(user)[source]

Delete a user.

more_members(user, filter=None)[source]

Retrieves a list of groups the specified user is a member of.

filter: if specified only groups with names containing the supplied string will be returned

more_non_members(user, filter=None)[source]

Retrieves a list of groups that the specified user is not a member of

filter: if specified only groups with names containing the supplied string will be returned

remove_group(user, group)[source]

Remove the given user from the given group.

update(name, displayName=None, emailAddress=None)[source]

Update the user information, and return the updated user info.

None is used as a sentinel value, use empty string if you mean to clear.

class stashy.admin.groups.Groups(url, client, parent, api_path=None, branches_api_path=None)[source]
add(group)[source]

Add a group, returns a dictionary containing the group name

add_user(group, user)[source]

Add a user to a group.

delete(group)[source]

Delete a group.

more_members(group, filter=None)[source]

Retrieves a list of users that are members of a specified group.

filter: return only users with usernames, display names or email addresses containing this string

more_non_members(group, filter=None)[source]

Retrieves a list of users that are not members of a specified group.

filter: return only users with usernames, display names or email addresses containing this string

remove_user(group, user)[source]

Remove a user to a group.

class stashy.permissions.Users(url, client, parent, api_path=None, branches_api_path=None)[source]
grant(user, permission)[source]

Promote or demote the permission level of a user.

Depending on context, you may use one of the following set of permissions:

global permissions:

  • LICENSED_USER
  • PROJECT_CREATE
  • ADMIN
  • SYS_ADMIN
project permissions:
  • PROJECT_READ
  • PROJECT_WRITE
  • PROJECT_ADMIN
repository permissions:
  • REPO_READ
  • REPO_WRITE
  • REPO_ADMIN
none(filter=None)[source]

Retrieve users that have no granted permissions.

filter: if specified only user names containing the supplied string will be returned

revoke(user)[source]

Revoke all permissions for a user.

class stashy.permissions.Groups(url, client, parent, api_path=None, branches_api_path=None)[source]
grant(group, permission)[source]

Promote or demote a user’s permission level.

Depending on context, you may use one of the following set of permissions:

global permissions:

  • LICENSED_USER
  • PROJECT_CREATE
  • ADMIN
  • SYS_ADMIN
project permissions:
  • PROJECT_READ
  • PROJECT_WRITE
  • PROJECT_ADMIN
none(filter=None)[source]

Retrieve groups that have no granted permissions.

filter: return only group names containing the supplied string will be returned

revoke(group)[source]

Revoke all permissions for a group.

class stashy.projects.Projects(url, client, parent, api_path=None, branches_api_path=None)[source]
create(key, name, description='', avatar=None)[source]

Create a project. If supplied, avatar should be a base64 encoded image.

get(project)[source]

Retrieve the project matching the supplied key.

class stashy.projects.Project(key, url, client, parent)[source]
delete()[source]

Delete the project

update(new_key=None, name=None, description=None, avatar=None, public=None)[source]

Update project information. If supplied, avatar should be a base64 encoded image.

None is used as a sentinel so use ‘’ to clear a value.

class stashy.repos.Repos(url, client, parent, api_path=None, branches_api_path=None)[source]
create(name, scmId='git', forkable=True)[source]

Create a repository with the given name

class stashy.repos.Repository(slug, url, client, parent)[source]
branches(filterText=None, orderBy=None, details=None)[source]

Retrieve the branches matching the supplied filterText param.

browse(path='', at=None, type=False, blame='', noContent='')[source]

Retrieve a page of content for a file path at a specified revision.

changes(until, since=None)[source]

Retrieve a page of changes made in a specified commit.

since: the changeset to which until should be compared to produce a page of changes.
If not specified the parent of the until changeset is used.

until: the changeset to retrieve file changes for.

commits(until, since=None, path=None)[source]

Retrieve a page of changesets from a given starting commit or between two commits. The commits may be identified by hash, branch or tag name.

since: the changeset id or ref (exclusively) to restrieve changesets after until: the changeset id or ref (inclusively) to retrieve changesets before. path: an optional path to filter changesets by.

Support for withCounts is not implement.

default_branch

Get or set the default branch

delete()[source]

Schedule the repository to be deleted

files(path='', at=None)[source]

Retrieve a page of files from particular directory of a repository. The search is done recursively, so all files from any sub-directory of the specified directory will be returned.

fork(name=None, project=None)[source]

Fork the repository.

name - Specifies the forked repository’s name
Defaults to the name of the origin repository if not specified
project - Specifies the forked repository’s target project by key
Defaults to the current user’s personal project if not specified
forks()[source]

Retrieve repositories which have been forked from this one.

get()[source]

Retrieve the repository

get_all_branches(items)[source]

Return list of all branches in this project and the repository :param items: limit parameter (max items in result) :return:

get_commit(commit)[source]

Returns detailed information about a given commit :param commit: like “1c972ea39318a4b3ce99bc51ab03277138c586ea” :return:

tags(filterText=None, orderBy=None)[source]

Retrieve the tags matching the supplied filterText param.

update(name)[source]

Update the name of a repository.

The repository’s slug is derived from its name. If the name changes the slug may also change.