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

Re: svn switch to an incorrect branch deletes modified local files

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 24 Apr 2008 02:37:00 +0200

On Wed, Apr 23, 2008 at 07:51:28PM -0400, Karl Fogel wrote:
> Aaron Eppolito <aarone_at_apple.com> writes:
> > 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...
> Yes, "D file1.cpp" will fly by in the output, but 'file1.cpp' is still
> there on disk -- it is preserved (as a now-unversioned file) precisely
> because it was in a modified state when still versioned.

That's the current behaviour, yes.

Note that the scenario involves a tree conflict. See use case 2:
Just replace "update" with "switch" and "move" with "deletion"
in that description, and you get the situation we're talking about.

Aaron, the corresponding issue in the tracker is:

We're working on this issue on a branch:
(But it's not yet the "desired behaviour" described in use-cases.txt
we're implenting.)

With svn from that branch, in your scenario, you should get a conflict
marked on the directory containing the file1.cpp, like this:

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

Then run 'svn info .' in the same directory, and it'll print a text
explaning the conflict that happened (the UI isn't polished yet).
The output of 'svn info .' should contain something like:

  Tree conflict:
  The update attempted to delete 'file1.cpp'
  (possibly as part of a rename operation).
  You have edited 'file1.cpp' locally.

(Note update equals switch -- the UI isn't polished yet :)

You won't be able to commit from that state until you've decided
what to about file1.cpp. You can then mark the conflict as resolved
(currently by running 'svn resolved myproject/Subdirectory/Files',
but this will likely still change a bit).

Note that this branch is *highly* experimental and should not be
used in production. But testing always helps, of course :)

Do you think this new behaviour will help you, once it's there?


Stefan Sperling <stsp_at_elego.de>                    Software Monkey
German law requires the following banner :(
elego Software Solutions GmbH                            HRB 77719
Gustav-Meyer-Allee 25, Gebaeude 12        Tel:  +49 30 23 45 86 96 
13355 Berlin                              Fax:  +49 30 23 45 86 95
http://www.elego.de                               CEO: Olaf Wagner
Store password unencrypted (yes/no)? No

  • application/pgp-signature attachment: stored
Received on 2008-04-24 02:37:04 CEST

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.