Beanstalk

Changeset Resource

Readable attributes

id integer Unique ID.
account_id integer ID of the associated Account.
repository_id integer ID of the Repository to which commit was made.
user_id integer ID of the User who made the commit (may be nil).
revision integer Subversion only. Revision number.
hash_id string Git only. Unique commit hash.
author string Committer’s name (may be nil).
email string Committer’s email (may be nil).
message string Commit message.
changed_files string Array of changed files. Serialized YAML.
changed_dirs string Array of changed directories. Serialized YAML.
changed_properties string Subversion only. Array of changed SVN properties. Serialized YAML.
time datetime Date and time of commit.
too_large boolean

This flag determins if commit was too large to be processed by the system.

Usually that means that information like changed_files is missing or incomplete.

Requirements

ActiveResource version 2.3 will not work with this model since it doesn’t support loading of nested arrays. We created a patch for ActiveResource to fix this, but we are not sure when it will be approved and committed. For now you can use the Ruby libraries provided by Beanstalk which includes this patch.

Find All Changesets

This method will return changesets from all repositories available to the currently logged in user.

Optional GET parameters:

  • page (integer) — page number for pagination.
  • per_page (integer) — number of elements per page (default 15, maximum 30);
  • order_field (string) — what column to use for ordering (default is time);
  • order (string) — order direction. Should be either ASC or DESC (default is DESC).
json http-request
GET /api/changesets.json

Click to expand…

json http-response
[{
  "revision_cache": {
    "hash_id": "7ada704eac04075f763f36190716e43381fc6e1d",
    "changed_files": [["bla","edit"]],
    "author": "John Doe",
    "time": "2011/09/12 13:24:05 +0800",
    "account_id": 2,
    "user_id": 2,
    "changed_dirs": [],
    "revision": "7ada704e",
    "too_large": false,
    "repository_id": 3,
    "message": "bla",
    "email": "ilya.sabanin@example.com",
    "changed_properties": null
  }
},
{
  "revision_cache": {
    "hash_id": "08a85e76ba28f74a46528ecf9db4a3e033c72803",
    "changed_files": [["FILE","add"]],
    "author": "John Doe",
    "time": "2011/09/12 13:20:59 +0800",
    "account_id": 2,
    "user_id": 2,
    "changed_dirs": [],
    "revision": "08a85e76",
    "too_large": false,
    "repository_id": 3,
    "message": "File",
    "email": "ilya.sabanin@example.com",
    "changed_properties": null
  }
}]
xml http-request
GET /api/changesets.xml

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<revision-caches type="array">
  <revision-cache>
    <account-id type="integer">46245</account-id>
    <repository-id type="integer">14327</repository-id>
    <revision type="integer">1</revision>
    <message>Creating initial repository structure</message>
    <author>gilbert</author>
    <email>gilbert@example.com</email>
    <changed-dirs type="yaml">--- 
    - - branches/
      - :add
    - - tags/
      - :add
    - - trunk/
      - :add
    </changed-dirs>
    <changed-files type="yaml">--- []</changed-files>
    <changed-properties nil="true"></changed-properties>
    <too-large type="boolean" nil="true"></too-large>
    <time type="datetime">2009-11-18T12:49:34Z</time>    
  </revision-cache>

  <revision-cache>
    <account-id type="integer">46245</account-id>
    <repository-id type="integer">87654</repository-id>
    <revision type="integer">253</revision>
    <message>Added nothing</message>
    <author>evil-gilbert</author>
    <email>evil-gilbert@example.com</email>
    <user_id>34087</user_id>
    <changed-dirs type="yaml">--- []</changed-dirs>
    <changed-files type="yaml">--- []</changed-files>
    <changed-properties nil="true"></changed-properties>
    <too-large type="boolean" nil="true"></too-large>
    <time type="datetime">2009-11-18T13:23:32Z</time>    
  </revision-cache>
</revision-caches>

Find All Changesets for Repository

Optional GET parameters:

  • page (integer) — page number for pagination;
  • per_page (integer) — number of elements per page (default 15, maximum 30);
  • order_field (string) — what column to use for ordering (default is time);
  • order (string) — order direction. Should be either ASC or DESC (default is DESC).
json http-request
GET /api/changesets/repository.json?repository_id={REPOSITORY_ID}

Click to expand…

