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

Messed up WC after switch (SVN 1.2.3)

From: Matt Doran <matt.doran_at_papercut.biz>
Date: 2005-12-01 13:24:04 CET

Hi all,

I've been using svn daily for over a year ... but only been working with
branches more recently. Today I encountered a problem switching from a
feature branch back to trunk. The branch added a new subproject with
it's own build output (that was svn:ignore'd). After committing my
work I tried to 'switch' back to trunk that's when the trouble started.
Although I originally encountered this using the latest TSVN release, I
have been able to reproduce it using svn 1.2.3 on Debian (repro recipe
attached).

The switch fails with the unfriendly message:

    svn: Won't delete locally modified directory '.'
    svn: Left locally modified or unversioned files

That really confused me. For one the '.' indicated that the current
directory was the modified (when it wasn't), but in fact the problem was
deeper down. Not knowing what the problem was I tried a number of
things to fix (try switching again, try switching back, revert, update,
cleanup, etc) .... nothing worked. And the errors got worse ...

        svn: Working copy '<foldername>' is missing or not locked

I eventually figured out that the problem was due to some unversioned
and ignored files in the new subproject on the branch. And I don't
remember how I fix the WC .... but it wasn't obvious.

I've attached a recipe that reproduces this problem (and my unhelpful
attempts to clean things up). I've also attached the output of the script.

Could someone explain how I could avoid this situation in the future....
and resolve it if it happens again?

Should this be raised as an issue? In the very least the initial error
that is displayed could be improved to make it clearer what went wrong,
and how to fix.....

Cheers,
Matt

$ switch-repro.sh
1.2.3

Committed revision 1.
Checked out revision 1.

Committed revision 2.
At revision 2.
A subproj
A subproj/src.c
property 'svn:ignore' set on 'subproj'
Adding subproj
Adding subproj/src.c
Transmitting file data .
Committed revision 3.
svn: Won't delete locally modified directory '.'
svn: Left locally modified or unversioned files
try reverting ... nope
try updating ... nope
svn: Working copy 'subproj' is missing or not locked
try switching again ... nope
svn: Working copy 'subproj' is missing or not locked
try switching back ... nope
svn: Working copy 'subproj' is missing or not locked
delete offending dir ... now I am in real trouble
and the switch still fails
svn: Working copy 'subproj' is missing or not locked
try cleanup ... this does not help
svn: 'subproj' is not a working copy directory
$

#!/bin/sh

svn --version -q

svnadmin create repo

# Create a project
REPO=file://`pwd`/repo
svn mkdir $REPO/trunk -m "create trunk"
svn co $REPO/trunk wc

cd wc

# Create a branch where we are adding a new subproject
svn copy $REPO/trunk $REPO/branch -m "create branch"

# Start working on a new branch
svn switch $REPO/branch

# Create a new subproject
mkdir subproj
echo source > subproj/src.c
svn add subproj

# Simulates creating build output
mkdir subproj/build-output
svn ps "svn:ignore" build-output subproj

svn commit -m "add new subproject"

# Switch back to trunk ... boom
svn switch $REPO/trunk

# At this point the working copy is stuffed, try various fixes
echo try reverting ... nope
svn revert .

echo try updating ... nope
svn up

echo try switching again ... nope
svn switch $REPO/trunk

echo try switching back ... nope
svn switch $REPO/branch

echo delete offending dir ... now I am in real trouble
rm -Rf subprj/build-output

echo and the switch still fails
svn switch $REPO/trunk

echo try cleanup ... this does not help
svn cleanup

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Dec 1 13:26:36 2005

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.