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

How to integrate an svn:external into the parent repository?

From: Josef Wolf <jw_at_raven.inka.de>
Date: Tue, 3 Mar 2009 20:29:20 +0100

Hello,

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.
Any ideas?

Here's the recipe to reproduce:

#! /bin/sh -ex

WORKDIR=/var/tmp/repostest
PARENT=$WORKDIR/parent
EXTERN=$WORKDIR/external

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
(
  cd 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
(
  cd parent-wc
  svn ps svn:externals "ext file://$EXTERN/trunk/ext" .
  svn ci -m "include external"
  svn up
)

# This reflects the situation as it is today.

# Now remove the svn:external definition from parent
#
(
  cd parent-wc
  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
(
  cd $PARENT-new-wc
  svn rm trunk
  svn ci -m "remove trunk from old external"
)

(
  cd parent-wc
  svn up # bails out since "ext" directory already exists
)
Received on 2009-03-03 20:31:27 CET

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.