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

svn switch with externals leaves working copy in an inconsistent state

From: Robert Wruck <wruck_at_tweerlei.de>
Date: Thu, 25 Apr 2013 12:47:15 +0200


I just came across this issue. Assume we have two branches:
branches/A where a particular subdir exists
branches/B where this subdir was replaced by an svn:externals entry

Steps to create:

svn mkdir --parents $REPO_URL/trunk/main/external/subdir -m "Create main"

svn mkdir --parents $REPO_URL/trunk/external/subdir -m "Create external"

svn mkdir --parents $REPO_URL/branches -m "Create branches"

svn cp $REPO_URL/trunk $REPO_URL/branches/A -m "Without externals"

svn rm $REPO_URL/trunk/main/external -m "Remove subdir"

svn co $REPO_URL/trunk/main; cd main

svn propset svn:externals "external $REPO_URL/trunk/external" .

svn commit -m "Replace subdir with external"

svn cp $REPO_URL/trunk $REPO_URL/branches/B -m "With externals"

Now try to switch between these two branches.
First switch is no problem:

svn switch $REPO_URL/branches/A/main
-> 7

Second switch is .. interesting.
The working copy appears "switched" but isn't:

svn switch $REPO_URL/branches/B/main
-> 7S
svn st
-> X external

Now switch back:

svn switch $REPO_URL/branches/A/main
-> Skipped 'external' -- An obstructing working copy was found
-> Removed external 'external'

The "external" subdir is gone now.. but svn update brings it back and
everything looks good:

svn up
-> A external
-> E external/subdir
-> 7

So there are two problems:

1) When switching from a WC with externals to a WC without externals,
the externals (even though to be removed) prevent a full update.

2) When switching from a WC without externals to a WC with externals,
the WC is inconsistent afterwards. The "switched" state remains and
additional commits introduce mixed revisions, preventing e.g. merges:

touch testfile
svn add testfile
svn commit -m "Add testfile"
svn up
-> 7:8S

The only way to avoid this ist to switch with --ignore-externals and
update afterwards:

svn switch $REPO_URL/branches/A/main
svn up
svn switch $REPO_URL/branches/B/main --ignore-externals
svn up
-> 8

Is this a known issue?

svn --version
-> svn, Version 1.7.9 (r1462340)

Received on 2013-04-27 02:49:45 CEST

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