repo methods

add_field_to_repo

add_field_to_repo(apiuser, repoid, key, label=<Optional:''>, description=<Optional:''>)

Adds an extra field to a repository.

This command can only be run using an Authentication Token with at least write permissions to the repository.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set the repository name or repository id.
  • key (str) – Create a unique field key for this repository.
  • label (Optional(str)) –
  • description (Optional(str)) –

comment_commit

comment_commit(apiuser, repoid, commit_id, message, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, extra_recipients=<Optional:[]>, userid=<Optional:<OptionalAttr:apiuser>>, send_email=<Optional:True>)

Set a commit comment, and optionally change the status of the commit.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set the repository name or repository ID.
  • commit_id (str) – Specify the commit_id for which to set a comment.
  • message (str) – The comment text.
  • status (str) – (Optional) status of commit, one of: ‘not_reviewed’, ‘approved’, ‘rejected’, ‘under_review’
  • comment_type (Optional(str), default: 'note') – Comment type, one of: ‘note’, ‘todo’
  • resolves_comment_id (Optional(int)) – id of comment which this one will resolve
  • extra_recipients (Optional(list)) – list of user ids or usernames to add notifications for this comment. Acts like a CC for notification
  • userid (Optional(str or int)) – Set the user name of the comment creator.
  • send_email (Optional(bool)) – Define if this comment should also send email notification

Example error output:

{
    "id" : <id_given_in_input>,
    "result" : {
        "msg": "Commented on commit `<commit_id>` for repository `<repoid>`",
        "status_change": null or <status>,
        "success": true
    },
    "error" :  null
}

create_repo

create_repo(apiuser, repo_name, repo_type, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, copy_permissions=<Optional:False>)

Creates a repository.

  • If the repository name contains “/”, repository will be created inside a repository group or nested repository groups

    For example “foo/bar/repo1” will create repository called “repo1” inside group “foo/bar”. You have to have permissions to access and write to the last repository group (“bar” in this example)

This command can only be run using an Authentication Token with at least permissions to create repositories, or write permissions to parent repository groups.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repo_name (str) – Set the repository name.
  • repo_type (str) – Set the repository type; ‘hg’,’git’, or ‘svn’.
  • owner (Optional(str)) – user_id or username
  • description (Optional(str)) – Set the repository description.
  • private (bool) – set repository as private
  • clone_uri (str) – set clone_uri
  • push_uri (str) – set push_uri
  • landing_rev (str) – <rev_type>:<rev>, e.g branch:default, book:dev, rev:abcd
  • enable_locking (bool) –
  • enable_downloads (bool) –
  • enable_statistics (bool) –
  • copy_permissions (bool) – Copy permission from group in which the repository is being created.

Example output:

id : <id_given_in_input>
result: {
          "msg": "Created new repository `<reponame>`",
          "success": true,
          "task": "<celery task id or None if done sync>"
        }
error:  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
   'failed to create repository `<repo_name>`'
}

delete_repo

delete_repo(apiuser, repoid, forks=<Optional:''>)

Deletes a repository.

  • When the forks parameter is set it’s possible to detach or delete forks of deleted repository.

This command can only be run using an Authentication Token with admin permissions on the repository.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set the repository name or repository ID.
  • forks (Optional(str)) – Set to detach or delete forks from the repository.

Example error output:

id : <id_given_in_input>
result: {
          "msg": "Deleted repository `<reponame>`",
          "success": true
        }
error:  null

edit_comment

edit_comment(apiuser, message, comment_id, version, userid=<Optional:<OptionalAttr:apiuser>>)

Edit comment on the pull request or commit, specified by the comment_id and version. Initially version should be 0

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • comment_id (int) – Specify the comment_id for editing
  • version (int) – version of the comment that will be created, starts from 0
  • message (str) – The text content of the comment.
  • userid (Optional(str or int)) – Comment on the pull request as this user

Example output:

id : <id_given_in_input>
result : {
    "comment": "<comment data>",
    "version": "<Integer>",
},
error :  null

fork_repo

fork_repo(apiuser, repoid, fork_name, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, landing_rev=<Optional:None>, copy_permissions=<Optional:False>)

Creates a fork of the specified repository.

  • If the fork_name contains “/”, fork will be created inside a repository group or nested repository groups

    For example “foo/bar/fork-repo” will create fork called “fork-repo” inside group “foo/bar”. You have to have permissions to access and write to the last repository group (“bar” in this example)

