Working with config files
Published 25 March 2013
SQL Source Control has full integration with SVN, TFS and Vault. If you want to customize how SQL Source Control works with these systems, or if you want to use a different source control system (eg Git or Mercurial), you can use a config file.
A config file is an XML file that contains command line hooks to automate source control operations (add, edit, delete etc). SQL Source Control can use config files to automate source control operations for any source control system with a command line interface. Preset config files are provided for:
- Git
- Mercurial
- Perforce
- Plastic SCM
You can modify the preset files or create your own.
Commands in the config files
The preset config files include the following commands:
Get latest
Updates the local working folder with latest version in source control.
Commit
Commits all changes in the local working folder to source control.
Add
Adds new files to the local working copy. Changes can then be committed to source control using the Commit command.
Edit
Makes the local working copy of the files available for editing. Changes can then be committed to source control using the Commit command.
Delete
Deletes the files from the local working copy. Changes can then be committed to source control using the Commit command.
Revert
Undoes changes if an error occurs during a commit.
Creating a custom config file
To create a custom config file for your source control system:
- On the Link to Source Control dialog box, on the left, select Custom.
- Click Manage config files.
The CommandLineHooks folder opens. Open Template.xml in a text editor and specify commands and verification codes for the source control actions you want to automate. Help is provided inside Template.xml.
Make sure you specify the name you want to use for the config file in the
<Name>
tag. For example:<Name>Darcs</Name>
To include multiple operations in a single command, separate them with &&. For example:
accurev add -c -d ($Files) && accurev keep -m && accurev promote -k
- Save your changes as a new XML file in the default config files folder:
%USERPROFILE%\AppData\Local\Red Gate\SQL Source Control 3\CommandLineHooks
You can select the config file in the Custom tab in the Link to source control dialog box.