I am new to SharpSVN and SVN in general. I am trying to implement a pre-commit hook that when the user commits a certain type of XML file; I am going to need to intercept the file and analyze it to ensure they included certain elements before I allow the file to be committed.
Since it seems that SVN submits two arguments; the repository path and the transaction; I will need to use these two items to intercept the file. Does anyone know what I need to use in SharpSVN to get file information based on these two parameters?
Thanks, Flea#
You can do this by using the builtin
SvnLookClient
.To use this, first of all you need a
SvnLookOrigin
. SharpSvn contains standard argument parsing that 'knows' what arguments are passed to each type of hook. This gives you access to thisSvnLookOrigin
:Getting the changed files and contents of those files based on the parsed arguments
Edit: Write to
Console.Error
andEnvironment.Exit(1)
to report errors (exit non-null).