This command can only be run using an Authentication Token with minimum read permissions of the forked repo, create fork permissions for an user.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set repository name or repository ID.
  • fork_name (str) – Set the fork name, including it’s repository group membership.
  • owner (str) – Set the fork owner.
  • description (str) – Set the fork description.
  • copy_permissions (bool) – Copy permissions from parent repository. The default is False.
  • private (bool) – Make the fork private. The default is False.
  • landing_rev – Set the landing revision. E.g branch:default, book:dev, rev:abcd

Example output:

id : <id_for_response>
api_key : "<api_key>"
args:     {
            "repoid" :          "<reponame or repo_id>",
            "fork_name":        "<forkname>",
            "owner":            "<username or user_id = Optional(=apiuser)>",
            "description":      "<description>",
            "copy_permissions": "<bool>",
            "private":          "<bool>",
            "landing_rev":      "<landing_rev>"
          }

Example error output:

id : <id_given_in_input>
result: {
          "msg": "Created fork of `<reponame>` as `<forkname>`",
          "success": true,
          "task": "<celery task id or None if done sync>"
        }
error:  null

get_comment

get_comment(apiuser, comment_id)

Get single comment from repository or pull_request

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • comment_id (str or int) – comment id found in the URL of comment

Example error output:

{
    "id" : <id_given_in_input>,
    "result" : {
          "comment_author": <USER_DETAILS>,
          "comment_created_on": "2017-02-01T14:38:16.309",
          "comment_f_path": "file.txt",
          "comment_id": 282,
          "comment_lineno": "n1",
          "comment_resolved_by": null,
          "comment_status": [],
          "comment_text": "This file needs a header",
          "comment_type": "todo",
          "comment_last_version: 0
    },
    "error" :  null
}

get_repo

get_repo(apiuser, repoid, cache=<Optional:True>)

Gets an existing repository by its name or repository_id.

The members section so the output returns users groups or users associated with that repository.

This command can only be run using an Authentication Token with admin rights, or users with at least read rights to the repository.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository id.
  • cache – use the cached value for last changeset
Type:

cache: Optional(bool)

Example output:

{
  "error": null,
  "id": <repo_id>,
  "result": {
    "clone_uri": null,
    "created_on": "timestamp",
    "description": "repo description",
    "enable_downloads": false,
    "enable_locking": false,
    "enable_statistics": false,
    "followers": [
      {
        "active": true,
        "admin": false,
        "api_key": "****************************************",
        "api_keys": [
          "****************************************"
        ],
        "email": "user@example.com",
        "emails": [
          "user@example.com"
        ],
        "extern_name": "rhodecode",
        "extern_type": "rhodecode",
        "firstname": "username",
        "ip_addresses": [],
        "language": null,
        "last_login": "2015-09-16T17:16:35.854",
        "lastname": "surname",
        "user_id": <user_id>,
        "username": "name"
      }
    ],
    "fork_of": "parent-repo",
    "landing_rev": [
      "rev",
      "tip"
    ],
    "last_changeset": {
      "author": "User <user@example.com>",
      "branch": "default",
      "date": "timestamp",
      "message": "last commit message",
      "parents": [
        {
          "raw_id": "commit-id"
        }
      ],
      "raw_id": "commit-id",
      "revision": <revision number>,
      "short_id": "short id"
    },
    "lock_reason": null,
    "locked_by": null,
    "locked_date": null,
    "owner": "owner-name",
    "permissions": [
      {
        "name": "super-admin-name",
        "origin": "super-admin",
        "permission": "repository.admin",
        "type": "user"
      },
      {
        "name": "owner-name",
        "origin": "owner",
        "permission": "repository.admin",
        "type": "user"
      },
      {
        "name": "user-group-name",
        "origin": "permission",
        "permission": "repository.write",
        "type": "user_group"
      }
    ],
    "private": true,
    "repo_id": 676,
    "repo_name": "user-group/repo-name",
    "repo_type": "hg"
  }
}

get_repo_changeset

get_repo_changeset(apiuser, repoid, revision, details=<Optional:'basic'>)

Returns information about a changeset.

Additionally parameters define the amount of details returned by this function.

This command can only be run using an Authentication Token with admin rights, or users with at least read rights to the repository.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository id
  • revision (str) – revision for which listing should be done
  • details (Optional(str)) – details can be ‘basic|extended|full’ full gives diff info details like the diff itself, and number of changed files etc.

get_repo_changesets

get_repo_changesets(apiuser, repoid, start_rev, limit, details=<Optional:'basic'>)

Returns a set of commits limited by the number starting from the start_rev option.

Additional parameters define the amount of details returned by this function.

