You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jennifer Kesterson <je...@mail2.jpl.nasa.gov> on 2004/12/02 00:51:43 UTC
post-commit script to set keywords/prop-set hit and miss
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
Re: post-commit script to set keywords/prop-set hit and miss
Posted by kf...@collab.net.
Steve Greenland <st...@lsli.com> writes:
> It might be worth adding a big warning and
> explanation to the "post-commit" hook entry in
> http://svnbook.red-bean.com/en/1.0/ch05s02.html#svn-ch-5-sect-2.1.
Probably would be.
So... Can we persuade you to write that patch? :-)
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: post-commit script to set keywords/prop-set hit and miss
Posted by Steve Greenland <st...@lsli.com>.
On Wed, Dec 01, 2004 at 10:10:44PM -0600, Ben Collins-Sussman wrote:
>
> On Dec 1, 2004, at 6:51 PM, Jennifer Kesterson wrote:
>
> > 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.
>
> Yikes, this is a *really bad* strategy.
And you're going to continue to see people attempt it until server-side
default properties are available.
Yes, I've read the relevant entry in the issue tracker, I understand
that there are non-trivial issues to be solved, and no, I don't have the
time to contribute it. I'm not try to criticize here, just explain why
this pops up on a regular basis: trying to enforce a consistent set of
client configurations across a large and/or diverse set of developers
is difficult, especially if those configurations change over time, or
are different for different projects/repositories.
It might be worth adding a big warning and
explanation to the "post-commit" hook entry in
http://svnbook.red-bean.com/en/1.0/ch05s02.html#svn-ch-5-sect-2.1.
Steve
--
"Outlook not so good." That magic 8-ball knows everything! I'll ask
about Exchange Server next.
-- (Stolen from the net)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: post-commit script to set keywords/prop-set hit and miss
Posted by Ben Collins-Sussman <su...@collab.net>.
On Dec 1, 2004, at 6:51 PM, Jennifer Kesterson wrote:
> 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.
Yikes, this is a *really bad* strategy.
- What's preventing infinite loops? If your post-commit hook does
another commit, does the resulting commit call the post-commit hook
too?
- Every time a user commits, they have to 'update' again, because
they're immediately out of date. Bleh.
Instead, you should be making your users use 'auto-props' from their
clients, and if that's not enough, you should be using a *pre-commit*
hook to reject commits that don't set properties. Please read this
FAQ:
http://subversion.tigris.org/project_faq.html#auto-props
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org