From 4db617fc7d61cd74d547cb34b5924bfaf7c92bf2 Mon Sep 17 00:00:00 2001 From: Antoine Levy-Lambert Date: Thu, 15 Jan 2004 20:27:07 +0000 Subject: [PATCH] Add two new attributes in p4submit : needsresolveproperty and changeproperty PR: 25711 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275924 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 ++ docs/manual/OptionalTasks/perforce.html | 25 ++++++++++++-- .../optional/perforce/changerenumbered.xml} | 2 +- .../optional/perforce/needsresolve.xml} | 9 +++-- .../taskdefs/optional/perforce/P4Submit.java | 34 +++++++++++++++++-- 5 files changed, 64 insertions(+), 9 deletions(-) rename src/{testcases/org/apache/tools/ant/taskdefs/optional/perforce/build1.xml => etc/testcases/taskdefs/optional/perforce/changerenumbered.xml} (93%) rename src/{testcases/org/apache/tools/ant/taskdefs/optional/perforce/build2.xml => etc/testcases/taskdefs/optional/perforce/needsresolve.xml} (84%) diff --git a/WHATSNEW b/WHATSNEW index 772432468..537b7589a 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -38,6 +38,9 @@ Other changes: * has a new attribute - fixlast. Bugzilla Report 23262. +* has 2 new attributes, needsresolveproperty and changeproperty. + Bugzilla Report 25711. + Changes from Ant 1.5.4 to Ant 1.6.0 =================================== diff --git a/docs/manual/OptionalTasks/perforce.html b/docs/manual/OptionalTasks/perforce.html index b6ef18663..8e5edf632 100644 --- a/docs/manual/OptionalTasks/perforce.html +++ b/docs/manual/OptionalTasks/perforce.html @@ -9,9 +9,8 @@
  • Les Hughes (leslie.hughes@rubus.com)
  • Kirk Wylie (kirk@radik.com)
  • Matt Bishop (matt@thebishops.org)
  • -
  • Antoine Levy-Lambert (levylambert@tiscali-dsl.de)
  • +
  • Antoine Levy-Lambert
  • -

    Version $Revision$ - $Date$


    Contents

      @@ -330,6 +329,20 @@ is not the latest any more. The changelist number to submit Yes + + changeproperty + Name of a property to which the new change number + will be assigned if the Perforce server renumbers the change
      + Since ant 1.6.1 + No + + + needsresolveproperty + Name of property which will be set to true + if the submit requires a resolve
      + Since ant 1.6.1 + No +

      Examples

      @@ -959,9 +972,15 @@ P4Resolve does not use a change list number (it takes it from the files it is wo Changed p4submit (detection of changes of change numbers, and of failed submits due to resolution needed) + + Jan 2004 + ant 1.6.1 + +Changed p4submit, needsresolveproperty and changeproperty added +
      -

      Copyright © 2001-2003 Apache Software Foundation. All rights +

      Copyright © 2001-2004 Apache Software Foundation. All rights Reserved.

      diff --git a/src/testcases/org/apache/tools/ant/taskdefs/optional/perforce/build1.xml b/src/etc/testcases/taskdefs/optional/perforce/changerenumbered.xml similarity index 93% rename from src/testcases/org/apache/tools/ant/taskdefs/optional/perforce/build1.xml rename to src/etc/testcases/taskdefs/optional/perforce/changerenumbered.xml index b313b87cd..d62c8fd1b 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/optional/perforce/build1.xml +++ b/src/etc/testcases/taskdefs/optional/perforce/changerenumbered.xml @@ -1,4 +1,4 @@ - + diff --git a/src/testcases/org/apache/tools/ant/taskdefs/optional/perforce/build2.xml b/src/etc/testcases/taskdefs/optional/perforce/needsresolve.xml similarity index 84% rename from src/testcases/org/apache/tools/ant/taskdefs/optional/perforce/build2.xml rename to src/etc/testcases/taskdefs/optional/perforce/needsresolve.xml index abc1eae28..629c1836f 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/optional/perforce/build2.xml +++ b/src/etc/testcases/taskdefs/optional/perforce/needsresolve.xml @@ -1,11 +1,11 @@ - + - + @@ -40,14 +40,17 @@ doing a change ${change} on client ${p4.client} + hello ${p4.client} ${change} - + p4.needsresolve ${p4.needsresolve} after submit + needsresolveproperty ${needsresolve} after submit + changeproperty ${mychange} after submit \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java index 1baad54ea..c1bf3984e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2003 The Apache Software Foundation. All rights + * Copyright (c) 2000-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -83,7 +83,14 @@ public class P4Submit extends P4Base { * change list number */ public String change; - + /** + * change property + */ + private String changeProperty; + /** + * needsresolveproperty + */ + private String needsResolveProperty; /** * set the change list number to submit * @param change The changelist number to submit; required. @@ -91,6 +98,23 @@ public class P4Submit extends P4Base { public void setChange(String change) { this.change = change; } + /** + * property defining the change number if the change number gets renumbered + * @param changeProperty name of a new property to which the change number + * will be assigned if it changes + * @since ant 1.6.1 + */ + public void setChangeProperty(String changeProperty) { + this.changeProperty = changeProperty; + } + /** + * property defining the need to resolve the change list + * @param needsResolveProperty a property which will be set if the change needs resolve + * @since ant 1.6.1 + */ + public void setNeedsResolveProperty(String needsResolveProperty) { + this.needsResolveProperty = needsResolveProperty; + } /** * do the work @@ -133,6 +157,9 @@ public class P4Submit extends P4Base { int changenumber = Integer.parseInt(chnum); log("Perforce change renamed " + changenumber, Project.MSG_INFO); getProject().setProperty("p4.change", "" + changenumber); + if (changeProperty != null) { + getProject().setNewProperty(changeProperty, chnum); + } found = false; } if (((myarray.elementAt(counter))).equals("renamed")) { @@ -148,6 +175,9 @@ public class P4Submit extends P4Base { } if (util.match("/p4 submit -c/", line)) { getProject().setProperty("p4.needsresolve", "1"); + if (needsResolveProperty != null) { + getProject().setNewProperty(needsResolveProperty, "true"); + } } }