Example: Send commit data to TeamForge via SOAP

Use the Commit Tool provided with TeamForge to transmit your commit data to TeamForge.

The SCM Adapter allows you to develop integrations with almost any SCM tool, then exchange commit data with TeamForge. After you have created an SCM integration using the TeamForge API, you will use the Commit Tool provided with TeamForge to transmit your commit data to TeamForge.

For any SCM tool that supports triggers, you can use the tool’s triggering mechanism to script the following actions. Otherwise, you can perform them manually for each commit.

Note: The SCM Adapter option is always available, but will work only if you have developed an integration with an SCM tool using the TeamForge API.
  1. Get the Commit Tool from $SOURCEFORGE_HOME/integration/CommitTool.py
  2. Add the SCM server to your TeamForge installation. For the end user instructions, see Integrate a source code server .
  3. Create a repository on the SCM server. For the end user instructions, see Create a source code repository.
  4. Use the Commit Tool to start a commit.
    • CommitTool.py create <systemId> <path> <username> <host> <port>

    where:

    • systemId is the external system identifier that was given to the integration server. You can find this on the Repository Details page.
    • path is the path on the external system that was given to the repositorey. See the Repository Details page.
    • username is the TeamForge user name that will be performing the commit.
    • host is the TeamForge application server machine hostname.
    • port is the TeamForge application server machine SOAP port.
  5. After the commit has been created, use the Commit Tool to add files with versions and actions.
    • CommitTool.py add <filename <version [<status [<fromfile <fromversion]]

    where:

    • filename is the name of the file that is being placed into the commit.
    • version is the version of the file that is being placed into the commit.
    • status is the status of the file in the repository. Valid status values are ʹaddedʹ, ʹdeletedʹ, ʹmodifiedʹ, ʹmovedʹ, and ʹcopiedʹ. Status is optional and will default to ʹaddedʹ if no value is provided.
    • fromfile is the name of the original filename if this file was copied or moved. It is required on a copy or move, but is not allowed on an add, delete, or modify.
    • fromversion is the version of the original filename is this file was copied or moved. It is required on a copy or move, but is not allowed on an add, delete, or modify.
  6. When all actions and files have been added to the commit, use the Commit Tool to transmit the commit to CollabNet TeamForge.
    • CommitTool.py commit <commitmessage>

    where <commitmessage> is a description about the commit that will be displayed along with the files, versions, and operations.

    Note: To create an association, use the standard associate command [<item id>]. No special syntax is required when using the Commit Tool.
    For all of the above commands, when run correctly, there will be no output, and the return value of the program will be “0”, indicating success. Failure will show a message and return with a non “0” return value.
    Tip: To see the status of the current commit, you can use the Commit Tool to print the output of the current commit:
    • CommitTool.py print

    It will show output similar to this:

    Repository: <username>@<systemid>:<path> Modified filename 1.2 Added document 1.1 Copied newfile 1.1 (From: origfile 1.3) <status> <filename> <version> (From: <fromfile> <fromversion>)