Ant Copy Task and Hidden Files

R

russ.vanderwerff

I'm trying to copy a directory using the Ant "copy" task... the syntax
I'm using is below:

<copy todir="${buildDir}">
<fileset dir="."/>
</copy>

The problem I'm having is this: the folder is an SVN working copy, and
I need the destination to be an SVN working copy as well. However,
whenver I copy it with the Ant "copy" task, the hidden ".svn"
subdirectories (which SVN uses for its version control) are not copied
over. Does anyone know if there's any way to tell Ant to copy hidden
files and folders as well? I've been looking at the official
documentation here:

http://ant.apache.org/manual/index.html

but I can't seem to find anything.

Thanks!

Russ
 
Z

Zig

I'm trying to copy a directory using the Ant "copy" task... the syntax
I'm using is below:

<copy todir="${buildDir}">
<fileset dir="."/>
</copy>

The problem I'm having is this: the folder is an SVN working copy, and
I need the destination to be an SVN working copy as well. However,
whenver I copy it with the Ant "copy" task, the hidden ".svn"
subdirectories (which SVN uses for its version control) are not copied
over.

The .svn files are part of Ant's default excludes:

http://ant.apache.org/manual/CoreTasks/defaultexcludes.html

You should be able to include
<defaultexcludes remove="**/.svn/**"/>
inside your <fileset> (though I haven't tested this)

HTH,

-Zig
 
R

russ.vanderwerff

The .svn files are part of Ant's default excludes:

http://ant.apache.org/manual/CoreTasks/defaultexcludes.html

Thanks! I'd see that after some pushing into the ant source - I guess
it's in the documenation, too, and somehow I managed to miss it!
You should be able to include
<defaultexcludes remove="**/.svn/**"/>
inside your <fileset> (though I haven't tested this)

I ended up doing this:

<copy todir="${buildDir}">
<fileset dir="." defaultexcludes="no" />
</copy>

which I believe had the same effect.
HTH,

-Zig

Mission accomplished! A thousand thanks!

Russ
 
L

Lew

Thanks! I'd see that after some pushing into the ant source - I guess
it's in the documenation, too, and somehow I managed to miss it!


I ended up doing this:

<copy todir="${buildDir}">
<fileset dir="." defaultexcludes="no" />
</copy>

which I believe had the same effect.


Mission accomplished! A thousand thanks!

Isn't it bad for SVN to move its working-directory special files around? I'm
not so familiar with Subversion, but copying a working directory that way
defeats the whole point of version control, which is that all copying flows
through the repository.
 
J

Jean-Baptiste Nizet

Isn't it bad for SVN to move its working-directory special files around? I'm
not so familiar with Subversion, but copying a working directory that way
defeats the whole point of version control, which is that all copying flows
through the repository.

No. You may have multiple working copies of the same subversion
project on your disk if you want to. I don't know why it would be
useful, and why the OP wants that, but it's allowed and doesn't cause
any problem.
I've in fact done that once to make a demo of SVN usage to collegues:
they just had to consider that the first working copy was the one of
Alice, and the second working copy the one of Bob, Alice and Bob
working concurrently on the same project using SVN.

JB.
 
L

Lew

Jean-Baptiste Nizet said:
No. You may have multiple working copies of the same subversion
project on your disk if you want to. I don't know why it would be
useful, and why the OP wants that, but it's allowed and doesn't cause
any problem.
I've in fact done that once to make a demo of SVN usage to collegues:
they just had to consider that the first working copy was the one of
Alice, and the second working copy the one of Bob, Alice and Bob
working concurrently on the same project using SVN.

That doesn't answer my question.

I was asking about the direct copy of the directory, not about multiple
working directories.

Of course I'm familiar with having multiple working copies from version
control, only I use the v.c. product to create those copies. I am wondering
if it's safe to copy them without mediation by the v.c.
 
J

Jean-Baptiste Nizet

That doesn't answer my question.

I was asking about the direct copy of the directory, not about multiple
working directories.

Of course I'm familiar with having multiple working copies from version
control, only I use the v.c. product to create those copies. I am wondering
if it's safe to copy them without mediation by the v.c.

Yes, it's safe. You'll just have a second working copy, in exactly the
same state as the first one.
A SVN working copy is just a bunch of directories, each directory
having a .svn subdirectory which indicates where the directory comes
from (URL), the revision of each file it contains, the modifications/
additions/removals that have not yet been committed, etc. Copying the
directory to another location is perfectly safe.

JB.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top