Browse Source

config attribute added to set the location of a specific PVCS .cfg file

PR: 9752
Submitted by: Jon Dickinson (dickinson dot j at ucles dot org dot uk )


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274639 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
2f8193c6bb
3 changed files with 65 additions and 26 deletions
  1. +3
    -0
      WHATSNEW
  2. +11
    -0
      docs/manual/OptionalTasks/pvcstask.html
  3. +51
    -26
      src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java

+ 3
- 0
WHATSNEW View File

@@ -395,6 +395,9 @@ Bugzilla Report 19180.
if ejbjar has cmpversion="2.0" set if ejbjar has cmpversion="2.0" set
Bugzilla Reports 14707 and 14709. Bugzilla Reports 14707 and 14709.


* <pvcs> config attribute added to set the location of a specific PVCS .cfg file
Bugzilla Report 9752

Changes from Ant 1.5.2 to Ant 1.5.3 Changes from Ant 1.5.2 to Ant 1.5.3
=================================== ===================================




+ 11
- 0
docs/manual/OptionalTasks/pvcstask.html View File

@@ -22,6 +22,7 @@ by
<ul> <ul>
<li>Thomas Christensen (<a href="mailto:tchristensen@nordija.com">tchristensen@nordija.com</a>)</li> <li>Thomas Christensen (<a href="mailto:tchristensen@nordija.com">tchristensen@nordija.com</a>)</li>
<li>Don Jeffery (<a href="mailto:donj@apogeenet.com">donj@apogeenet.com</a>)</li> <li>Don Jeffery (<a href="mailto:donj@apogeenet.com">donj@apogeenet.com</a>)</li>
<li>Jon Dickinson (<a href="mailto:dickinson.j@ucles.org.uk">dickinson.j@ucles.org.uk</a>)</li>
</ul> </ul>
Version 1.1 - 2001/06/27<br> Version 1.1 - 2001/06/27<br>
<p>Problems with UNC pathnames and the use of () in paths are fixed and an updateonly <p>Problems with UNC pathnames and the use of () in paths are fixed and an updateonly
@@ -100,6 +101,16 @@ promotion group and with that label to be extracted.
<td VALIGN=TOP WIDTH="10%">No</td> <td VALIGN=TOP WIDTH="10%">No</td>
</tr> </tr>


<tr>
<td VALIGN=TOP WIDTH="12%">config</td>

<td VALIGN=TOP WIDTH="78%">path of a non default .cfg file.
Can be given absolute or relative to ant's base directory.
</td>

<td VALIGN=TOP WIDTH="10%">No</td>
</tr>

<tr> <tr>
<td VALIGN=TOP WIDTH="12%">force</td> <td VALIGN=TOP WIDTH="12%">force</td>




+ 51
- 26
src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java View File

