You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Hellen <he...@gmail.com> on 2008/03/12 06:19:24 UTC

svn info doesn't work in pre-commit script

Hi,

Does anyone know why the "svn info " doesn't work in the pre/start-commit
script?

I was trying to find the current work location and its information while
running pre/start-commit. so I put "svn info " in the start-commit script.
but somehow it shows the error message as:

svn: warning: '.' is not a working copy

in my start-commit, I put it as:

svnurl=`/usr/bin/svn info . |grep "^URL: "`
echo "svnurl:$svnurl" >&2

can anyone tell me what I did wrong? or is there a way to find out the URL
of the current location?

thanks
Hellen

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

Posted by Hellen <he...@gmail.com>.
ok. thank you very much for the help !

On Wed, Mar 12, 2008 at 11:57 PM, Ryan Schmidt <
subversion-2008a@ryandesign.com> wrote:

> On Mar 13, 2008, at 01:54, Hellen wrote:
>
> > On Wed, Mar 12, 2008 at 2:10 AM, Ryan Schmidt wrote:
> >
> >> On Mar 12, 2008, at 03:15, Hellen wrote:
> >>
> >> > On Tue, Mar 11, 2008 at 11:31 PM, Hilco Wijbenga wrote:
> >> >
> >> >> On Tue, Mar 11, 2008 at 11:19 PM, Hellen 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.
> >> >
> >> > 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
> >>
> >> That's the directory on your client...
> >>
> >> > somehow, It just cannot recognize the location of the current
> >> > directory.
> >> > does anyone have any idea on this ?
> >>
> >> ...but the hook scripts run on the server. The hooks cannot affect
> >> your client's working copy.
> >>
> >> > BTW: I tried those 2 arguments in pre-commit, it just gives me the
> >> > transaction number and the repository path not my current location.
> >>
> >> Correct. The hook does not know the path to the client's working
> >> copy.
> >>
> >> Let's ask a different question: What are you trying to accomplish?
> >> Maybe there's a different way to go about it.
> >
> > thanks for the 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.
>
> Right, and I responded in another thread yesterday that that's not
> going to happen because the hook script runs on the server but the
> working copy is on the client, and that I think the way to solve your
> issue is to use the write-thru proxy feature in Subversion 1.5.
>
>

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

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 13, 2008, at 01:54, Hellen wrote:

> On Wed, Mar 12, 2008 at 2:10 AM, Ryan Schmidt wrote:
>
>> On Mar 12, 2008, at 03:15, Hellen wrote:
>>
>> > On Tue, Mar 11, 2008 at 11:31 PM, Hilco Wijbenga wrote:
>> >
>> >> On Tue, Mar 11, 2008 at 11:19 PM, Hellen 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.
>> >
>> > 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
>>
>> That's the directory on your client...
>>
>> > somehow, It just cannot recognize the location of the current
>> > directory.
>> > does anyone have any idea on this ?
>>
>> ...but the hook scripts run on the server. The hooks cannot affect
>> your client's working copy.
>>
>> > BTW: I tried those 2 arguments in pre-commit, it just gives me the
>> > transaction number and the repository path not my current location.
>>
>> Correct. The hook does not know the path to the client's working  
>> copy.
>>
>> Let's ask a different question: What are you trying to accomplish?
>> Maybe there's a different way to go about it.
>
> thanks for the 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.

Right, and I responded in another thread yesterday that that's not  
going to happen because the hook script runs on the server but the  
working copy is on the client, and that I think the way to solve your  
issue is to use the write-thru proxy feature in Subversion 1.5.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

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

Posted by Hellen <he...@gmail.com>.
thanks for the 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.

On Wed, Mar 12, 2008 at 2:10 AM, Ryan Schmidt <
subversion-2008a@ryandesign.com> wrote:

>
> On Mar 12, 2008, at 03:15, Hellen wrote:
>
> > On Tue, Mar 11, 2008 at 11:31 PM, Hilco Wijbenga wrote:
> >
> >> On Tue, Mar 11, 2008 at 11:19 PM, Hellen 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.
> >
> > 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
>
> That's the directory on your client...
>
> > somehow, It just cannot recognize the location of the current
> > directory.
> > does anyone have any idea on this ?
>
> ...but the hook scripts run on the server. The hooks cannot affect
> your client's working copy.
>
> > BTW: I tried those 2 arguments in pre-commit, it just gives me the
> > transaction number and the repository path not my current location.
>
> Correct. The hook does not know the path to the client's working copy.
>
> Let's ask a different question: What are you trying to accomplish?
> Maybe there's a different way to go about it.
>
>
>

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

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 12, 2008, at 03:15, Hellen wrote:

> On Tue, Mar 11, 2008 at 11:31 PM, Hilco Wijbenga wrote:
>
>> On Tue, Mar 11, 2008 at 11:19 PM, Hellen 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.
>
> 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

That's the directory on your client...

> somehow, It just cannot recognize the location of the current  
> directory.
> does anyone have any idea on this ?

...but the hook scripts run on the server. The hooks cannot affect  
your client's working copy.

> BTW: I tried those 2 arguments in pre-commit, it just gives me the  
> transaction number and the repository path not my current location.

Correct. The hook does not know the path to the client's working copy.

Let's ask a different question: What are you trying to accomplish?  
Maybe there's a different way to go about it.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

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

Posted by Hellen <he...@gmail.com>.
yes. I have done some wrapper for the switching. but my boss doesn't accept
it  :-)

On Thu, Mar 13, 2008 at 12:30 AM, Lorenz <lo...@yahoo.com> wrote:

> Hellen wrote:
> >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.
>
> There is no way to get any informations about the working copy within
> a hook script. Not even if working copy and repository are on the same
> computer and you are using the file://... protocol.
>
> The data transfered to the repositiory do not contain any information
> about the physical location of the commit.
>
> Have you thought about a wrapper script around svn to do the
> switching?
> --
>
> Lorenz
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

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

Posted by Lorenz <lo...@yahoo.com>.
Hellen wrote:
>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.

There is no way to get any informations about the working copy within
a hook script. Not even if working copy and repository are on the same
computer and you are using the file://... protocol.

The data transfered to the repositiory do not contain any information
about the physical location of the commit.

Have you thought about a wrapper script around svn to do the
switching?
-- 

Lorenz


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

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

Posted by Hellen <he...@gmail.com>.
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@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@gmail.com]
> *Sent:* 12 March 2008 08:16
> *To:* Hilco Wijbenga
> *Cc:* users@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@gmail.com> wrote:
>
> On Tue, Mar 11, 2008 at 11:19 PM, Hellen <he...@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
>
>
>

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

Posted by Giulio Troccoli <Gi...@uk.linedata.com>.
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@gmail.com] 
Sent: 12 March 2008 08:16
To: Hilco Wijbenga
Cc: users@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
<hi...@gmail.com> wrote:

On Tue, Mar 11, 2008 at 11:19 PM, Hellen <he...@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

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

Posted by Hellen <he...@gmail.com>.
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 <hi...@gmail.com>
wrote:

> On Tue, Mar 11, 2008 at 11:19 PM, Hellen <he...@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
>

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

Posted by Hilco Wijbenga <hi...@gmail.com>.
On Tue, Mar 11, 2008 at 11:19 PM, Hellen <he...@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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org