ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23981] New: - Perforce tasks handle 'force' option oddly
Date Tue, 21 Oct 2003 18:12:56 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23981>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23981

Perforce tasks handle 'force' option oddly

           Summary: Perforce tasks handle 'force' option oddly
           Product: Ant
           Version: 1.5.4
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: eric@timebytes.com


The p4sync task accepts a 'force="foo"' option that tells Perforce to *always* 
sync the content betweeen the local client and the repository.

Oddly enough, the task looks for the *presence* of the force option, *not* the 
content of the argument (true or false).

In other words, 

  <p4sync view="${syncRepositoryLoc}..." force="no" />

  <p4sync view="${syncRepositoryLoc}..." force="yes" />

do the same thing - they force the sync!


This makes it hard to code this functionality cleanly, since I would like 
prefer to do something like this:

  <p4sync view="${syncRepositoryLoc}..." force="${doP4Force}" />

With 'doP4Force' a property, set appropriately.

Sadly, I can't do this.

The ant/XML syntax rules won't let me do something like this:
  <property name="doP4Force" value="force=yes'" />
  <p4sync view="${syncRepositoryLoc}..." ${p4ForceArg}/>

So I'm left with an ugly workaround like:
set either

  <property name="p4ForceFlag" value="WithForce" />

or

  <property name="p4ForceFlag" value="" />

then, 
  <antcall target="syncToContent${p4ForceFlag}" />

which either invokes

  <target name="syncToContent">
        <p4sync view="${syncRepositoryLoc}..." />
  </target> <!-- syncToContent -->

or
  <target name="syncToContentWithForce">
       <p4sync view="${syncRepositoryLoc}..." force="yes" />
  </target> <!-- syncToContentWithForce -->


I recognize this change might break some existing scripts, but if you wanted
to maintain maximum backward compatibility, you could have it do a force for 
any non-false value, i.e.

       <p4sync view="${syncRepositoryLoc}..." force="yes" />
and
       <p4sync view="${syncRepositoryLoc}..." force="foo" />

both do a force, but

       <p4sync view="${syncRepositoryLoc}..." force="no" />

doesn't. This would minimize the amount of potential broken code.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message