ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Quail <m...@cortexebusiness.com.au>
Subject Re: Does anyone have an example of CVS commit done with Ant?
Date Sat, 22 Mar 2003 04:46:17 GMT
Peter,

You shouldn't use an absolute reference to the file you want to check in (well, 
my guess is it wont' work, but your mileage may vary).

To help set you straight, the long story is this:
- think of the <cvs> task just like the cvs command-line client
   (in fact, <cvs> just invokes the cvs command-line client)
- normally, the "working directory" is the project's basedir
   (which itself is normally ".").
- The "working directory" is where cvs will be run from, it
   it is what the file arguments to cvs should be relative to
- You can change the "working directory" by setting the "dest"
   attribute on <cvs>. Eg:
   <cvs dest="../somehwere/relative" ... />
   or
   <cvs dest="c:/somewhere/absolute" ... />

So, to be even more plain, I'm guessing you have a directory layout like this:

c:\projects\dev\build\build.xml
c:\projects\dev\build\buildnumber.txt
c:\projects\dev\build\CVS\...

So, "build.xml" is your ant file, and the "c:\projects\dev\build\" is a 
directory that as already been "checked out" from CVS.

If you want to have a <cvs> task that checks in "buildnumber.txt", then put 
this in your build.xml:
  <project basedir="." .... >
  <target name="foo">
     <cvs command="commit buildnumber.txt" failonerror="true"/>
  </target>

and on the command line, do this:

$ cd c:\projects\dev\build
$ ant foo

Does that make sense?

Here are some more examples:

Example 2)
==========
c:\projects\dev\build.xml
c:\projects\dev\CVS\...
c:\projects\dev\build\buildnumber.txt
c:\projects\dev\build\CVS\...

In this case, you need to set the "working directory":

  <project basedir="." .... >
  <target name="foo">
     <cvs dest="./build/" command="commit buildnumber.txt" failonerror="true"/>
  </target>

$ cd c:\projects\dev
$ ant foo

Example 3)
==========
c:\projects\dev\build.xml
c:\elsewhere\buildnumber.txt
c:\elsewhere\CVS\...

In this case, you need to set the "working directory" to an absolute path:

  <project basedir="." .... >
  <target name="foo">
     <cvs dest="c:\elsewhere\" command="commit buildnumber.txt" 
failonerror="true"/>
  </target>

$ cd c:\projects\dev
$ ant foo

=Matt

Adelman Peter, NY wrote:
> Matt,
> Thanks so much for your input!! Trying to find documentation for this is
> challenging.
> Once more question...if the path to buildnumber.txt on my local drive is for
> example: c:\projects\dev\build would my commit need to reference the full
> path?  Continuing with the example from below:
> <cvs command="commit c:\projects\dev\build\buildnumber.txt"
> failonerror="true"/>
> Or does CVS already have a reference to this file, and all I need to to is
> tell it to commit the file?
> 
> Sorry to "beat a dead horse" but I don't really have much of an opportunity
> to test this.
> 
> -----Original Message-----
> From: Matt Quail [mailto:matt@cortexebusiness.com.au]
> Sent: Thursday, March 20, 2003 10:22 PM
> To: Ant Users List
> Subject: Re: Does anyone have an example of CVS commit done with Ant?
> 
> 
> 
>>So, from your example, if I wanted to just check it
>>buildnumber.txt, the command would be
>><cvs command="commit -m&quot; buildnumber.txt" failonerror="true"/>...?
> 
> 
> not quite. you would have to remove the -m&quot; bit. This is the minimum
> you 
> require:
> 
> <cvs command="commit buildnumber.txt" failonerror="true"/>
> 
> which is basically the same as doing this from the command line:
> 
> $ cvs commit buildnumber.txt
> 
> However, if you wanted to attach a cvs log message with that commit, you 
> usually do this from the command line:
> 
> $ cvs commit -m "this is the commit message" buildnumber.txt
> 
> There are two ways to encode this in XML/Ant (both are satisfactory):
> 
> <cvs command='commit -m "this is the commit message" buildnumber.txt' 
> failonerror="true"/>
> 
> <cvs command="commit -m &quot;this is the commit message&quot;
> buildnumber.txt" 
> failonerror="true"/>
> 
> 
> (the difference between the two is the use of ' " and &quot;)
> 
> =Matt
> 
> 
> 
>>-----Original Message-----
>>From: Matt Quail [mailto:matt@cortexebusiness.com.au]
>>Sent: Thursday, March 20, 2003 5:21 PM
>>To: Ant Users List
>>Subject: Re: Does anyone have an example of CVS commit done with Ant?
>>
>>
>>Here is an example for a real build file for doing a cvs commit
>>
>><cvs command="commit -m&quot;auto build increment&quot; buildnumber.txt"

>>failonerror="true"/>
>>
>>The workspace looks a little like this:
>>
>>./build.xml
>>./buildnumber.txt
>>./CVS/
>>
>>That is, it is run from an already-checked-out workspace (hence the CVS 
>>directory). That way, you don't need to specify the "package" attribute,
> 
> the
> 
>>command just runs "locally".
>>
>>Does that make sense?
>>
>>=Matt
>>
>>Peter Adelmann wrote:
>>
>>
>>>Hi!
>>>
>>>Does anyone have an example of committing a file to CVS?  I need to build
>>
>>a jar and then update CVS with the new jar file. It appears as though the
>>task would go something like this:
>>
>>
>>><property name="cvs.root" value="\\serverName\Projects"/>
>>>
>>><target name="checkinJar" depends="buildingJarFile" description="commits
>>
>>jar file">
>>
>>> <cvs cvsRoot="${cvs.root}" package="/new/jarFile.jar" command="commit"
>>
>>/>
>>
>>></target>
>>>
>>>Any ideas/corrections would be greatly appreciated..Thanks again...Peter
>>>
>>>
>>>
>>>
>>>
>>>---------------------------------
>>>Do you Yahoo!?
>>>Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
>>>
>>>
>>>---------------------------------
>>>Do you Yahoo!?
>>>Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>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
>>
>>
>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 



Mime
View raw message