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

Re: Why --force with mv?

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2004-12-21 04:00:01 CET

On Dec 20, 2004, at 6:49 PM, Anthony Shipman wrote:

> On Tuesday 21 December 2004 01:17, Ben Collins-Sussman wrote:
>> On Dec 19, 2004, at 10:19 PM, Anthony Shipman wrote:
>>> If I try to rename a file with 'svn mv' and it has been modified then
>>> I get a
>>> message like
>>>
>>> svn: Use --force to override this restriction
>>> svn: Move will not be attempted unless forced
>>> svn: 'LDAPIf.h' has local modifications
>>>
>>> What am I being protected from here? Is there some risk to the
>>> version
>>> tree or
>>> am I being protected from doing something dumb?
>>
>> Subversion doesn't have true moves. 'svn mv' == 'svn cp; svn rm'.
>>
>> If you try to 'svn rm' a modified file, you'll get the same warning.
>> Subversion does everything it can to avoid destroying unversioned
>> data.
>> So both 'svn rm' and 'svn mv' ask you to --force any deletion that
>> would do so.
>>
>
> Does this mean that 'svn mv' destroys data or that it's not smart
> enough to
> realise that the 'svn cp' part has saved it?
>

I don't understand the question.

If you run 'svn rm file --force', and the file has local edits, then
yes, the file is gone forever. The local edits have been destroyed,
because you used --force.

If you run 'svn cp file file2' before running the 'svn rm --force',
then the local edits aren't really destroyed, because they still live
on in file2.

When I say that 'svn mv' == 'svn cp; svn rm', I literally mean it. Go
look at the code for svn_client_move(). It *really* is exactly the
same as if you had typed the copy and delete commands instead. There's
no concept of "move" anywhere in the code. 'svn mv' is purely a
shortcut, a convenience for users.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Dec 21 04:03:51 2004

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.