ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <step...@wanderinghorse.net>
Subject PATCH: cvs <commandline> implementation
Date Sun, 24 Mar 2002 23:37:19 GMT
Here we go, Erik, using refactoring instead of subclassing, as you suggested 
(and i'm pretty pleased with the results :).

Overview of changes:

Commandline:
- added createArgument( boolean insertAtStart ). createArgument() now calls 
createArgument( false ). This allows args to be inserted at the beginning of 
the args list (some Cvs flags need to be first in line, as do some rsync and 
webalizer args). i know this is backwards-compatible because i actually broke 
the Javac task while making this change, and had to fix it. i would like to 
add createArgument( int index ), but i'm not up for that much error handling 
this late at night ;).

AbstractCvsTask: (requires the above Commandline changes)
(all changes are backwards-compatible)
- Added property: compression={number 1-9 or boolean}. Adds -zN to the 
command line.
- "command-global" properties, like cvsRoot and compression are passed on to 
each command line.
- Refactoring to allow better re-use of Environment "global" Commandline 
prorties (like cvsRoot and cvsPackage).
- Cvs commands are now accepted in 3 different formats:
1) command='...'
2) character data (one cvs command per line).
3) <commandline> child elements.

An example shows it best:

<cvs failonerror='true' 
		compression='true'
		>
	<commandline>
		<argument value='update'/>
		<argument value='-r'/>
		<argument value='1.268'/>
		<!-- alternately, value='-rTAG', with no space.  -->
		<argument value='build.xml'/>
	</commandline>
	<commandline>
		<argument value='update'/>
		<argument value='-r'/> 
		<argument value='HEAD'/>
		<argument value='build.xml'/>
	</commandline>
	<commandline>
		<argument line='log -r1.5 build.xml'/>
	</commandline>
<![CDATA[
status src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
]]>
</cvs>

command=... is run first.
<commandline> is run second.
character data commands are run last.

command=... becomes optional if one of the other two forms are used, and 
defaults to 'checkout' (legacy behaviour) if no command-input method is used 
(in legacy terms, if no command is set). The command property is no longer 
ignored if character data is set (as it was in my last patch).

It is completely backwards-compatible with the AbstractCvsTask, it only adds 
new functionality. i find the legacy default behaviour odd (checkout? 
shouldn't it be update, if anything?).

The above xml, patch and output from the task is attached.

TODO(?): add 'outputfile=...' support for <commandline>?


A note about the Cvs task documentation:

It's a bit misleading in that it says, basically, that no arguments are 
needed and that command defaults to checkout. Checkout by itself won't work, 
though:
      [cvs] running cvs command: cvs -z3 checkout
      [cvs] cvs [checkout aborted]: must specify at least one module or 
directory

i would suggest changing the default command to null, but since that is 
likely to break at least one build.xml in userspace i would recommend 
changing it to update, which can succeed without more information and is 
backwards compatible except in the (rare?) case that someone is doing a full 
checkout at the start of a build.

----- stephan
Generic Universal Computer Guy
stephan@einsurance.de - http://www.einsurance.de
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
Student: "Master, you must teach me the way of liberation!"
Master:  "Tell me who it is that binds you."
Student: "No one binds me!"
Master:  "Then why do you seek liberation?"

Mime
View raw message