January 19, 2010

SyncFolder

Surround SCM

Works with Surround SCM 2010 and later

Will not work with Surround SCM 2009 and earlier

This is an example of how to use the Surround SCM API to synchronize a local folder with a repository. It came as a request from one of our documentation folks, who use a tool to produce our HTML files and then need to pump the output of that tool into an existing repository. Basically, we get a list of the files and directories and check in any existing files, add new files or repositories, and delete old files and repositories.

Requirements

SyncFolder uses the Surround SCM API. You'll need to make sure the surround API dll is in the path of the executable.

App Flow

When the tool launches, it prompts you for your login credentials. It then brings up a dialog looking for a local directory and a Surround repository. Once those are selected, we iterate through files to see which ones are currently in Surround, which ones need to be added to Surround and which ones need to be removed from Surround. We then do this for any child repositories. I provide both a preview mode, so you can see what actions will be performed, as well as the actual copy mode. The repository browser shows one way to implement a dynamic Surround chooser that loads branches and repository information as-needed.

Download

You can download the entire Visual Studio project from here. Note: Seapine does not provide support for sample scripts.