@@ -81,12 +81,12 @@ import org.apache.tools.ant.types.Commandline;
* PVCS is a version control system * PVCS is a version control system
* developed by <a href="http://www.merant.com/products/pvcs">Merant</a>. * developed by <a href="http://www.merant.com/products/pvcs">Merant</a>.
* <br> * <br>
* Before using this tag, the user running ant must have access to the commands
* Before using this tag, the user running ant must have access to the commands
* of PVCS (get and pcli) and must have access to the repository. Note that the way to specify * of PVCS (get and pcli) and must have access to the repository. Note that the way to specify
* the repository is platform dependent so use property to specify location of repository. * the repository is platform dependent so use property to specify location of repository.
* <br> * <br>
* This version has been tested agains PVCS version 6.5 and 6.6 under Windows and Solaris. * This version has been tested agains PVCS version 6.5 and 6.6 under Windows and Solaris.
* *
* <b>19-04-2001</b> <p>The task now has a more robust * <b>19-04-2001</b> <p>The task now has a more robust
* parser. It allows for platform independant file paths * parser. It allows for platform independant file paths
@@ -107,6 +107,7 @@ import org.apache.tools.ant.types.Commandline;
* @author <a href="mailto:tchristensen@nordija.com">Thomas Christensen</a> * @author <a href="mailto:tchristensen@nordija.com">Thomas Christensen</a>
* @author <a href="mailto:donj@apogeenet.com">Don Jeffery</a> * @author <a href="mailto:donj@apogeenet.com">Don Jeffery</a>
* @author <a href="mailto:snewton@standard.com">Steven E. Newton</a> * @author <a href="mailto:snewton@standard.com">Steven E. Newton</a>
* @author <a href="mailto:dickinson.j@ucles.org.uk">Jon Dickinson</a>
*/ */
public class Pvcs extends org.apache.tools.ant.Task { public class Pvcs extends org.apache.tools.ant.Task {
private String pvcsbin; private String pvcsbin;
@@ -123,6 +124,7 @@ public class Pvcs extends org.apache.tools.ant.Task {
private String filenameFormat; private String filenameFormat;
private String lineStart; private String lineStart;
private String userId; private String userId;
private String config;
/** /**
* Constant for the thing to execute * Constant for the thing to execute
*/ */
@@ -199,7 +201,7 @@ public class Pvcs extends org.apache.tools.ant.Task {


// default pvcs project is "/" // default pvcs project is "/"
if (getPvcsproject() == null && getPvcsprojects().isEmpty()) { if (getPvcsproject() == null && getPvcsprojects().isEmpty()) {
pvcsProject = "/";
pvcsProject = "/";
} }


if (getPvcsproject() != null) { if (getPvcsproject() != null) {
@@ -226,14 +228,14 @@ public class Pvcs extends org.apache.tools.ant.Task {
tmp2 = new File("pvcs_ant_" + rand.nextLong() + ".log"); tmp2 = new File("pvcs_ant_" + rand.nextLong() + ".log");
log(commandLine.describeCommand(), Project.MSG_VERBOSE); log(commandLine.describeCommand(), Project.MSG_VERBOSE);
try { try {
result = runCmd(commandLine,
new PumpStreamHandler(fos,
result = runCmd(commandLine,
new PumpStreamHandler(fos,
new LogOutputStream(this, new LogOutputStream(this,
Project.MSG_WARN))); Project.MSG_WARN)));
} finally { } finally {
fos.close(); fos.close();
} }
if (result != 0 && !ignorerc) { if (result != 0 && !ignorerc) {
String msg = "Failed executing: " + commandLine.toString(); String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation()); throw new BuildException(msg, getLocation());
@@ -256,6 +258,11 @@ public class Pvcs extends org.apache.tools.ant.Task {
commandLine.clearArgs(); commandLine.clearArgs();
commandLine.setExecutable(getExecutable(GET_EXE)); commandLine.setExecutable(getExecutable(GET_EXE));


if(getConfig() != null && getConfig().length()>0)
{
commandLine.createArgument().setValue("-c" + getConfig());
}

if (getForce() != null && getForce().equals("yes")) { if (getForce() != null && getForce().equals("yes")) {
commandLine.createArgument().setValue("-Y"); commandLine.createArgument().setValue("-Y");
} else { } else {
@@ -338,18 +345,18 @@ public class Pvcs extends org.apache.tools.ant.Task {
if (index > -1) { if (index > -1) {
File dir = new File(f.substring(0, index)); File dir = new File(f.substring(0, index));
if (!dir.exists()) { if (!dir.exists()) {
log("Creating " + dir.getAbsolutePath(),
log("Creating " + dir.getAbsolutePath(),
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
if (dir.mkdirs()) { if (dir.mkdirs()) {
log("Created " + dir.getAbsolutePath(),
log("Created " + dir.getAbsolutePath(),
Project.MSG_INFO); Project.MSG_INFO);
} else { } else {
log("Failed to create "
+ dir.getAbsolutePath(),
log("Failed to create "
+ dir.getAbsolutePath(),
Project.MSG_INFO); Project.MSG_INFO);
} }
} else { } else {
log(dir.getAbsolutePath() + " exists. Skipping",
log(dir.getAbsolutePath() + " exists. Skipping",
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
} }
} else { } else {
@@ -367,7 +374,7 @@ public class Pvcs extends org.apache.tools.ant.Task {
} }
} }
} }


/** /**
* Simple hack to handle the PVCS command-line tools botch when * Simple hack to handle the PVCS command-line tools botch when
@@ -416,7 +423,7 @@ public class Pvcs extends org.apache.tools.ant.Task {


/** /**
* The format of the folder names; optional. * The format of the folder names; optional.
* This must be in a format suitable for
* This must be in a format suitable for
* <code>java.text.MessageFormat</code>. * <code>java.text.MessageFormat</code>.
* Index 1 of the format will be used as the file name. * Index 1 of the format will be used as the file name.
* Defaults to <code>{0}-arc({1})</code> * Defaults to <code>{0}-arc({1})</code>
@@ -445,7 +452,7 @@ public class Pvcs extends org.apache.tools.ant.Task {
* need to change this value, UNC names will always be * need to change this value, UNC names will always be
* accepted. * accepted.
*/ */
public void setLineStart(String l) { public void setLineStart(String l) {
lineStart = l; lineStart = l;
} }
@@ -492,10 +499,10 @@ public class Pvcs extends org.apache.tools.ant.Task {
} }


/** /**
* Workspace to use; optional.
* Workspace to use; optional.
* By specifying a workspace, the files are extracted to that location. * By specifying a workspace, the files are extracted to that location.
* A PVCS workspace is a name for a location of the workfiles and
* isn't as such the location itself.
* A PVCS workspace is a name for a location of the workfiles and
* isn't as such the location itself.
* You define the location for a workspace using the PVCS GUI clients. * You define the location for a workspace using the PVCS GUI clients.
* If this isn't specified the default workspace for the current user is used. * If this isn't specified the default workspace for the current user is used.
* @param ws String * @param ws String
@@ -536,12 +543,12 @@ public class Pvcs extends org.apache.tools.ant.Task {


/** /**
* Specifies the value of the force argument; optional. * Specifies the value of the force argument; optional.
* If set to <i>yes</i> all files that exists and are
* writable are overwritten. Default <i>no</i> causes the files
* that are writable to be ignored. This stops the PVCS command
* If set to <i>yes</i> all files that exists and are
* writable are overwritten. Default <i>no</i> causes the files
* that are writable to be ignored. This stops the PVCS command
* <i>get</i> to stop asking questions! * <i>get</i> to stop asking questions!
* @todo make a boolean setter * @todo make a boolean setter
* @param repo String (yes/no)
* @param f String (yes/no)
*/ */
public void setForce(String f) { public void setForce(String f) {
if (f != null && f.equalsIgnoreCase("yes")) { if (f != null && f.equalsIgnoreCase("yes")) {
@@ -561,7 +568,7 @@ public class Pvcs extends org.apache.tools.ant.Task {


/** /**
* Specifies the name of the promotiongroup argument * Specifies the name of the promotiongroup argument
* @param repo String
* @param w String
*/ */
public void setPromotiongroup(String w) { public void setPromotiongroup(String w) {
promotiongroup = w; promotiongroup = w;
@@ -577,7 +584,7 @@ public class Pvcs extends org.apache.tools.ant.Task {


/** /**
* Only files marked with this label are extracted; optional. * Only files marked with this label are extracted; optional.
* @param repo String
* @param l String
*/ */
public void setLabel(String l) { public void setLabel(String l) {
label = l; label = l;
@@ -617,7 +624,7 @@ public class Pvcs extends org.apache.tools.ant.Task {


/** /**
* Specify a project within the PVCS repository to extract files from. * Specify a project within the PVCS repository to extract files from.
* @param PvcsProject
* @param p
*/ */
public void addPvcsproject(PvcsProject p) { public void addPvcsproject(PvcsProject p) {
pvcsProjects.addElement(p); pvcsProjects.addElement(p);
@@ -628,13 +635,31 @@ public class Pvcs extends org.apache.tools.ant.Task {
} }


/** /**
* If set to <i>true</i> files are fetched only if
* If set to <i>true</i> files are fetched only if
* newer than existing local files; optional, default false. * newer than existing local files; optional, default false.
*/ */
public void setUpdateOnly(boolean l) { public void setUpdateOnly(boolean l) {
updateOnly = l; updateOnly = l;
} }


/**
* returns the path of the configuration file to be used
* @return the path of the config file
*/
public String getConfig() {
return config;
}

/**
* Sets a configuration file other than the default to be used.
* These files have a .cfg extension and are often found in archive or pvcsprop folders.
* @param f config file - can be given absolute or relative to ant basedir
*/
public void setConfig(File f) {
config = f.toString();
}


public String getUserId() { public String getUserId() {
return userId; return userId;
} }
@@ -643,7 +668,7 @@ public class Pvcs extends org.apache.tools.ant.Task {
* User ID; unused. * User ID; unused.
* @ant.attribute ignore="true" * @ant.attribute ignore="true"
*/ */
public void setUserId(String u) { public void setUserId(String u) {
userId = u; userId = u;
} }


Loading…
Cancel
Save