About config files
Published 16 July 2015
You can use a config file:
- to customize how SQL Source Control works with Git, SVN and TFS
- to use a different source control system (eg Mercurial)
A config file is an XML file that contains command line hooks to automate source control operations (eg add, edit, commit, etc). 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 create your own config file, or modify the preset files.
Create a config file
To create a config file for your source control system:
- In the Object Explorer, select the database you want to link to source control.
- In SQL Source Control, on the Setup tab, make sure Link to my source control system is selected and click Next.
- On the Choose your source control system page, select Other.
The Link to source control dialog box opens: - 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
.xml
file in the default config files folder:
%USERPROFILE%\AppData\Local\Red Gate\SQL Source Control 7\CommandLineHooks
You can select the config file in the Custom tab in the Link to source control dialog box.
Commands in the preset 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.