Works with Surround SCM 2008
For those users looking to access Surround SCM programatically, their only option is through the Command Line Interface (CLI). Many of the examples I have posted on this site show how you can access the command line interface using python. For those that are looking for an easier and more reusable option, you may find using this python library helpful.
About the wrapper
The file is simply a wrapper over the CLI. The advantage of the wrapper is that instead of having to build commands to pass the CLI, you can simple use methods and pass the parameters.
Remember that this is still the CLI running in the background. This means that you still need to have the CLI installed and running.
The methods are subject to how the CLI works. Make sure you review the CLI user guide to make sure you are using the command properly. If you are not getting the results you expect, run the actual command on the command line.
To use this python file, just import it into your namespace within your python script.
Download
Download the python file here.
Setting the connection parameters
Instead of passing the connection parameters such as username, password, server address and port with each command, these are fields on the SCCM object.
| Type | Field Name | Description |
| string | Username | Surround SCM username |
| string | Password | Password for the username above |
| string | SCMServerAddr | Surround SCM server address |
| string | PortNum | Surround SCM server port |
| string | SingleSignOn | Using single-signon |
| string | UnicodeOutput | Display output in Unicode (Windows only) |
Example:
from PySSCM import *
mySSCM = SSCM()
mySSCM.SCMServerAddr='localhost'
mySSCM.PortNum=4900
mySSCM.Username='test
mySSCM.Password='passtest' Sample commands
Here are a few samples using the wrapper. Optional arguments can be skipped. If the command takes a set of known values (like FileType) then a simple class is provided for the allowed values, along with one value (called Empty) which means unspecified.
Check out
| Type | Parameter | Description |
| string or list of strings | Files | The files to check out |
| string | Branch | The branch to checkout from |
| string | Comment | The comment associated with the check out |
| Boolean | Exclusive | Check out files exclusively so other users cannot check them out |
| Boolean | Force | Force file retrieval from server |
| string | Repository | The repository where the file is located |
| Boolean | Recursive | Recursively check out files if Item is a repository or file name includes wildcard characters |
| SCMTimestamps | Timestamp | Timestamp to set on checked out files |
| string | Version | File version to check out |
| SCMReplace | Replace | How to replace writable working directory files |
| string | Changelist | Changelist to add the file to |
Example:
from PySSCM import *
mySSCM = SSCM()
mySSCM.SCMServerAddr='localhost'
mySSCM.PortNum=4900
mySSCM.Username='test
mySSCM.Password='passtest'
mySSCM.checkout('Test.txt',Branch='b1',Repository='r1') Get
| Type | Parameter | Description |
| string or list of strings | Items | The files to get |
| string | Branch | The branch to checkout from |
| string | LocalDir | Local directory to get files to |
| Boolean | Writeable | Make local files writable |
| Boolean | Force | Force file retrieval from server |
| string | Repository | The repository where the file is located |
| string | Label | Label to search for |
| string | Timestamp | Timestamp to search for |
| string | Version | File version to get |
| Boolean | Removed | Include removed files when getting files by label or timestamp |
| Boolean | DisplayVersion | Display the file version retrieved |
| Boolean | Recursive | Recursively get files if Item is a repository or file name includes wildcard characters |
| SCMTimestamps | RetrievelTimestamp | Timestamp to set on retrieved files |
| SCMReplace | Replace | How to replace local writable files or handle modified files in the working directory that were removed from the server |
Example:
from PySSCM import *
mySSCM = SSCM()
mySSCM.SCMServerAddr='localhost'
mySSCM.PortNum=4900
mySSCM.Username='test
mySSCM.Password='passtest'
mySSCM.get(['Test.txt','Test2,txt'],Branch='b1',Repository='r1')Share on Technorati . del.icio.us . Digg . Reddit . Slashdot . Facebook . StumbleUponRelated posts:









