You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Subversion Newbie <su...@yahoo.com> on 2005/03/08 17:58:36 UTC

How to "svn copy" over and over to the same file?

I'm trying to implement a post-commit hook that, upon a
[certain] file being committed, copies that file (using svn
copy) to its equivalent in another part of the same repository.

At first glance I thought I could simply have the hook do a
"svn copy" of that file from one place in the repository to
another, but then realized it only works the first time, and
subsequent "svn copy" would give me the error "File ... already
exists".

My question is, what is the easiest way to implement this?  Am I
really trying to simply merge the entire contents of the source
file onto the destination every time?  (If so, what about the
first time when the destination doesn't yet exist?)

I'm sure there's a simple answer to this, but I haven't figured
out the easy way yet.  Thanks in advance...


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

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

Re: How to "svn copy" over and over to the same file?

Posted by allan juul <al...@muly.dk>.
Dale Worley wrote:

>>From: Subversion Newbie [mailto:subversionnewbie@yahoo.com]
>>
>>I'm trying to implement a post-commit hook that, upon a
>>[certain] file being committed, copies that file (using svn
>>copy) to its equivalent in another part of the same repository.
>>
>>At first glance I thought I could simply have the hook do a
>>"svn copy" of that file from one place in the repository to
>>another, but then realized it only works the first time, and
>>subsequent "svn copy" would give me the error "File ... already
>>exists".
> 
> 
> I think what you want to do is first "svn delete" the target name, then "svn
> copy" to it.  That always succeeds.
> 
> At first glance, I thought that you might want to do merges, but then I
> thought better of it -- Subversion knows that each revision of the target
> name is equal to some particular revision of the source name, and so the
> successive revisions of the target name do have proper incremental history
> joining them, although that history is stored in the repository under tha
> source name.
> 
> Dale

we had a simlar problem with out build script

in the post-hook you could do a

   svn ls url

(or a simlar thing using svnloo )
parse the output to verify existence/non-existence

if the destination url does already exist you should change the it in 
your  copy command accordingly

./allan



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

RE: How to "svn copy" over and over to the same file?

Posted by Dale Worley <dw...@pingtel.com>.
> From: Subversion Newbie [mailto:subversionnewbie@yahoo.com]
>
> I'm trying to implement a post-commit hook that, upon a
> [certain] file being committed, copies that file (using svn
> copy) to its equivalent in another part of the same repository.
>
> At first glance I thought I could simply have the hook do a
> "svn copy" of that file from one place in the repository to
> another, but then realized it only works the first time, and
> subsequent "svn copy" would give me the error "File ... already
> exists".

I think what you want to do is first "svn delete" the target name, then "svn
copy" to it.  That always succeeds.

At first glance, I thought that you might want to do merges, but then I
thought better of it -- Subversion knows that each revision of the target
name is equal to some particular revision of the source name, and so the
successive revisions of the target name do have proper incremental history
joining them, although that history is stored in the repository under tha
source name.

Dale


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