Created
December 2, 2010 00:00
-
-
Save vcsjones/724486 to your computer and use it in GitHub Desktop.
CaptainHook Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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