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

post-commit script to set keywords/prop-set hit and miss

From: Jennifer Kesterson <jennifer_at_mail2.jpl.nasa.gov>
Date: 2004-12-02 01:51:43 CET

We wrote a post-commit hook script to set keywords and EOL styles in the
current repository on files that don't have them set. We are not using
local config files because developers log in from different machines all
the time. The results of the hook script were hit and miss -- in some
files the keywords/styles were set, in some they were not, and there
doesn't seem to be a pattern. Does anyone know why it would be
inconsistent? I'm including the contents of the script in case it would
help you. We're using Subversion 1.1 on Win32. Thanks.

  -------------- post-commit script begins here ----------------

echo on

REM Tweek contents of a rev to set keywords and line styles
REM as necessary

REM Build repository accessors and rev
set REPOPATH=%1%
set REPOURL=svn://127.0.0.1
set REV=%2%
set CACHE=C:\.commitCache

rmdir /S /Q %CACHE%
set log=C:\svnlog%REV%.txt

REM Look for directories that have changed files in them
REM and set the keywords. There should be few of these.
for /f "tokens=1*" %%a IN ('svnlook dirs-changed -r %REV% %REPOPATH%') do (

         date /T >> %log%
         time /T >> %log%
         echo ------------------------ >> %log%

         echo Subversion provided %REPOPATH%, %REV% as args to post-commit >>
%log%

         REM Make the cache and cd into it
         mkdir %CACHE%
         pushd %CACHE%

         echo svn co -N %REPOURL%/%%a svntmp >> %log%
         svn co -N %REPOURL%/%%a svntmp >> %log%

         echo svn propset -R svn:keywords "URL Rev Date" svntmp >> %log%
         svn propset -R svn:keywords "URL Rev Date" svntmp >> %log%
         echo svn propset -R svn:eol-style "native" svntmp >> %log%
         svn propset -R svn:eol-style "native" svntmp >> %log%

         REM - is this of any use ? svn update svntmp
         REM - is this of any use ? svn resolved -R svntmp

         echo svn ci svntmp -m "Auto Keyword Set via hook script" >>%log%
         svn ci svntmp -m "Auto Keyword Set via hook script" >> %log%

         rmdir /S /Q svntmp
)

REM rmdir /S /Q %CACHE%

:onexit
         popd
Received on Thu Dec 2 05:02:04 2004

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.