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

svn switch to an incorrect branch deletes modified local files

From: Aaron Eppolito <aarone_at_apple.com>
Date: Wed, 23 Apr 2008 16:26:31 -0700

I've posed this warning on Apple's internal svn mailing list and a few
folks have suggested I file it as a bug. It seems policy is to bring
it up in this forum first. I've searched through the bugs and the
~950 matches on "switch" on this list and haven't heard mention of the
problem.

In very short summary, if you inadvertently switch a subdirectory to a
branch/tag/head of the root level, it will DELETE all files in the
subdirectory, INCLUDING locally modified files.

A concrete example:

[myproject/Subdirectory/Files]% svn stat
M file1.cpp

[myproject/Subdirectory/Files]% svn switch https://svnserver/myproject/trunk
D file1.cpp
D file2.cpp
D file3.h
A //// the entire trunk's directory structure...

I understand that what I should have done was this:
[myproject/Subdirectory/Files]% svn switch https://svnserver/myproject/trunk/Subdirectory/Files

That said, svn has enough information to know that switching to a new
working copy rooted in the current directory is not the right thing.
It should have warned, saying something like "This directory does not
correspond to https://svnserver/myproject/trunk".

At the very least, it shouldn't be deleting files with modifications!
Thankfully, I still had these open in an editor so I was able to save
them to a new location, but otherwise, I would have lost all my local
changes.

-Aaron

On Apr 22, 2008, at 11:54 AM, Matt Ackeret wrote:
> write up a bug?

On Apr 22, 2008, at 3:24 PM, Stephen Davis wrote:

> If you switch to something with the same hierarchical layout, then
> svn switch won't touch your modified files. Unfortunately, as you
> discovered, the same does not hold true if the local files do not
> exist in the new hierarchy being laid down.
>
> I hope you filed a ticket with the Subversion team -- I'm sure they
> would treat data loss as an issue worth fixing.
Received on 2008-04-24 01:39:38 CEST

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