You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Matt Madrid <ad...@gmail.com> on 2007/07/13 00:07:07 UTC

Copy directory non-recursively

Is there any way to copy a directory.. but not it's contents .. from
one place to another.

Take this structure:

trunk/
  stuff/
     file1
     file2
     file3

The following command...

  svn cp trunk/stuff branches/branch1/

...will of course result in the stuff directory and all of it's
contents to be copied recursively. But what if I want only certain
files in stuff to be copied, so that I end up with a branch like this:

branches/
   branch1/
          stuff/
              file1

How do I do that? I've tried this:

 svn cp trunk/stuff/file1 branches/branch1/

But that only copies the file to the top level of the branch, with no
directory creation.

Or this:

  svn cp trunk/stuff/file1 branches/branch1/stuff/

Which creates a file called stuff in the branch that is a copy of file1.

I suppose I could create the directory stuff manually with "svn
mkdir", but then I wouldn't have any history information kept. Also,
if the directories happened to be nested a few levels deep, I would
need to create each level manually(mkdir -p would be nice), again
losing all history information.

Any ideas? Am I missing something. Thanks..

Matt M.

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

Re: Re: Copy directory non-recursively

Posted by Matt Madrid <ad...@gmail.com>.
On 7/12/07, Srilakshmanan, Lakshman
<la...@police.vic.gov.au> wrote:
> Hi Matt,
>
> I don't quite understand why you would want to copy part of a
> trunk/stuff. I would copy all trunk/stuff and modify only the files I
> need.
>
> Be aware that if you copy and delete as described by Matthew Hannigan,
> and then try to merge your branch back to trunk, you may have
> undesirable results.
>

Well, we use branches as kind of "versions." There will rarely be a
time when we would merge branch changes into the trunk. Always from
the trunk to the branches (I know... not standard.. use tags... but
there realy is no difference).

I agree about the deleting after a copy, but that may be my only
option if I want to keep the history.

Matt

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

RE: Re: Copy directory non-recursively

Posted by "Srilakshmanan, Lakshman" <la...@police.vic.gov.au>.
Hi Matt,

I don't quite understand why you would want to copy part of a
trunk/stuff. I would copy all trunk/stuff and modify only the files I
need.

Be aware that if you copy and delete as described by Matthew Hannigan,
and then try to merge your branch back to trunk, you may have
undesirable results.

Thanks
Lakshman

-----Original Message-----
From: Matthew Hannigan [mailto:mlh@zip.com.au] 
Sent: Friday, 13 July 2007 11:50 AM
To: Matt Madrid
Cc: users@subversion.tigris.org
Subject: Re: Copy directory non-recursively

On Thu, Jul 12, 2007 at 05:07:07PM -0700, Matt Madrid wrote:
> Is there any way to copy a directory.. but not it's contents .. from 
> one place to another.
> 
> Take this structure:
> 
> trunk/
>  stuff/
>     file1
>     file2
>     file3
> 
> The following command...
> 
>  svn cp trunk/stuff branches/branch1/
> 
> ...will of course result in the stuff directory and all of it's 
> contents to be copied recursively. But what if I want only certain 
> files in stuff to be copied, so that I end up with a branch like this:
> 
> branches/
>   branch1/
>          stuff/
>              file1
> 
> How do I do that? I've tried this:
> 
> svn cp trunk/stuff/file1 branches/branch1/
> 
> But that only copies the file to the top level of the branch, with no 
> directory creation.
> 
> Or this:
> 
>  svn cp trunk/stuff/file1 branches/branch1/stuff/
> 
> Which creates a file called stuff in the branch that is a copy of
file1.
> 
> I suppose I could create the directory stuff manually with "svn 
> mkdir", but then I wouldn't have any history information kept. Also, 
> if the directories happened to be nested a few levels deep, I would 
> need to create each level manually(mkdir -p would be nice), again 
> losing all history information.
> 
> Any ideas? Am I missing something. Thanks..
> 

Copy it all and then delete what you don't want.
The space required will hardly be different due to SVN's COW behaviour.

Matt

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



=======================================================
The information contained in this email and any files attached may
be confidential information to the intended recipient and may be
the subject of legal professional privilege or public interest immunity.

If you are not the intended recipient, any use, disclosure or copying is
unauthorised.

If you have received this document in error please telephone 1300 307 082

*******************************************************************
This footnote also confirms that this email message has been swept
for the presence of computer viruses.
*******************************************************************

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


Re: Copy directory non-recursively

Posted by Matthew Hannigan <ml...@zip.com.au>.
On Thu, Jul 12, 2007 at 05:07:07PM -0700, Matt Madrid wrote:
> Is there any way to copy a directory.. but not it's contents .. from
> one place to another.
> 
> Take this structure:
> 
> trunk/
>  stuff/
>     file1
>     file2
>     file3
> 
> The following command...
> 
>  svn cp trunk/stuff branches/branch1/
> 
> ...will of course result in the stuff directory and all of it's
> contents to be copied recursively. But what if I want only certain
> files in stuff to be copied, so that I end up with a branch like this:
> 
> branches/
>   branch1/
>          stuff/
>              file1
> 
> How do I do that? I've tried this:
> 
> svn cp trunk/stuff/file1 branches/branch1/
> 
> But that only copies the file to the top level of the branch, with no
> directory creation.
> 
> Or this:
> 
>  svn cp trunk/stuff/file1 branches/branch1/stuff/
> 
> Which creates a file called stuff in the branch that is a copy of file1.
> 
> I suppose I could create the directory stuff manually with "svn
> mkdir", but then I wouldn't have any history information kept. Also,
> if the directories happened to be nested a few levels deep, I would
> need to create each level manually(mkdir -p would be nice), again
> losing all history information.
> 
> Any ideas? Am I missing something. Thanks..
> 

Copy it all and then delete what you don't want.
The space required will hardly be different due to SVN's COW behaviour.

Matt

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