This command can only be run using an Authentication Token with admin rights, or users with at least read rights to repositories.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository ID.
  • start_rev (str) – The starting revision from where to get changesets.
  • limit (str or int) – Limit the number of commits to this amount
  • details (Optional(str)) – Set the level of detail returned. Valid option are: basic, extended and full.

Note

Setting the parameter details to the value full is extensive and returns details like the diff itself, and the number of changed files.

get_repo_comments

get_repo_comments(apiuser, repoid, commit_id=<Optional:None>, comment_type=<Optional:None>, userid=<Optional:None>)

Get all comments for a repository

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set the repository name or repository ID.
  • commit_id (Optional(str), default: None) – Optionally filter the comments by the commit_id
  • comment_type (Optional(str), default: None) – Optionally filter the comments by the comment_type one of: ‘note’, ‘todo’
  • userid (Optional(str or int), Default: None) – Optionally filter the comments by the author of comment

Example error output:

{
    "id" : <id_given_in_input>,
    "result" : [
        {
          "comment_author": <USER_DETAILS>,
          "comment_created_on": "2017-02-01T14:38:16.309",
          "comment_f_path": "file.txt",
          "comment_id": 282,
          "comment_lineno": "n1",
          "comment_resolved_by": null,
          "comment_status": [],
          "comment_text": "This file needs a header",
          "comment_type": "todo",
          "comment_last_version: 0
        }
    ],
    "error" :  null
}

get_repo_file

get_repo_file(apiuser, repoid, commit_id, file_path, max_file_bytes=<Optional:None>, details=<Optional:'basic'>, cache=<Optional:True>)

Returns a single file from repository at given revision.

This command can only be run using an Authentication Token with admin rights, or users with at least read rights to repositories.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository ID.
  • commit_id (str) – The revision for which listing should be done.
  • file_path (str) – The path from which to start displaying.
  • details (Optional(str)) – Returns different set of information about nodes. The valid options are minimal basic and full.
  • max_file_bytes (Optional(int)) – Only return file content under this file size bytes
  • cache (Optional(bool)) – Use internal caches for fetching files. If disabled fetching files is slower but more memory efficient

Example output:

id : <id_given_in_input>
result: {
    "binary": false,
    "extension": "py",
    "lines": 35,
    "content": "....",
    "md5": "76318336366b0f17ee249e11b0c99c41",
    "mimetype": "text/x-python",
    "name": "python.py",
    "size": 817,
    "type": "file",
}
error:  null

get_repo_fts_tree

get_repo_fts_tree(apiuser, repoid, commit_id, root_path)

Returns a list of tree nodes for path at given revision. This api is built strictly for usage in full text search building, and shouldn’t be consumed

This command can only be run using an Authentication Token with admin rights, or users with at least read rights to repositories.

get_repo_nodes

get_repo_nodes(apiuser, repoid, revision, root_path, ret_type=<Optional:'all'>, details=<Optional:'basic'>, max_file_bytes=<Optional:None>)

Returns a list of nodes and children in a flat list for a given path at given revision.

It’s possible to specify ret_type to show only files or dirs.

This command can only be run using an Authentication Token with admin rights, or users with at least read rights to repositories.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository ID.
  • revision (str) – The revision for which listing should be done.
  • root_path (str) – The path from which to start displaying.
  • ret_type (Optional(str)) – Set the return type. Valid options are all (default), files and dirs.
  • details (Optional(int)) – Returns extended information about nodes, such as md5, binary, and or content. The valid options are basic and full.
  • max_file_bytes – Only return file content under this file size bytes

Example output:

id : <id_given_in_input>
result: [
            {
              "binary": false,
              "content": "File line",
              "extension": "md",
              "lines": 2,
              "md5": "059fa5d29b19c0657e384749480f6422",
              "mimetype": "text/x-minidsrc",
              "name": "file.md",
              "size": 580,
              "type": "file"
            },
          ...
        ]
error:  null

get_repo_refs

get_repo_refs(apiuser, repoid)

Returns a dictionary of current references. It returns bookmarks, branches, closed_branches, and tags for given repository

It’s possible to specify ret_type to show only files or dirs.

This command can only be run using an Authentication Token with admin rights, or users with at least read rights to repositories.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository ID.

Example output:

id : <id_given_in_input>
"result": {
    "bookmarks": {
      "dev": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
      "master": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
    },
    "branches": {
      "default": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
      "stable": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
    },
    "branches_closed": {},
    "tags": {
      "tip": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
      "v4.4.0": "1232313f9e6adac5ce5399c2a891dc1e72b79022",
      "v4.4.1": "cbb9f1d329ae5768379cdec55a62ebdd546c4e27",
      "v4.4.2": "24ffe44a27fcd1c5b6936144e176b9f6dd2f3a17",
    }
}
error:  null

