i've created this pre-commit.bat hook to check committed .resx files have the svn:needs-lock=* property. it works fine for existing or new files, but not for replaced files (i.e. when you delete a .resx file, and add a new file by the same name, in the same commit). the second svnlook command doesn't produce output for some reason, and the hook fails and prevents the commit. i checked that the new file has the svn:needs-lock property set.
the first svnlook command produces two lines for the file, one for deleting (status D) and one for adding the new file (status A). for example,
the bat file:
rem check that .resx files have svn:needs-lock property set
rem %%A gets status, the implicit %%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 tokens=1" %%C in (`"C:\Program Files (x86)\Subversion\bin\svnlook" -t %TXN% propget %REPOS% svn:needs-lock %%B 2^>^&1`) do (
if not %%C == * (
rem echo to stderr
echo %%B should have a svn:needs-lock=* property >&2
if not %error% == 0 (
echo Goto TortoiseSVN settings ^> Edit button, add the following line to [auto-props]: >&2
echo *.resx = svn:needs-lock >&2
echo and make sure you set >&2
echo enable-auto-props = yes >&2
exit /b 1
The day Micro$oft sells something that doesn't SUCK
is the day they start selling vacuum cleaners.
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-03-11 09:43:05 CET