I wish to make it a requirement that when a user does a commit, he must have at least one line with something on it & also, it should end with "Defect: xx" (added automatically by tortoise).
I've tried the following on a .NET regex testing website & it works
(.+\n)+(.*\n)*Defect: \d+(\s*,\s*\d+)*
However, it always fails (i.e. never matches) when I use it in svn notify:
<CommitRequirement Description="Defect Number" Regex="(.+\n)+(.*\n)*Defect: \d+(\s*,\s*\d+)*"/>
Accept example:
Commit Msg
Defect: 23
Reject example:
Defect 23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Paul,
You got me on this one! The code used to run the regular expression check simply takes your regular expression string and creates the .NET Regex class:
new Regex(config.CommitRequirements.CommitRequirement[i].Regex);
There are no other options set to it. The commit log message is retrieved via the "svnlook log" process which with my testing doesn't add any extra information or line breaks other than what is in the actual log. I wonder it Tortoise is adding something extra to the message that is allowing the Regex to match?
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wish to make it a requirement that when a user does a commit, he must have at least one line with something on it & also, it should end with "Defect: xx" (added automatically by tortoise).
I've tried the following on a .NET regex testing website & it works
(.+\n)+(.*\n)*Defect: \d+(\s*,\s*\d+)*
However, it always fails (i.e. never matches) when I use it in svn notify:
<CommitRequirement Description="Defect Number" Regex="(.+\n)+(.*\n)*Defect: \d+(\s*,\s*\d+)*"/>
Accept example:
Commit Msg
Defect: 23
Reject example:
Defect 23
Sorry, I mean it always passes even when I have nothing before the "Defect: xx" line - so in previous message, the "Reject example" is allowed
Paul,
You got me on this one! The code used to run the regular expression check simply takes your regular expression string and creates the .NET Regex class:
new Regex(config.CommitRequirements.CommitRequirement[i].Regex);
There are no other options set to it. The commit log message is retrieved via the "svnlook log" process which with my testing doesn't add any extra information or line breaks other than what is in the actual log. I wonder it Tortoise is adding something extra to the message that is allowing the Regex to match?
Mike
OK thanks for checking Mike. If I come across a solution, I'll let you know.