In a pre-commit hook - how to access/compare current and previous versions of files
Posted
by
EthanML
on Stack Overflow
See other posts from Stack Overflow
or by EthanML
Published on 2012-09-24T16:11:27Z
Indexed on
2012/09/25
9:37 UTC
Read the original article
Hit count: 187
I'm trying to add to our existing pre-commit SVN hook so that it will check for and block an increase in file size for files in specific directory/s.
I've written a python script to compare two file sizes, which takes two files as arguments and uses sys.exit(0) or (1) to return the result, this part seems to work fine.
My problem is in calling the python script from the batch file, how to reference the newly committed and previous versions of each file? The existing code is new to me and a mess of %REPOS%, %TXN%s etc and I'm not sure how to go about using them. Is there a simple, standard way of doing this?
It also already contains code to loop through the changed files using svnlook changed, so that part shouldn't be an issue.
Thanks very much
© Stack Overflow or respective owner