I had problems with this too. I think what is happening is that it is
trying to add your files in a directory called cvs-local/test-module,
which doesn't exist in cvs, so it is failing, which is good, because
this isn't what you want anyway. If you were going to do this from the
command line, you would "cd cvs-local/test-module" then run your cvs
command from there. My case is somewhat different, as my ${basedir} is
checked out from my cvs repository. It sounds like yours is not. My
problem ended up being that I was specifying full paths to the files to
add, and I needed to instead make them relative to ${basedir}. In
your case, you want the files you are adding to be relative to
${cvs-local-dest}/${cvs-module}. If I understand correctly, you should
be able to do this by setting the dest attribute on the cvs task, e.g.
"dest=${cvs-local-dest}/${cvs-module}", then exclude the path from the
file name in your add command. I'm not positive that this will work,
but maybe it will give you some ideas of the direction to start looking in.
Giovanni Mesturini wrote:
Scenario:
I have to add a file to CVS from client to server
using an Ant script.
This is my build.xml:
...
<property name="cvs-username" value="username" />
<property name="cvs-password" value="password" />
<property name="cvs-repository"
value=":pserver:${cvs-username}:[EMAIL PROTECTED]:2402/cvs/cvsnch"
/>
<property name="cvs-module" value="test-module"/>
<property name="cvs-local-dest" value="cvs-local"/>
<property name="file-to-be-added"
value="dummy.java"/>
...
<target name="add-file">
<!-- Do a checkout first - IT WORKS -->
<cvs command="checkout" cvsRoot="${cvs-repository}"
package="${cvs-module}" dest="${cvs-local-dest}"
error="error.txt" output="output.txt"/>
<!-- Copy the files to be added in the directory
just checked out - IT WORKS -->
<copy todir="${cvs-local-dest}/${cvs-module}">
<fileset dir=".">
<include name="${file-to-be-added}"/>
</fileset>
</copy>
<!-- Add the file just copied to repository - IT
DOES NOT WORK -->
<cvs command="add
${cvs-local-dest}/${cvs-module}/${file-to-be-added}"
cvsRoot="${cvs-repository}" package="${cvs-module}"
error="error.txt" output="output.txt"/>
<!-- Commit the add - IT DOES NOT WORK -->
<cvs command="commit
${cvs-local-dest}/${cvs-module}/${file-to-be-added}"
cvsRoot="${cvs-repository}" package="${cvs-module}"
error="error.txt" output="output.txt"/>
</target>
...
Ant outputs:
Buildfile: build.xml
add-file:
BUILD SUCCESSFUL
Total time: 0 seconds
But in "error.txt" file I find this message:
cvs add: in directory .:
cvs [add aborted]: there is no version here; do 'cvs
checkout' first
...and nothing is done: the file is missing on rep.
Where I'm doing wrong?
Thanks
Jo
___________________________________
Yahoo! Messenger with Voice: chiama da PC a telefono a tariffe esclusive
http://it.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]