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

Removing a versioned file/directory from version control without deleting it

From: Hans Salvisberg <svn.users_at_salvisberg.com>
Date: 2006-10-27 18:27:20 CEST

I've just started to use Subversion to run an entire Linux file system under version control, and it works great! Obviously, it requires setting quite a few svn:ignore properties. Nonetheless, I often have to remove files and/or entire directories from version control when I find out that they keep changing and that I'd rather ignore them.

In a post in the archives someone suggested the following for unversioning a file:

> $ cp -p foo foo.keep
> $ svn rm foo
> $ svn propset svn:ignore foo .
> $ mv foo.keep foo
>
> $ svn ci -m "Removing foo from version control"
>
> You could certainly wrap the first four steps into a shell script if
> it's something you expect to want to do often.

This is flawed for several reasons:
1. It generates unnecessary disk activity, especially if the file is large
2. If the svn:ignore property is already set with other patterns, it's trashed
3. Adding (rather than replacing) foo to the svn:ignore property is still not correct, because foo might already be covered, and we don't like generating unnecessary changes
4. The user may not have the proper permissions for cp -p (this could be worked around)
5. It breaks down if foo is a directory

Also, removing the directory and regenerating it from a previous version doesn't work either, because SVN doesn't restore permissions, ownership, timestamps. Moreover, directories can contain pipes -- this is not a problem for svn if you duly svn:ignore them, but any scheme based on removing/restoring or copying just won't work.

Please implement a --keep switch to go along with 'svn delete'. For files it should be real easy, for directories it's a bit more involved, but it serves a very real and legitimate need, and I see no reasonably easy way to do it with a shell script.

Also adding a --keepandignore switch that would also add foo to the svn:ignore property of the containing directory (if it's not already covered!), would be the icing on the cake.

Actually, that same intelligent ignore functionality would be useful in its own right, something like 'svn ignore PATH...'.

Hans

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Oct 27 18:28:01 2006

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.