get_repo_settings

get_repo_settings(apiuser, repoid, key=<Optional:None>)

Returns all settings for a repository. If key is given it only returns the setting identified by the key or null.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository id.
  • key – Key of the setting to return.
Type:

key: Optional(str)

Example output:

{
    "error": null,
    "id": 237,
    "result": {
        "extensions_largefiles": true,
        "extensions_evolve": true,
        "hooks_changegroup_push_logger": true,
        "hooks_changegroup_repo_size": false,
        "hooks_outgoing_pull_logger": true,
        "phases_publish": "True",
        "rhodecode_hg_use_rebase_for_merging": true,
        "rhodecode_pr_merge_enabled": true,
        "rhodecode_use_outdated_comments": true
    }
}

get_repos

get_repos(apiuser, root=<Optional:None>, traverse=<Optional:True>)

Lists all existing repositories.

This command can only be run using an Authentication Token with admin rights, or users with at least read rights to repositories.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • root (Optional(None)) – specify root repository group to fetch repositories. filters the returned repositories to be members of given root group.
  • traverse (Optional(True)) – traverse given root into subrepositories. With this flag set to False, it will only return top-level repositories from root. if root is empty it will return just top-level repositories.

Example output:

id : <id_given_in_input>
result: [
          {
            "repo_id" :          "<repo_id>",
            "repo_name" :        "<reponame>"
            "repo_type" :        "<repo_type>",
            "clone_uri" :        "<clone_uri>",
            "private": :         "<bool>",
            "created_on" :       "<datetimecreated>",
            "description" :      "<description>",
            "landing_rev":       "<landing_rev>",
            "owner":             "<repo_owner>",
            "fork_of":           "<name_of_fork_parent>",
            "enable_downloads":  "<bool>",
            "enable_locking":    "<bool>",
            "enable_statistics": "<bool>",
          },
          ...
        ]
error:  null

grant_user_group_permission

grant_user_group_permission(apiuser, repoid, usergroupid, perm)

Grant permission for a user group on the specified repository, or update existing permissions.

This command can only be run using an Authentication Token with admin permissions on the repository.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set the repository name or repository ID.
  • usergroupid (str or int) – Specify the ID of the user group.
  • perm (str) – Set the user group permissions using the following format: (repository.(none|read|write|admin))

Example output:

id : <id_given_in_input>
result : {
  "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
  "success": true

}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "failed to edit permission for user group: `<usergroup>` in repo `<repo>`'
}

grant_user_permission

grant_user_permission(apiuser, repoid, userid, perm)

Grant permissions for the specified user on the given repository, or update existing permissions if found.

This command can only be run using an Authentication Token with admin permissions on the repository.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set the repository name or repository ID.
  • userid (str) – Set the user name.
  • perm (str) – Set the user permissions, using the following format (repository.(none|read|write|admin))

Example output:

id : <id_given_in_input>
result: {
          "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
          "success": true
        }
error:  null

invalidate_cache

invalidate_cache(apiuser, repoid, delete_keys=<Optional:False>)

Invalidates the cache for the specified repository.

This command can only be run using an Authentication Token with admin rights to the specified repository.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from Authentication Token.
  • repoid (str or int) – Sets the repository name or repository ID.
  • delete_keys (Optional(True | False)) – This deletes the invalidated keys instead of just flagging them.

Example output:

