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

RE: Re: Need checkout commits...

From: Thompson, Graeme (AELE) <Graeme.Thompson_at_smiths-aerospace.com>
Date: 2005-12-13 10:44:12 CET

Lieven,

Thank you very much,

This should do what I want, I will try it soon.

Might it be a good idea to setup a repository of useful scripts like
this? Perhaps in some sort of wiki so that it would be easy for people
to fix any typos and also keep a full history of any changes?

Thank you,

Graeme

> -----Original Message-----
> From: Lieven Govaerts [mailto:lgo@mobsol.be]
> Sent: 12 December 2005 18:42
> To: Thompson, Graeme (AELE)
> Cc: maxx@eureca.ru; 'Subversion'
> Subject: RE: Re: Need checkout commits...
>
> Graeme,
> >
> > Quoting "Thompson, Graeme (AELE)"
> > <Graeme.Thompson@smiths-aerospace.com>:
> >
> > >
> > > I have just tried this with a subversion 1.2.3 server on
> > SUSE 10 and a
> > > TortoiseSVN 1.2.6 client.
> > >
> > > It does not *Require* you to have a lock in order to
> commit a file
> > > with the svn:needs-lock property. You can simply make the file
> > > writable and then do a commit and it will happily go ahead
> > and update the repository.
> > >
> > > Is there any way to get this to be a requirement, e.g. through a
> > > pre-commit hook similar to the suggested one to ensure that
> > all files
> > > have the svn:needs-lock property set?
> > >
> > > If so then has anyone got any examples of how to do this?
> >
> > This would be easy to build using "svnlook propget".
> > If no one has an example file available I'll create one
> this evening.
>
> this simple pre-commit script checks if all files in a
> transaction were
> locked
> in the repository. It doesn't check if that was your lock (
> commit will fail
> anyway ), nor does it filter on extensions ( not that
> difficult to add ).
>
> You might clean it up a bit.
>
> --------------
> #!/bin/bash
>
> isFileLocked()
> {
> COMMITFILES=`svnlook changed -t $TXN $REPOS`
>
> #save the current IFS
> OLDIFS=$IFS
> IFS=$'\n'
>
> # iterate over all files in the transaction
> for line in $COMMITFILES; do
> line=`echo $line | cut -c 5-`
> LOCKSET=`svnlook lock $REPOS "/$line" | grep "UUID
> Token" | wc
> -c`
> if [ $LOCKSET = 0 ]; then
> #reset the old IFS
> IFS=$OLDIFS
> REPLY=$line
> return 1
> fi
> done
>
> #return the old IFS
> IFS=$OLDIFS
> REPLY=""
> return 0
> }
>
> REPOS="$1"
> TXN="$2"
>
> isFileLocked
>
> if [ $? = 1 ]; then
> echo "Failed commit because file '$REPLY' wasn't locked before
> commit!" >&2
> exit 1
> fi
>
> # All checks passed, so allow the commit.
> exit 0
> -----------------
>
> Hope this helps.
>
> regards,
>
> Lieven.
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.371 / Virus Database: 267.13.13/197 - Release
> Date: 9/12/2005
>
>
>

******************************************
The information contained in, or attached to, this e-mail, may contain confidential information and is intended solely for the use of the individual or entity to whom they are addressed and may be subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email.
******************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Dec 13 10:58:17 2005

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.