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

Fw: using pre-commit hook to check for a property

From: Tsahi Asher <tsahi_75_at_yahoo.com>
Date: Mon, 18 Feb 2008 11:48:56 -0800 (PST)

1. i don't know python.
2. i have auto-props on my machine, but not everybody make sure they have them, and they don't work for existing files.

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
----- Original Message ----
From: "nicklist_at_planet.nl" <nicklist_at_planet.nl>
To: Tsahi Asher <tsahi_75_at_yahoo.com>; users_at_subversion.tigris.org
Sent: Monday, February 18, 2008 8:58:28 PM
Subject: RE:  using pre-commit hook to check for a property
RE:  using pre-commit hook to check for a property  Hi,
I think the enforcer script in the Subversion svn will do exactly what you want. [1] 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. [2]
Hth,
Nick S.
[1] http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/enforcer/
[2] http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.3.2
-----Original Message-----
From: Tsahi Asher [mailto:tsahi_75_at_yahoo.com]
Sent: Mon 2/18/2008 19:41
To: svn-users
Subject:  using pre-commit hook to check for a property
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
      ____________________________________________________________________________________
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
      Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.
      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Received on 2008-02-18 20:50:26 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.