json http-response
[{
  "revision_cache": {
    "hash_id": "7ada704eac04075f763f36190716e43381fc6e1d",
    "changed_files": [["bla","edit"]],
    "author": "John Doe",
    "time": "2011/09/12 13:24:05 +0800",
    "account_id": 2,
    "user_id": 2,
    "changed_dirs": [],
    "revision": "7ada704e",
    "too_large": false,
    "repository_id": 3,
    "message": "bla",
    "email": "ilya.sabanin@example.com",
    "changed_properties": null
  }
},
{
  "revision_cache": {
    "hash_id": "08a85e76ba28f74a46528ecf9db4a3e033c72803",
    "changed_files": [["FILE","add"]],
    "author": "John Doe",
    "time": "2011/09/12 13:20:59 +0800",
    "account_id": 2,
    "user_id": 2,
    "changed_dirs": [],
    "revision": "08a85e76",
    "too_large": false,
    "repository_id": 3,
    "message": "File",
    "email": "ilya.sabanin@example.com",
    "changed_properties": null
  }
}]
xml http-request
GET /api/changesets/repository.xml?repository_id={REPOSITORY_ID}

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<revision-caches type="array">
  <revision-cache>
    <account-id type="integer">46245</account-id>
    <repository-id type="integer">1</repository-id>
    <revision type="integer">1</revision>
    <message>Creating initial repository structure</message>
    <author>gilbert</author>
    <email>gilbert@example.com</email>
    <user_id>34087</user_id>
    <changed-dirs type="yaml">--- 
    - - branches/
      - :add
    - - tags/
      - :add
    - - trunk/
      - :add
    </changed-dirs>
    <changed-files type="yaml">--- []</changed-files>
    <changed-properties nil="true"></changed-properties>
    <too-large type="boolean" nil="true"></too-large>
    <time type="datetime">2009-11-18T12:49:34Z</time>    
  </revision-cache>

  <revision-cache>
    <account-id type="integer">46245</account-id>
    <repository-id type="integer">1</repository-id>
    <revision type="integer">2</revision>
    <message>Dummy commit</message>
    <author>ilya</author>
    <email>ilya@example.com</email>
    <user_id>97523</user_id>
    <changed-dirs type="yaml">--- []</changed-dirs>
    <changed-files type="yaml">--- []</changed-files>
    <changed-properties nil="true"></changed-properties>
    <too-large type="boolean" nil="true"></too-large>
    <time type="datetime">2009-20-18T14:59:12Z</time>    
  </revision-cache>
</revision-caches>

Find Changeset

Note that revision number is used instead of unique ID, therefore you have to specify repository_id.

json http-request
GET /api/changesets/{REVISION}.json?repository_id={REPOSITORY_ID}

Click to expand…

json http-response
{
  "revision_cache": {
    "hash_id": "7ada704eac04075f763f36190716e43381fc6e1d",
    "changed_files": [["bla","edit"]],
    "author": "John Doe",
    "time": "2011/09/12 13:24:05 +0800",
    "account_id": 2,
    "user_id": 2,
    "changed_dirs": [],
    "revision": "7ada704e",
    "too_large": false,
    "repository_id": 3,
    "message": "bla",
    "email": "ilya.sabanin@example.com",
    "changed_properties": null
  }
}
xml http-request
GET /api/changesets/{REVISION}.xml?repository_id={REPOSITORY_ID}

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<revision-cache>
  <account-id type="integer">46245</account-id>
  <repository-id type="integer">1</repository-id>
  <revision type="integer">2</revision>
  <message>Dummy commit</message>
  <author>ilya</author>
  <email>ilya@example.com</email>
  <user_id>97523</user_id>
  <changed-dirs type="yaml">--- []</changed-dirs>
  <changed-files type="yaml">--- []</changed-files>
  <changed-properties nil="true"></changed-properties>
  <too-large type="boolean" nil="true"></too-large>
  <time type="datetime">2009-20-18T14:59:12Z</time>    
</revision-cache>

Find Changeset Diffs

This method will return an array of differences for files of the changeset. Each difference is represented as an array of path, status and diff in Unified Diff format.

json http-request
GET /api/changesets/{REVISION}/differences.json?repository_id={REPOSITORY_ID}

Click to expand…

json http-response
{
  "files": [
    {
      "status": "add",
      "path": ".gitmodules",
      "diff": ...
    }
  ]
}
xml http-request
GET /api/changesets/{REVISION}/differences.xml?repository_id={REPOSITORY_ID}

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<files type="array">
  <file>
    <status type="symbol">add</status>
    <path>.gitmodules</path>
    <diff>...</diff>
  </file>
</files>