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

Re: cr, lf on merge ... implement or use gnu diff option?

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-11-14 03:40:47 CET

Noel Yap <yap_noel@yahoo.com> writes:

> > You're talking (once again) about a post-commit
> > script making a
> > commit. That leads to infinite loops, remember?
> > (Unless you're
> > extremely clever.) :-)
>
> Oh, yes, I forgot to mention this caveat.
>
> Solo, I haven't tried this out myself so I'm not even
> sure if there's a way to stop the infinite recursion.
> If you find a way, please let me/us know.

Just arrange for the post-commit hook not to react to commits caused
by the post-commit hook :)

How do you do that? Well, if you twist my arm...

...there are various ways you could do it. For example, you could use
a special post-commit author

#!/bin/sh
# Evil, untested script that's not going in *my* repository!
REPOS=$1
REV=$2
AUTHOR=`svnlook author -r $REV $REPOS`
echo "post-commit for $AUTHOR rev $REV" > log.$REV
if test "$AUTHOR" = "postcommit" ; then
  exit 0
fi
svn mkdir --username postcommit -m "" file://$REPOS/pc$REV >> log.$REV 2>&1

A real-life solution may well do the test the other way around by
having a list of authors to which it does react, rather than a "magic"
author to which it does not react.

If you decide this scheme is sane enough to follow then note that once
the BDB transaction is committed, and before its post-commit hook
runs, it is possible for a second BDB transaction to complete and for
its post-commit hook to get in first. So

- don't assume that only one post-commit instance is running
- don't assume that $REV is HEAD
- don't assume that HEAD remains the same during the script

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 14 03:41:32 2002

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

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