Article View: comp.lang.java.softwaretools
Article #62ANT and CVS add
From: Stephan Raemy
Date: Mon, 17 Feb 2003 18:45
Date: Mon, 17 Feb 2003 18:45
69 lines
3276 bytes
3276 bytes
Hey y'all,
In my ANT script, I'm trying to add new files to a project existing in
the CVS repository. The amount of new files and where they'll reside in
the subdirectories of the project is not predictable (using JAXP,
building javadoc, etc.).
Here's my problem. Cederqvist's CVS manual [http://www.cvshome.org/]
states clearly that the add command is NOT recursive, which means that i
always have to be in the subdirectory where my file resides in order to
execute the cvs add command:
Wrong (Example Cederqvist):
# cvs add foo/bar
Correct:
# cd foo
# cvs add bar
Doesn't ANT support recursive adding of files (even in directories which
don't exist in the repository)? Can't it find out on its own?
I tried to sort of make a diff between the repository and my local
project. And then pass it to the CVS task.
<project name="foo" basedir=".">
<!-- ... -->
<target name="cvs-addNewFiles">
<cvs command="cvs -q diff -u -N" output="o.txt"/>
<!-- here, i might have to filter the o.txt file. Let's be
optimistic and say the output of the diff consisted only
of files to add. -->
<replaceregexp file="o.txt" match="^\?" replace="" byline="true"/>
<loadfile property="toBeAdded" srcFile="o.txt">
<filterchain>
<!-- Get rid of carriage returns. -->
<striplinebreaks/>
</filterchain>
</loadfile>
<cvs command="add">
<parameter>${tobeAdded}</parameter>
</cvs>
<!-- Commit comes later. -->
</target>
<!-- ... -->
</project>
But unfortunately, it didn't work. The algorithm would probably look
something like this:
while (o.txt is not empty after "cvs -q -u -N > o.txt") do
remove all lines in o.txt not identifying a new file/dir to be added;
add the file/dir to CVS repos;
end do;
commit;
Any ideas?
########################################################
We make a living by what we get,
but we make a life by what we give.
(Sir Winston Churchill)
########################################################
Technical Details
Message-ID:
<3E512DC7.4030004@swissonline.ch>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!peer.news.opaltelecom.net!zen.net.uk!news.imp.ch!news.imp.ch!news-zh.switch.ch!news.swissonline.ch!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10c134,8e6f4d5a03ef784,start X-Google-Attributes: gid10c134,public X-Google-Thread: f5e83,8e6f4d5a03ef784,start X-Google-Attributes: gidf5e83,public X-Google-ArrivalTime: 2003-02-17 10:44:01 PST Message-ID: <3E512DC7.4030004@swissonline.ch> Date: Mon, 17 Feb 2003 19:45:27 +0100 From: Stephan Raemy <raemy.stephan@swissonline.ch> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.java.softwaretools,fa.info-cvs Subject: ANT and CVS add Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 217.162.127.143 X-Trace: news.swissonline.ch 1045507441 217.162.127.143 (17 Feb 2003 19:44:01 +0100) Lines: 70 X-Complaints-To: abuse@swissonline.ch Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!peer.news.opaltelecom.net!zen.net.uk!news.imp.ch!news.imp.ch!news-zh.switch.ch!news.swissonline.ch!not-for-mail