Sorry to keep bugging you, but I've got another question. I'm trying to set up a pre-commit script to make sure users add messages prior to committing their changes. I've set up the pre-commit.bat and it is executing, but producing an error. Am I missing anything?
<ReproPathConfig controlledPaths="/trunk">
<MailTo EMailAddress="test@test.com" EMailType="HTML" EMailSuppressionChar="~"/>
<DefaultLogMessage Text="#user# has decided not to add a log message. Don't worry, severe punishment will be administered in short order."/>
<CommitRequirements FailureMessage="Please add a commit message">
<CommitRequirement Description="Any Text" Regex="\w"/>
<!--<FolderNameExclusion FolderName="Process" FolderNameRegex="\w" FailureMessage="Failed on AddDelete" ControlledActionType="AddDelete"/> -->
<!--<FileTypeExclusion FileNameRegex="\w" FailureMessage="Failed on AddDelete file type exclusion" ControlledActionType="AddDelete"/>-->
<!--<FileTypeTagCheck FileExtension=".txt" FailureMessage="Failed on .txt AddDelete tag regex" ControlledActionType="AddDelete" Regex="\[\]"/>-->
</CommitRequirements>
<CommitterExclusions></CommitterExclusions>
<LockedPaths></LockedPaths>
</ReproPathConfig>
</subversionNotifyConfig>
Here is the error being produced -
[3/20/2008 1:55:24 PM] *************************
[3/20/2008 1:55:24 PM] Staring process for Revision 26-1 [E:/SVN/PMIS]
[3/20/2008 1:55:24 PM] Configuration file deserialized
[3/20/2008 1:55:24 PM] Commit Paths: /trunk/Artifacts/
[3/20/2008 1:55:24 PM] System.NullReferenceException: Object reference not set to an instance of an object.
at SubversionNotify.Program.PreCommitLockedPathCheck(HTMLProcessor proc, subversionNotifyConfig cfg, List`1 dirsChanged)
at SubversionNotify.Program.PreCommitProcessing(HTMLProcessor proc, subversionNotifyConfig cfg, String logFileName)
at SubversionNotify.Program..ctor(String repository, String revision, ProcessType prePost)
at SubversionNotify.Program.Main(String[] args)
[3/20/2008 1:55:24 PM] E:\SVN\Configuration\SVNNotify\SubversionNotify.log
Subversion Notify error.
Please have your administrator check the log for details on how to correct the issue
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jack,
Not at all, I'm happy to help you out.
There are 2 issues I see with the configuration file. First, if you include the <CommitterExclusions></CommitterExclusions> element, you need to have at least 1 <CommitterExclude> child setting included with it. Otherwise, you can eliminate the <CommitterExclusions> altogether.
Second, the <LockedPaths> element is also empty - the same rule applies, if you have it, it should have at least one <LockedPath> child element. If you don't need this setting, you can remove it altogether. Also with the <LockedPaths>, it's nested in the wrong place. It should be a child of the root <subversionNotifyConfig> element, and not the <ReproPathConfig> element. This setting applies for the entire repository.
Other than those 2 things, it looks OK. A great way to verify the validity of the configuration file it to open it up in an XML editor list Visual Studio or XML Spy and validate it againt the SubversionNotifyConfig.xsd schema file. These tools will alert you to missing or incorrect elements. The schema file is included in the SourceForge release package zip file.
I hope this helps, and please don't hesitate to ask!
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jack - I found the error of my ways! OK, while I fixed one thing, I broke another. The way the code is written now, you will need to add a <LockedPaths> element (it CAN be empty) as a child of the <subversionNotifyConfig> element. In my code, I check for the length of the element (which when it has no child <LockedPath> elements, will be zero, which is OK), but never check for a null value (which is what it is when the element is missing from the configuration).
Sorry about that. If you add <LockedPaths></LockedPaths> as a child of <subversionNotifyConfig>, you should be back up and running. I will certainly fix this error in a future release!
Thanks,
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Mike,
Sorry to keep bugging you, but I've got another question. I'm trying to set up a pre-commit script to make sure users add messages prior to committing their changes. I've set up the pre-commit.bat and it is executing, but producing an error. Am I missing anything?
Here is my configuration file -
<?xml version="1.0" standalone="yes"?>
<subversionNotifyConfig xmlns="http://www.mckechney.com/SubversionNotifyConfig.xsd">
<SVNConfig ExePath="C:\Program Files\Subversion\bin\svnlook.exe" />
<MailServer Name="smtp.test.com" FromAddress="test@test.com" Username="" Password=""/>
<ReproPathConfig controlledPaths="/trunk">
<MailTo EMailAddress="test@test.com" EMailType="HTML" EMailSuppressionChar="~"/>
<DefaultLogMessage Text="#user# has decided not to add a log message. Don't worry, severe punishment will be administered in short order."/>
<CommitRequirements FailureMessage="Please add a commit message">
<CommitRequirement Description="Any Text" Regex="\w"/>
<!--<FolderNameExclusion FolderName="Process" FolderNameRegex="\w" FailureMessage="Failed on AddDelete" ControlledActionType="AddDelete"/> -->
<!--<FileTypeExclusion FileNameRegex="\w" FailureMessage="Failed on AddDelete file type exclusion" ControlledActionType="AddDelete"/>-->
<!--<FileTypeTagCheck FileExtension=".txt" FailureMessage="Failed on .txt AddDelete tag regex" ControlledActionType="AddDelete" Regex="\[\]"/>-->
</CommitRequirements>
<CommitterExclusions></CommitterExclusions>
<LockedPaths></LockedPaths>
</ReproPathConfig>
</subversionNotifyConfig>
Here is the error being produced -
[3/20/2008 1:55:24 PM] *************************
[3/20/2008 1:55:24 PM] Staring process for Revision 26-1 [E:/SVN/PMIS]
[3/20/2008 1:55:24 PM] Configuration file deserialized
[3/20/2008 1:55:24 PM] Commit Paths: /trunk/Artifacts/
[3/20/2008 1:55:24 PM] System.NullReferenceException: Object reference not set to an instance of an object.
at SubversionNotify.Program.PreCommitLockedPathCheck(HTMLProcessor proc, subversionNotifyConfig cfg, List`1 dirsChanged)
at SubversionNotify.Program.PreCommitProcessing(HTMLProcessor proc, subversionNotifyConfig cfg, String logFileName)
at SubversionNotify.Program..ctor(String repository, String revision, ProcessType prePost)
at SubversionNotify.Program.Main(String[] args)
[3/20/2008 1:55:24 PM] E:\SVN\Configuration\SVNNotify\SubversionNotify.log
Subversion Notify error.
Please have your administrator check the log for details on how to correct the issue
Jack,
Not at all, I'm happy to help you out.
There are 2 issues I see with the configuration file. First, if you include the <CommitterExclusions></CommitterExclusions> element, you need to have at least 1 <CommitterExclude> child setting included with it. Otherwise, you can eliminate the <CommitterExclusions> altogether.
Second, the <LockedPaths> element is also empty - the same rule applies, if you have it, it should have at least one <LockedPath> child element. If you don't need this setting, you can remove it altogether. Also with the <LockedPaths>, it's nested in the wrong place. It should be a child of the root <subversionNotifyConfig> element, and not the <ReproPathConfig> element. This setting applies for the entire repository.
Other than those 2 things, it looks OK. A great way to verify the validity of the configuration file it to open it up in an XML editor list Visual Studio or XML Spy and validate it againt the SubversionNotifyConfig.xsd schema file. These tools will alert you to missing or incorrect elements. The schema file is included in the SourceForge release package zip file.
I hope this helps, and please don't hesitate to ask!
Mike
Mike,
I removed the 2 unnecessary tags, but am still getting the same error message in the logs. Here's the config file, any ideas?
<?xml version="1.0" standalone="yes"?>
<subversionNotifyConfig xmlns="http://www.mckechney.com/SubversionNotifyConfig.xsd">
<SVNConfig ExePath="C:\Program Files\Subversion\bin\svnlook.exe"/>
<MailServer Name="smtp.test.com" FromAddress="SVN@test.com" Username="" Password=""/>
<ReproPathConfig controlledPaths="/trunk">
<MailTo EMailAddress="me@test.com" EMailType="HTML" EMailSuppressionChar="~"/>
<DefaultLogMessage Text="#user# has decided not to add a log message. Don't worry, severe punishment will be administered in short order."/>
<CommitRequirements FailureMessage="Please add a commit message">
<CommitRequirement Description="Any Text" Regex="\w"/>
</CommitRequirements>
</ReproPathConfig>
</subversionNotifyConfig>
Jack - I found the error of my ways! OK, while I fixed one thing, I broke another. The way the code is written now, you will need to add a <LockedPaths> element (it CAN be empty) as a child of the <subversionNotifyConfig> element. In my code, I check for the length of the element (which when it has no child <LockedPath> elements, will be zero, which is OK), but never check for a null value (which is what it is when the element is missing from the configuration).
Sorry about that. If you add <LockedPaths></LockedPaths> as a child of <subversionNotifyConfig>, you should be back up and running. I will certainly fix this error in a future release!
Thanks,
Mike
That did it, thanks Mike!