You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Josef Wolf <jw...@raven.inka.de> on 2009/03/03 19:29:20 UTC
How to integrate an svn:external into the parent repository?
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
)
Re: How to integrate an svn:external into the parent repository?
Posted by Josef Wolf <jw...@raven.inka.de>.
On Wed, Mar 04, 2009 at 01:50:04AM -0600, Ryan Schmidt wrote:
> On Mar 3, 2009, at 13:29, Josef Wolf wrote:
>
>> 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
>
> Yes, that's this bug:
>
> http://subversion.tigris.org/issues/show_bug.cgi?id=2371
Thanks for your answer, Ryan!
I'm not sure. The bug talks about externals being processed later.
But the externals directory is not removed at all.
>> The problem is that I have lots of working copies which are updated
>> automatically, so I need an automated way to resolve the situation.
>
> Remove the external directory first.
>
> rm -rf /path/to/ext
>
> Then you can "svn up" to get the new versioned one from the repository.
I know I can do that on a working copy that is used interactively. But
for automatically updated WC's, this is not really an option. Especially,
since there are lots of such wc's.
I'd rather checkin some intermediate revision to make sure the update
goes seamless. For example, I could put something like
rm -rf ext
svn up
in the script that does the automatic update and remove those two lines
again in the next revision. Since this script is part of the repository,
it would fix the problem. But then, how do I make sure that this specific
revision is checked out and run _exactly_ once on every wc?
Re: How to integrate an svn:external into the parent repository?
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 3, 2009, at 13:29, Josef Wolf wrote:
> 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
Yes, that's this bug:
http://subversion.tigris.org/issues/show_bug.cgi?id=2371
> The problem is that I have lots of working copies which are updated
> automatically, so I need an automated way to resolve the situation.
Remove the external directory first.
rm -rf /path/to/ext
Then you can "svn up" to get the new versioned one from the repository.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1265574
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].