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

Re: force commit comments

From: Juanma Barranquero <jmbarranquero_at_laley.wke.es>
Date: 2003-11-21 10:39:06 CET

> Create a pre-commit hook that checks the value of the 'svn:log' property
> on the pending transaction. In fact, I think that's the example we use
> in the template for pre-commit hooks!

I have a related question: what's the best way to modify a log at
committing? (In my specific case, I want to be sure it doesn't end in \n,
for purely aesthetic reasons).

AFAICS, hooks/pre-commit.tmpl says, very prominently:

   # *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN. ***

so I'm assuming the only way is to have a post-commit hook which does
(warning: Windows syntax ahead) something like:

 svnlook log %1 -r %2 | perl -0ne "chomp; print $_" > %TEMP%\file
 svnadmin setlog %1 -r %2 %TEMP%\file
 del %TEMP%\file

which, leaving aside the issue of the possible race condition for the
file**, strikes me as odd: instead of modifying the log at arrival
(during pre-commit time, I mean), we have to wait for it to be written
to SVN, then read it, write it to a file, and then read back and pasted
into SVN again...

**Obviously, there can be no guarantee that hook processing for txn N is
finished before hook processing for txn N+1 starts, because hooks can
launch *anything* :(, so I'll have to delve into the delightful issue of
temporary-file management under CMD.EXE <sigh>.

---------------------------------------------------------
      ^^^^^^^^^^
On a (physically :) separate note, also related to hooks (though it is
perhaps a question for dev@): (pre|post)-revprop-change.tmpl says that
it receives four arguments, and when you're using authenticated users,
it is so.

But if you set your Apache so the /svn location needs no user validation
(and, consequently, all commits are anonymous), *-revprop-change hooks
receive three arguments. Not four, with 3rd (USERNAME) empty, but three.
I tested with compiled programs (because I feared that an empty argument
could be causing trouble for the .BAT script), and argc was 3.

IMHO, either a 3rd, empty, argument should be passed when there's no
username, or at least the comments in the .tmpl hooks should be ammended...

Thanks,

                                                                Juanma

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Nov 21 10:40:03 2003

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.