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

Re: Reverting a File Added by Merge

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-03-16 22:50:36 CET

Brian Buesker <bbuesker@qualcomm.com> writes:

> I ran into the following problem with trying to revert a file that was
> added by an svn merge. When the file that I want to revert is
> contained within a directory that was also added by the merge, and I
> do an svn revert on the file and then commit, the file that I reverted
> still exists in the repository although it is no longer listed in
> .svn/entries.

It's a long standing bug in merge. Compare merge and copy

$ svnadmin create repo
$ svn mkdir -m "" file://`pwd`/repo/dir
$ svn import -m "" Makefile file://`pwd`/repo/dir/file
$ svn co -r0 file://`pwd`/repo wc1
$ svn co -r0 file://`pwd`/repo wc2

$ svn merge -r0:2 file://`pwd`/repo wc1
$ svn st wc1
A + wc1/dir
A + wc1/dir/file

$ svn cp file://`pwd`/repo/dir wc2
$ svn st wc2
A + wc2/dir

The merge marks the new file as both copied="true" and schedule="add"
while the copy only marks it copied="true". Copy is correct, merge is
wrong. Getting rid of wc1/dir/file using revert simply undoes the
schedule="add", but that doesn't work as expected. With wc2/dir/file
revert has no effect, one must use rm to get rid of it which causes
schedule="delete".

I've known for some time that merge tends to make too many things
explicitly schedule="add", but until now I didn't realise that it
caused any real problems. Merge has always had problems adding a
directory hierarchy, at one point it ran extra repos-to-wc copy
operations to do it. At the root of the problem are the two libsvn_wc
adding functions: svn_wc_add and svn_wc_add_repos_file, they really
are difficult to use (and their documentation alludes to that).

A user who wants to delete parts of the merge can work around the
problem by reverting the add of the whole directory hierarchy and
replacing it with a repos to wc copy, then it will be possible to
delete (not revert) the bits that should not be added. That's a long
way from ideal.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Mar 16 22:52:00 2005

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.