I think the enforcer script in the Subversion svn will do exactly what you want.  As a side note, you can have your developers add autoprops for the .resx files, so they have this property being set automatically when they are added to your repository. 
From: Tsahi Asher [mailto:tsahi_75_at_yahoo.com]
Sent: Mon 2/18/2008 19:41
Subject: using pre-commit hook to check for a property
i have two related questions here.
1. Visual Studio generates .resx files for each project, and for each Form in .net projects. these are basically xml files that sometimes include large blocks of binary data encoded in Base64. i added a svn:needs-lock auto-prop on my station for these files, because i'm not sure svn can reliably merge such blocks of random text. anyone has any experience with merging Base64 encoded data?
2. in order to make sure everyone in the team add svn:needs-lock on .resx files, i wrote this piece of art of batch file logic, considering the limitations of the windows batch language. for each file in the transaction, the script checks it's state is not Deleted (because deleted files are not interesting here), and then check that the extension is .resx. if it is, it checks the value of it's svn:needs-lock property. if it's not '*', it prints an error to stderr, and turns on a flag. at the end of the iteration, if the flag is on, the batch file is exited with error code 1.
using print outs to a log file, it looks to me like when the property is missing, svnlook propget does not print an error to the stdout, but to stderr. is that correct? is it possible to redirect it to stdout somehow? when i tried to add 2>&1 inside the inner for command set (the call to svnlook), i received an error.
here's the script, in case it's of use to anyone:
rem check that .resx files have svn:needs-lock property set
rem %%A gets status, %%B gets file path for each line svnlook prints
for /f "usebackq tokens=1,2" %%A in (`"C:\Program Files (x86)\Subversion\bin\svnlook" -t %TXN% changed %REPOS%`) do (
if not %%A==D (
rem %%~xB extracts the extension from the path
if %%~xB == .resx (
for /f "usebackq" %%C in (`"C:\Program Files (x86)\Subversion\bin\svnlook" -t %TXN% propget %REPOS% svn:needs-lock %%B`) do (
rem set PC_C=%%C
if not %%C == * (
rem echo to stderr
echo %%B should have a svn:needs-lock=* property >&2
if not %error% == 0 exit /b 1
please CC me in your reply, thanks.
The day Micro$oft sells something that doesn't SUCK
is the day they start selling vacuum cleaners.
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-02-18 19:58:57 CET