You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Giovanni Mesturini <jo...@yahoo.it> on 2006/02/07 13:09:55 UTC
Adding files to CVS with Ant
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}:${cvs-password}@intr-iol-cvs.bancaintesa.it: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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Adding files to CVS with Ant
Posted by Andrew Goktepe <an...@gmail.com>.
Is the new file in a directory that is also new? The cvs add command is not
recursive; you will need to add any new directories first.
Try doing the add and commit of the same file manually on the command line
and see if you get an error that way too. If so, then this is not a problem
with Ant.
-Andrew
On 2/7/06, Giovanni Mesturini <jo...@yahoo.it> 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}:${cvs-password}@intr-iol-cvs.bancaintesa.it: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: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
Re: *****spam***** Adding files to CVS with Ant
Posted by Giovanni Mesturini <jo...@yahoo.it>.
I found the problem. The problem is that I was
attemping to upload a file in a tagged branch, checked
out like a readonly release. My fault, I'm sorry. If
you checkout a readonly release from CVS you must have
an alternative branch to commit in.
Now I have succesfully solved this problem, but others
found instead. So I have to make some test before ask
more help. ;-)
--- Geoffrey Mitchell <ga...@imail.kwcorp.com> ha
scritto:
> 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}:${cvs-password}@intr-iol-cvs.bancaintesa.it: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:
> user-unsubscribe@ant.apache.org
> >For additional commands, e-mail:
> user-help@ant.apache.org
> >
> >
> >
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
>
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: *****spam***** Adding files to CVS with Ant
Posted by Geoffrey Mitchell <ga...@imail.kwcorp.com>.
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}:${cvs-password}@intr-iol-cvs.bancaintesa.it: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: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org