You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Holger Rauch <ho...@heitec.de> on 2005/06/23 09:31:16 UTC

Creating copies using "svn cp" preserving directory structure

Hi!

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?

Unfortunately, I couldn't find any info on this issue in chapter 4 or
chapter 9 in the svn book.

Thanks in advance for any info!

Kind regards,

	Holger
               

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

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

Posted by Holger Rauch <ho...@heitec.de>.
Hi Ryan!

First of all, thanks a lot for yor quick and informative reply!

On Thu, 23 Jun 2005, Ryan Schmidt wrote:

> [...] 
> 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"?

Yes, that's what's meant. Sorry for not telling the entire story from the
very beginning. betra and las are in fact modules of a larger product having
their own version numbers (that is, those numbers are indepent of the
version number given to the entire product). So, what I want to achieve is
to create a dir structure representing the fact that e.g.

- the product is named "TEST1" (the tag name I used)
- it consists of
  - betra 1.0.2
  - las 2.8.7
  ... [additional modules and versions would follow] 

the SQL scripts in these directories are in fact update scripts that perform
updates to an already existing database schema. It should also be noted that
not all modules may always require an update thus a tag subdir is supposed
to only contain the module and the version that actually require an update.

The same tag name (TEST1) would be used for the sources so that it's possible
to associate a certain revision of the sources with the revision of the SQL
scripts needed to perform the database update. 

> If that's what you're doing, then I'd suggest that you do in fact tag  
> the entire trunk directory.
> [...]

I'm afraid this won't work for my purposes since tagging the entire trunk
dir gives me all modules along with all versions below tags. That's not what
I need. I only need module/version combos of some modules, not all of them.

Does that mean I would have to create one subdir for each module, like this

betra-update
 |--> trunk
 |--> tags
       |--> 1.0.1
       |--> 1.0.2
       |...
 |--> branches

las-update
 |--> trunk
 |--> tags
       |--> 2.8.6
       |--> 2.8.7
 |--> branches

etc.

This would be sort of awkward since it requires one project per module just
for storing SQL update scripts.

Or would it be better to simply store the update scripts in the same
projects that contain the sources (by simply using an "update-scripts"
directory), like this

las
 |--> trunk
        |--> src
        |--> ooad
        |--> test
 |--> tags
 |--> branches
 |--> update-scripts

Any advice will be greatly appreciated! Thanks in advance!

Greetings,

	Holger

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

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

Posted by Ryan Schmidt <su...@ryandesign.com>.
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