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

Re: can't 'svn cp' *twice* - bug or prohibited?

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-12-09 23:40:57 CET

Alexis Huxley <ahuxley@gmx.net> writes:

> I've got a file in a working copy. Actually, I want a second copy of
> it. So I 'svn cp' it. Fine.
>
> A few weeks later I realise that the copy has not been updated to
> stay in line with the 'original', which has had many changes applied
> and commited in the intervening period.
>
> Rather than 'cp' it, and lose the knowledge of where the cp-induced
> changes come from, I'd like to 'svn cp' it again.

There are two choices: 1) 'svn rm' the second file and then 'svn cp'
the first file again, or 2) 'svn merge' the first file into the second
file.

> Unfortunately it doesn't work. It says:
>
> svn: Entry already exists
> svn: file `wc/file2' already exists.
>
> Is there some reason I'm not seeing why this has to be prohibited,
> or is it a bug? I checked the issues but didn't manage to find a match.

That's the intended beahviour.

> Here's the recipe:
>
> svnadmin create repos
> svn co file://`pwd`/repos wc
>
> touch wc/file1
> svn add wc/file1
> svn commit -m "added file1" wc
>
> svn cp wc/file1 wc/file2
> svn commit -m "copied file1 to file2" wc
>
> echo "here is a change to file1" > wc/file1
> svn commit -m "changed file1" wc
>
> svn cp wc/file1 wc/file2

I'll assume you can handle the 'svn rm' followed by 'svn cp' option,
so I'll just describe 'svn merge' :)

If file2 was created by copying revision X of file1 then you want to
merge all the changes made to file1 between X and HEAD. So use

  svn merge -rX:HEAD url_of_file1 wc/file2

If you make further changes to file1 you can use merge to add those to
file2 as well. A second merge would use '-rY:HEAD' where Y is the
revision that was HEAD in the previous merge.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Dec 9 23:41:39 2002

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