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

Re: Re: svn info doesn't work in pre-commit script

From: Hellen <hellenff_at_gmail.com>
Date: Wed, 12 Mar 2008 10:41:52 -0700

Thanks Giulio for your help.

Actually I want to get the current directory path from "svn info " while
using "svn commit". so I can write a script for auto switch (svn switch
--relocate from_URL To_URL) from the mirror side to master side.

Do you know how to get this information to do this?

thanks very much in advance.
Hellen

On Wed, Mar 12, 2008 at 2:07 AM, Giulio Troccoli <
Giulio.Troccoli_at_uk.linedata.com> wrote:

> Hellen,
>
>
>
> It seems from your email you're trying to get the URL of your repository
> in the pre-commit hook. Is that correct? I presume so.
>
>
>
> As far as I understand there is no way to do that. I personally have the
> URL hard-coded as it's extremely unlikely that it will change. Even if we
> move the repository since the hooks are always on the server the URL is
> always something like http://localhost/<repo-name<http://localhost/%3crepo-name>
> >
>
>
>
> Maybe you want the URL so you can use other command to get more
> information about the repository and the current commit transaction? In that
> case you can use svnlook which provides most (if not all) of the information
> you need and it works with the repository path which is passed to the
> pre-commit hook, as you know.
>
>
>
> Last but not least, remember that all hooks run in an empty environment so
> the two parameters passed to the pre-commit hook (repository path and
> transaction) are the only two you can use (this to say why the working copy
> path is not available to the pre-commit).
>
>
>
> Giulio
>
>
>
>
> Linedata Services (UK) Ltd
> Registered Office: Bishopsgate Court, 4-12 Norton Folgate, London, E1 6DB
> Registered in England and Wales No 3027851 VAT Reg No 778499447
>
> ------------------------------
>
>
> *From:* Hellen [mailto:hellenff_at_gmail.com]
> *Sent:* 12 March 2008 08:16
> *To:* Hilco Wijbenga
> *Cc:* users_at_subversion.tigris.org
> *Subject:* Re: svn info doesn't work in pre-commit script
>
>
>
> Thanks for your help. But I have also tried using "svn info" without the
> ".", but It still doesn't work.
>
> I changed the following in the start-commit:
> --------------------------------
>
> echo `pwd` >&2
> svnurl=`/usr/bin/svn info |grep "^URL: "`
> echo "svnurl:$svnurl" >&2
> ---------------------------------
>
> and here is the result:
> --------------------------------
> /home/svn_user
> svn: '.' is not a working copy
> svnurl:
> --------------------------------
>
> but I run "svn commit" at:
> /home/svn_user/tstchout/svn_mirror/testrepo1/trunk/Scripts.test
>
>
> somehow, It just cannot recognize the location of the current directory.
> does anyone have any idea on this ?
>
> BTW: I tried those 2 arguments in pre-commit, it just gives me the
> transaction number and the repository path not my current location.
>
> thanks in advance.
> Hellen
>
>
>
>
> On Tue, Mar 11, 2008 at 11:31 PM, Hilco Wijbenga <
> hilco.wijbenga_at_gmail.com> wrote:
>
> On Tue, Mar 11, 2008 at 11:19 PM, Hellen <hellenff_at_gmail.com> wrote:
> > svn: warning: '.' is not a working copy
>
> I don't think "svn info" is the problem, it's the ".". Your current
> directory is presumably the directory of the pre-commit script. I
> doubt that's what you meant.
>
> The pre-commit script gets 2 arguments, try using those.
>
> Cheers,
> Hilco
>
>
>
Received on 2008-03-12 18:42:53 CET

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.