id : <id_given_in_input>
result : {
  'msg': Cache for repository `<repository name>` was invalidated,
  'repository': <repository name>
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error : {
   'Error occurred during cache invalidation action'
}

lock

lock(apiuser, repoid, locked=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)

Sets the lock state of the specified repository by the given user. From more information, see Repository Locking.

  • If the userid option is not set, the repository is locked to the user who called the method.
  • If the locked parameter is not set, the current lock state of the repository is displayed.

This command can only be run using an Authentication Token with admin rights to the specified repository.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Sets the repository name or repository ID.
  • locked (Optional(True | False)) – Sets the lock state.
  • userid (Optional(str or int)) – Set the repository lock to this user.

Example error output:

id : <id_given_in_input>
result : {
  'repo': '<reponame>',
  'locked': <bool: lock state>,
  'locked_since': <int: lock timestamp>,
  'locked_by': <username of person who made the lock>,
  'lock_reason': <str: reason for locking>,
  'lock_state_changed': <bool: True if lock state has been changed in this request>,
  'msg': 'Repo `<reponame>` locked by `<username>` on <timestamp>.'
  or
  'msg': 'Repo `<repository name>` not locked.'
  or
  'msg': 'User `<user name>` set lock state for repo `<repository name>` to `<new lock state>`'
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  'Error occurred locking repository `<reponame>`'
}

maintenance

maintenance(apiuser, repoid)

Triggers a maintenance on the given repository.

This command can only be run using an Authentication Token with admin rights to the specified repository. For more information, see Authentication Tokens.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository ID.

Example output:

id : <id_given_in_input>
result : {
  "msg": "executed maintenance command",
  "executed_actions": [
     <action_message>, <action_message2>...
  ],
  "repository": "<repository name>"
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "Unable to execute maintenance on `<reponame>`"
}

pull

pull(apiuser, repoid, remote_uri=<Optional:None>)

Triggers a pull on the given repository from a remote location. You can use this to keep remote repositories up-to-date.

This command can only be run using an Authentication Token with admin rights to the specified repository. For more information, see Authentication Tokens.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository ID.
  • remote_uri (str) – Optional remote URI to pass in for pull

Example output:

id : <id_given_in_input>
result : {
  "msg": "Pulled from url `<remote_url>` on repo `<repository name>`"
  "repository": "<repository name>"
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "Unable to push changes from `<remote_url>`"
}

remove_field_from_repo

remove_field_from_repo(apiuser, repoid, key)

Removes an extra field from a repository.

This command can only be run using an Authentication Token with at least write permissions to the repository.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set the repository name or repository ID.
  • key (str) – Set the unique field key for this repository.

revoke_user_group_permission

revoke_user_group_permission(apiuser, repoid, usergroupid)

Revoke the permissions of a user group on a given repository.

This command can only be run using an Authentication Token with admin permissions on the repository.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set the repository name or repository ID.
  • usergroupid (str or int) – Specify the user group ID.

Example output:

id : <id_given_in_input>
result: {
          "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
          "success": true
        }
error:  null

revoke_user_permission

revoke_user_permission(apiuser, repoid, userid)

Revoke permission for a user on the specified repository.

This command can only be run using an Authentication Token with admin permissions on the repository.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – Set the repository name or repository ID.
  • userid (str or int) – Set the user name of revoked user.

Example error output:

id : <id_given_in_input>
result: {
          "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
          "success": true
        }
error:  null

set_repo_settings

set_repo_settings(apiuser, repoid, settings)

Update repository settings. Returns true on success.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository id.
  • settings – The new settings for the repository.
Type:

settings: dict

Example output:

{
    "error": null,
    "id": 237,
    "result": true
}

strip

strip(apiuser, repoid, revision, branch)

Strips the given revision from the specified repository.

  • This will remove the revision and all of its decendants.

This command can only be run using an Authentication Token with admin rights to the specified repository.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – The repository name or repository ID.
  • revision (str) – The revision you wish to strip.
  • branch (str) – The branch from which to strip the revision.

Example output:

id : <id_given_in_input>
result : {
  "msg": "'Stripped commit <commit_hash> from repo `<repository name>`'"
  "repository": "<repository name>"
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "Unable to strip commit <commit_hash> from repo `<repository name>`"
}

update_repo

update_repo(apiuser, repoid, repo_name=<Optional:None>, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:None>, fork_of=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, fields=<Optional:''>)

Updates a repository with the given information.

This command can only be run using an Authentication Token with at least admin permissions to the repository.

  • If the repository name contains “/”, repository will be updated accordingly with a repository group or nested repository groups

    For example repoid=repo-test name=”foo/bar/repo-test” will update repository called “repo-test” and place it inside group “foo/bar”. You have to have permissions to access and write to the last repository group (“bar” in this example)

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • repoid (str or int) – repository name or repository ID.
  • repo_name (str) – Update the repository name, including the repository group it’s in.
  • owner (str) – Set the repository owner.
  • fork_of (str) – Set the repository as fork of another repository.
  • description (str) – Update the repository description.
  • private (bool) – Set the repository as private. (True | False)
  • clone_uri (str) – Update the repository clone URI.
  • landing_rev (str) – Set the repository landing revision. e.g branch:default, book:dev, rev:abcd
  • enable_statistics (bool) – Enable statistics on the repository, (True | False).
  • enable_locking (bool) – Enable repository locking.
  • enable_downloads (bool) – Enable downloads from the repository, (True | False).
  • fields (str) – Add extra fields to the repository. Use the following example format: field_key=field_val,field_key2=fieldval2. Escape ‘, ‘ with ,