November 20, 2009

Rollback Changelist

Surround SCM

Works with Surround SCM 2010 and later

Will not work with Surround SCM 2009 and earlier

RollbackChangelist is a tool that allows the user to rollback files committed via a changelist. The tool goes file by file and rolls it back to the version previous to the one created by the changelist. Unlike the changelist, this rollback is not atomic. This tool does the equivalent of the user going to each file's history and rolling back the file, one by one. The tool simply does this in batch mode, which is easier for the user, especially for changelists that might contain several files. To keep things simple, at this time the tool only rolls back check in actions.

Rollback Changelist Plugin

App Flow

When Rollback Changelist launches, it uses information gathered from the environment variables made available by the plugin architecture to know the branch and repository that are currently selected, as well as the user currently logged in to the Surround SCM client. Based on this information, Rollback Changelist uses the Surround SCM API to get a list of committed changelists for the current user in Surround SCM. Note that this user may be different than the one used by Rollback Changelist to connect to the Surround SCM server. Rollback Changelists builds two tables:
  • Changelist Table - Contains a list of changelists committed by the user, along with the timestamp of the changelists and if Rollback Changelists detects if it has rolled back this changelist allready.
  • File Table -Contains a list of all files that were part of the changelists whose action was a check in. It also includes the version created by the changelist and the current version of the file.
The user at first will only see the changelist table displayed. As each changelist is selected, only the corresponding files are shown.

Determining previous rollback

When Rollback Changelist rolls back a file, it enters a comment using the changelist name that it is reversing. Rollback Changelist will go through all rollback events for all files and search for the changelist name. If it finds any instances of this, it assumes that it has already rolled back that changelist.

Configuration

Access from Surround SCM client

Please refer to the Surround SCM Custom Client Menus article for help on creating a custom menu option to access Rollback Changelist. The tool is meant to be used as a plugin and will not work otherwise. While the tool maybe accessed from anywhere, remember that it will need a branch to be selected, so it makes sense to make it available from the branch context menu.

Configuration File

Rollback Changelist reads the information needed to connect to the Surround SCM server from a configuration file called "CMConfig.xml". This file must reside on the same directory as the Rollback Changelist.exe file. A sample file is provided with the Download. The file must have the following information:
  • UserName - User name to connect to Surround SCM
  • Password - Password for the above user
  • SCMServerAddress - Surround SCM IP address or host name
  • SCMServerPort - Port of the above server
The file must have the following structure:
<CMData>
	<UserName></UserName>
	<Password></Password>
	<SCMServerAddress></SCMServerAddress>
        <SCMServerPort></SCMServerPort>
</CMData>

Download

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