I have a repository which integrates another repository via the
svn:externals property. Now I would like to integrate this external
directly into the parent repository. The actual integration seems
to be not really hard.
There's one catch, though: on working copies that were created before
the repositories were joined, the directory with the external repository
is left over. So adding the new path cannot be created and "svn up"
bails out with
svn: Failed to add directory 'ext': a versioned directory of the same
name already exists
The problem is that I have lots of working copies which are updated
automatically, so I need an automated way to resolve the situation.
Here's the recipe to reproduce:
#! /bin/sh -ex
mkdir -p $WORKDIR
cd $WORKDIR && rm -rf *
# Create some history for the external
svnadmin create external
svn mkdir -m "basic structure" file://$EXTERN/trunk
svn co file://$EXTERN/trunk external-wc
echo huhu >huhu
svn add huhu
svn ci -m "add a file"
svn mkdir ext
svn mv huhu ext
svn ci -m "move the file"
# Create parent and add the external to it
svnadmin create parent
svn mkdir -m "basic structure" file://$PARENT/trunk
svn co file://$PARENT/trunk parent-wc
svn ps svn:externals "ext file://$EXTERN/trunk/ext" .
svn ci -m "include external"
# This reflects the situation as it is today.
# Now remove the svn:external definition from parent
svn pd "svn:externals" .
svn ci -m "remove svn:externals setting"
# Now load external/trunk/ext to parent/trunk/ext. We mangle the paths
# with perl accordingly
svnadmin dump $EXTERN \
| svndumpfilter --quiet --drop-empty-revs include trunk \
| perl -pe 's=^(Node-(copyfrom-path|path)):\s+trunk/ext=$1: ext=' \
| perl -pe 's=^(Node-(copyfrom-path|path)):\s+trunk/=$1: external_trunk=' \
| svnadmin load --quiet --ignore-uuid --parent-dir trunk $PARENT
svn co file://$PARENT/trunk $PARENT-new-wc
svn rm trunk
svn ci -m "remove trunk from old external"
svn up # bails out since "ext" directory already exists
Received on 2009-03-03 20:31:27 CET