[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

using pre-commit hook to check for a property

From: Tsahi Asher <tsahi_75_at_yahoo.com>
Date: Mon, 18 Feb 2008 07:02:06 -0800 (PST)

 hi,
 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:
 
 set REPOS=%1
 set TXN=%2
 
 rem check that .resx files have svn:needs-lock property set
 set error=0
 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
           set error=1
         )
       )
     )
   )
 )
 if not %error% == 0 exit /b 1
 
 please CC me in your reply, thanks.
 Tsahi
 
 --
 The day Micro$oft sells something that doesn't SUCK
 is the day they start selling vacuum cleaners.
 http://www.geocities.com/tsahi_75
 

      ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping

---------------------------------------------------------------------
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-20 03:42:33 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.