Menu

Folder Name/File Type Exclusions

Help
jlavoy
2008-03-24
2013-05-01
  • jlavoy

    jlavoy - 2008-03-24

    Hey Mike,

    I'm trying to use the FolderNameExclusion and FileTypeExclusion properties during my pre-commit hook, but they don't seem to be working.  Here are the relevant lines from my config file, any ideas?

    Below you'll see I'm trying to disallow the commit of a folder named "bin" or a file of type .suo.

            <CommitRequirements FailureMessage="Please add a commit message">
                <CommitRequirement Description="Any Text" Regex="\w"/>
                <FolderNameExclusion  FolderName="bin" FolderNameRegex="^bin$"  FailureMessage="You cannot add bin folders to the repository." ControlledActionType="Add"/>
                <FileTypeExclusion FileExtension=".suo" FileNameRegex="\w" FailureMessage="You cannot add .suo files to the repository." ControlledActionType="Add"/>
            </CommitRequirements>

     
    • mmckechney

      mmckechney - 2008-03-24

      Jack,
      You're actually making it more complex than it needs to be. The "Name" and "Regex" attributes are mutually exclusive in the exclusion elements, meaning that if you specify a regex expression, the name value will be ignored. In your case, you are looking for simple exclusions that don't need the added power of the regular expression. You can simply use the following an it will work fine:

      <FolderNameExclusion FolderName="bin"  FailureMessage="You cannot add bin folders to the repository." ControlledActionType="Add"/>
      <FileTypeExclusion FileExtension=".suo" FailureMessage="You cannot add .suo files to the repository." ControlledActionType="Add"/>

      I do want to point out that with the ControlledActionType of "Add", you will not exclude any delete or update commits to files that may already be in the repository. This may be what you're after, but I wanted to make sure it was clear.

      Also, I have finished an HTML manual for the tool that can be found here: http://mckechney.com/SubversionNotifyForWindows. In it I tried to explain the purpose an use of all the different elements. I'm always looking for feedback, so if there is something that isn't clear, please let me know and I can update the manual.

      Thanks,
      Mike

       
    • jlavoy

      jlavoy - 2008-03-24

      Mike,

      I changed the config to say

                  <FolderNameExclusion FolderName="bin" FolderNameRegex="" FailureMessage="You cannot add bin folders to the repository." ControlledActionType="Add"/>
                  <FolderNameExclusion  FolderName="obj" FolderNameRegex="" FailureMessage="You cannot add obj folders to the repository." ControlledActionType="Add"/>
                  <FileTypeExclusion FileExtension=".suo" FileNameRegex="" FailureMessage="You cannot add .suo files to the repository." ControlledActionType="Add"/>

      and it looks like it's working.  Thanks again!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.