Skip to content

Instantly share code, notes, and snippets.

@vcsjones
Created December 2, 2010 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vcsjones/724486 to your computer and use it in GitHub Desktop.
Save vcsjones/724486 to your computer and use it in GitHub Desktop.
CaptainHook Example
public class RequireTargetProcessNumber : PreCommitHook
{
protected override bool HandleHookEvent(ITransactionInfo commit)
{
string commitMessage = commit.LogMessage;
if (!HasTargetProcessNumber(commitMessage))
{
this.Context.Output.WriteError("TargetProcess Number was not specified in commit message.");
return false;
}
else
{
return true;
}
}
public bool HasTargetProcessNumber(string commitMessage)
{
return Regex.IsMatch(commitMessage, @"#\d+");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment