Implementing a new SCM¶
To see example code, take a look at the existing SCM implementations and their tests:
ScmBackup project, create a new class in the “Scm” folder. Name it like the SCM you are implementing, e.g.
The class must implement the interface IScm.
When the respective SCM has a command-line tool (like most current SCMs do), the easiest way to implement the class is by inheriting from the abstract CommandLineScm class.
CommandLineScm handles the plumbing to actually execute the command line tool, including looking for the executable at the path specified in the config)
All SCM implementations need to have an attribute, so SCM Backup is able to properly recognize them.
Apply the ScmAttribute to the class and set the
Type parameter to the
ScmType you added in the first step.
Example for Git:
[Scm(Type = ScmType.Git)]
internal class GitScm : CommandLineScm, IScm
ScmBackup.Tests.Integration project, create a new test class in the Scm folder which inherits from
IScmTests. Name it accordingly, e.g.
IScmTests contains all the tests and a few abstract properties for repo URLs, commit IDs etc.
The child classes just need to set these, so the same tests are executed for all
Please see also How to run the integration tests.