<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- author Antoine Levy-Lambert -->
<!-- this test shows that p4 submit can now indicate that a file needs to be resolved -->
<!-- before running the test, edit this xml and change the 5 properties at the top to values which make sense on your system-->
<!-- the test uses two Perforce client specs which must exist beforehand -->
<!-- also using both client specs you should be able to edit the file ${depot_file_spec} -->
<project name="testresolve" default= "test">
  <property name="first_client" value="levyant_dev_ant"/>
  <property name="first_client_root" value="C:\dev\depot"/>
  <property name="second_client" value="levyant_cygwin_test"/>
  <property name="second_client_root" value="C:\dev\test"/>
  <property name="depot_file_spec" value="//depot/foobar"/>
  <target name="test">
    <p4change client="${first_client}"/>
    <property name="change1" value="${p4.change}" />
    <p4change client="${second_client}"/>
    <property name="change2" value="${p4.change}" />
    <sequential>
      <antcall target="edit">
	<param name="p4.client" value="${first_client}"/>
	<param name="client_root" value="${first_client_root}"/>
	<param name="change" value="${change1}"/>
      </antcall>
      <antcall target="edit">
	<param name="p4.client" value="${second_client}"/>
	<param name="client_root" value="${second_client_root}"/>
	<param name="change" value="${change2}"/>
      </antcall>
      <antcall target="submit">
	<param name="p4.client" value="${first_client}"/>
	<param name="change" value="${change1}"/>
      </antcall>
      <antcall target="submit">
	<param name="p4.client" value="${second_client}"/>
	<param name="change" value="${change2}"/>
      </antcall>
    </sequential>
  </target>
  <target name="edit">
    <echo>
doing a  change ${change} on  client ${p4.client}
</echo>
    <p4edit change="${change}" view="${depot_file_spec}"/>
    <mkdir dir="${client_root}/depot"/>
    <echo file="${client_root}/depot/foobar">
hello ${p4.client} ${change}
</echo>
  </target>
  <target name="submit">
    <p4submit change="${change}" needsresolveproperty="needsresolve" changeproperty="mychange"/>
    <echo>
p4.needsresolve ${p4.needsresolve} after submit
        needsresolveproperty ${needsresolve} after submit
        changeproperty ${mychange} after submit
</echo>
  </target>
</project>