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

Re: Creating copies using "svn cp" preserving directory structure

From: Ryan Schmidt <subversion-2005_at_ryandesign.com>
Date: 2005-06-23 14:37:21 CEST

On 23.06.2005, at 11:31, Holger Rauch wrote:

> I am trying to create a tag using "svn cp" (Subversion 1.1.4)
> consisting not of the entire trunk (HEAD revision) of a project,
> but rather only certain subdirectories. My sample project looks
> like this:
>
> tag-test
> |--> trunk
> |--> betra
> |--> 1.0.1 (contains "blah.sql", "blubber.sql")
> |--> 1.0.2 (contains "create-tables.sql","insert-
> rows.sql")
> |...
> |--> las
> |--> 2.8.5 (contains "create-tables.sql","insert-
> rows.sql")
> |--> 2.8.6 (contains "create-laslala.sql","insert-
> rows.sql")
> |--> 2.8.7 (contains "create-table3.sql","insert-
> rows3.sql")
> |...
> |--> tags
> |--> branches
>
> What I want to achieve is something similar to what's shown in the
> following example:
> [trunk omitted for better readability]
>
> tag-test
> |--> tags
> |--> TEST-TAG
> |--> betra
> |--> 1.0.2 (contains file mentioned above)
> |--> las
> |--> 2.8.7 (contains file mentioned above)
>
> (That is, I want to preserve the directory structure within the
> corresponding tags subdir)
>
> Whenever I tried using "svn cp" with the URL -> URL syntax like this
>
> svn cp -m "Creating sample tag" $SVNROOT/tag-test/trunk/betra/1.0.2
> $SVNROOT/tag-test/tags
>
> (SVNROOT is an environment variable containing the constant part of
> the URL,
> i. e. the path to the repository)
>
> I ended up with the files in betra/1.0.2
> ("create-tables.sql","insert-rows.sql") being directly placed below
> TEST-TAG
> (without the "betra/1.0.2" subdirs).
>
> How can I preserve directory structure when creating copies?

Well, you don't, or rather, Subversion won't do that for you. You can
do it manually in steps, first creating the directory in tags, then
creating the "betra" directory inside it, then copying trunk/betra/
1.0.2 into that, then creating the "las" directory within the tag
directory, then copying trunk/las/2.8.7 into that. Untested, but
theoretically something like this:

svn mkdir $SVNROOT/tags/mytag
svn mkdir $SVNROOT/tags/mytag/betra
svn cp $SVNROOT/betra/1.0.2 $SVNROOT/tags/mytag/betra
svn mkdir $SVNROOT/tags/mytag/las
svn cp $SVNROOT/las/2.8.7 $SVNROOT/tags/mytag/las

This will use up several (here, 5) revisions in the process and is,
as you see, not straightforward. From this you should infer that this
is not how you're supposed to do it.

Your directory structure looks odd to me. What are these version
directories in "betra" and "las"? Are they tags (or possibly vendor
drops?) of "betra" and "las"? If so, that's not how it's intended to
be used.

On the other hand... since you're showing SQL files in these
directories... perhaps the files in e.g. betra/1.0.2 are the SQL
changes needed to get from version 1.0.1 to version 1.0.2 of "betra"?
If that's what you're doing, then I'd suggest that you do in fact tag
the entire trunk directory. It's not as though this will take up
large amounts of disk space, and it will make your tags mesh with
everyone else's definition of a Subversion tag (that is: a copy of
trunk at a particular point [or, in the case of a mixed-revision tag,
points] in time).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Jun 23 14:42:34 2005

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