Beanstalk

Version Control with a Human Face

Changeset model

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 will fetch 15 changesets from all repositories available to the user currently logged in by basic auth. Use the optional page parameter to fetch more changesets.

http-request
GET /api/changesets.xml

Click to expand…

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>
    <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>
    <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>
ruby
Beanstalk::API::Changeset.find :all

Find all changesets for a specific repository

You can use the repository name and it’s ID. So instead of repo_name in the example below, you could use a number like 58.

http-request
GET /api/changesets/repository.xml?repository_id=NAME_OR_ID

Click to expand…

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>
    <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>
    <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>
ruby
Beanstalk::API::Changeset.find_all_for_repository(58)

Find a single changeset

Note that revision number is used instead of ID. Therefore you need to specify repository_id, which is the label (“repo_name”) in the example below. Alternatively for repository_id you could use it’s numeric ID (say “58”).

http-request
GET /api/changesets/100.xml?repository_id=repo_name_or_id

Click to expand…

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>
  <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>
ruby
Beanstalk::API::Changeset.find_for_repository(100, "repo")