org.apache.tools.ant.taskdefs.optional.pvcs

Class Pvcs

public class Pvcs extends Task

Extracts the latest edition of the source code from a PVCS repository. PVCS is a version control system developed by Merant.
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 the repository is platform dependent so use property to specify location of repository.
This version has been tested agains PVCS version 6.5 and 6.6 under Windows and Solaris. 19-04-2001

The task now has a more robust parser. It allows for platform independant file paths and supports file names with (). Thanks to Erik Husby for bringing the bug to my attention. 27-04-2001

UNC paths are now handled properly. Fix provided by Don Jeffery. He also added an UpdateOnly flag that, when true, conditions the PVCS get using the -U option to only update those files that have a modification time (in PVCS) that is newer than the existing workfile. 25-10-2002

Added a revision attribute that currently is a synonym for label, but in a future release the behavior of the label attribute will change to use the -v option of GET. See bug #13847 for discussion.

Constructor Summary
Pvcs()
Creates a Pvcs object
Method Summary
voidaddPvcsproject(PvcsProject p)
Specify a project within the PVCS repository to extract files from.
voidexecute()
StringgetConfig()
returns the path of the configuration file to be used
StringgetFilenameFormat()
The filenameFormat attribute defines a MessageFormat string used to parse the output of the pcli command.
StringgetForce()
Get value of force
booleangetIgnoreReturnCode()
Get value of ignorereturncode
StringgetLabel()
Get value of label
StringgetLineStart()
The lineStart attribute is used to parse the output of the pcli command.
StringgetPromotiongroup()
Get value of promotiongroup
StringgetPvcsbin()
Get name of the PVCS bin directory
StringgetPvcsproject()
Get name of the project in the PVCS repository
VectorgetPvcsprojects()
Get name of the project in the PVCS repository
StringgetRepository()
Get network name of the PVCS repository
StringgetRevision()
Get value of revision
booleangetUpdateOnly()
get the updateOnly attribute.
StringgetUserId()
Get the userid.
StringgetWorkspace()
Get name of the workspace to store the retrieved files
protected intrunCmd(Commandline cmd, ExecuteStreamHandler out)
Run the command.
voidsetConfig(File f)
Sets a configuration file other than the default to be used.
voidsetFilenameFormat(String f)
The format of the folder names; optional.
voidsetForce(String f)
Specifies the value of the force argument; optional.
voidsetIgnoreReturnCode(boolean b)
If set to true the return value from executing the pvcs commands are ignored; optional, default false.
voidsetLabel(String l)
Only files marked with this label are extracted; optional.
voidsetLineStart(String l)
What a valid return value from PVCS looks like when it describes a file.
voidsetPromotiongroup(String w)
Specifies the name of the promotiongroup argument
voidsetPvcsbin(String bin)
Specifies the location of the PVCS bin directory; optional if on the PATH.
voidsetPvcsproject(String prj)
The project within the PVCS repository to extract files from; optional, default "/"
voidsetRepository(String repo)
The network name of the PVCS repository; required.
voidsetRevision(String r)
Only files with this revision are extract; optional.
voidsetUpdateOnly(boolean l)
If set to true files are fetched only if newer than existing local files; optional, default false.
voidsetUserId(String u)
User ID
voidsetWorkspace(String ws)
Workspace to use; optional.

Constructor Detail

Pvcs

public Pvcs()
Creates a Pvcs object

Method Detail

addPvcsproject

public void addPvcsproject(PvcsProject p)
Specify a project within the PVCS repository to extract files from.

Parameters: p the pvcs project to use.

execute

public void execute()

Throws: org.apache.tools.ant.BuildException Something is stopping the build...

getConfig

public String getConfig()
returns the path of the configuration file to be used

Returns: the path of the config file

getFilenameFormat

public String getFilenameFormat()
The filenameFormat attribute defines a MessageFormat string used to parse the output of the pcli command. It defaults to {0}-arc({1}). Repositories where the archive extension is not -arc should set this.

Returns: the filename format attribute.

getForce

public String getForce()
Get value of force

Returns: String

getIgnoreReturnCode

public boolean getIgnoreReturnCode()
Get value of ignorereturncode

Returns: String

getLabel

public String getLabel()
Get value of label

Returns: String

getLineStart

public String getLineStart()
The lineStart attribute is used to parse the output of the pcli command. It defaults to "P:. The parser already knows about / and \\, this property is useful in cases where the repository is accessed on a Windows platform via a drive letter mapping.

Returns: the lineStart attribute.

getPromotiongroup

public String getPromotiongroup()
Get value of promotiongroup

Returns: String

getPvcsbin

public String getPvcsbin()
Get name of the PVCS bin directory

Returns: String

getPvcsproject

public String getPvcsproject()
Get name of the project in the PVCS repository

Returns: String

getPvcsprojects

public Vector getPvcsprojects()
Get name of the project in the PVCS repository

Returns: Vector

getRepository

public String getRepository()
Get network name of the PVCS repository

Returns: String

getRevision

public String getRevision()
Get value of revision

Returns: String

getUpdateOnly

public boolean getUpdateOnly()
get the updateOnly attribute.

Returns: the updateOnly attribute.

getUserId

public String getUserId()
Get the userid.

Returns: the userid.

getWorkspace

public String getWorkspace()
Get name of the workspace to store the retrieved files

Returns: String

runCmd

protected int runCmd(Commandline cmd, ExecuteStreamHandler out)
Run the command.

Parameters: cmd the command line to use. out the output stream handler to use.

Returns: the exit code of the command.

setConfig

public void setConfig(File f)
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.

Parameters: f config file - can be given absolute or relative to ant basedir

setFilenameFormat

public void setFilenameFormat(String f)
The format of the folder names; optional. This must be in a format suitable for java.text.MessageFormat. Index 1 of the format will be used as the file name. Defaults to {0}-arc({1})

Parameters: f the format to use.

setForce

public void setForce(String f)
Specifies the value of the force argument; optional. If set to yes all files that exists and are writable are overwritten. Default no causes the files that are writable to be ignored. This stops the PVCS command get to stop asking questions!

Parameters: f String (yes/no)

UNKNOWN: make a boolean setter

setIgnoreReturnCode

public void setIgnoreReturnCode(boolean b)
If set to true the return value from executing the pvcs commands are ignored; optional, default false.

Parameters: b a boolean value.

setLabel

public void setLabel(String l)
Only files marked with this label are extracted; optional.

Parameters: l String

setLineStart

public void setLineStart(String l)
What a valid return value from PVCS looks like when it describes a file. Defaults to "P:. If you are not using an UNC name for your repository and the drive letter P is incorrect for your setup, you may need to change this value, UNC names will always be accepted.

Parameters: l the value to use.

setPromotiongroup

public void setPromotiongroup(String w)
Specifies the name of the promotiongroup argument

Parameters: w String

setPvcsbin

public void setPvcsbin(String bin)
Specifies the location of the PVCS bin directory; optional if on the PATH. On some systems the PVCS executables pcli and get are not found in the PATH. In such cases this attribute should be set to the bin directory of the PVCS installation containing the executables mentioned before. If this attribute isn't specified the tag expects the executables to be found using the PATH environment variable.

Parameters: bin PVCS bin directory

UNKNOWN: use a File setter and resolve paths.

setPvcsproject

public void setPvcsproject(String prj)
The project within the PVCS repository to extract files from; optional, default "/"

Parameters: prj String

setRepository

public void setRepository(String repo)
The network name of the PVCS repository; required.

Parameters: repo String

setRevision

public void setRevision(String r)
Only files with this revision are extract; optional.

Parameters: r String

setUpdateOnly

public void setUpdateOnly(boolean l)
If set to true files are fetched only if newer than existing local files; optional, default false.

Parameters: l a boolean value.

setUserId

public void setUserId(String u)
User ID

Parameters: u the value to use.

setWorkspace

public void setWorkspace(String ws)
Workspace to use; optional. 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. 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.

Parameters: ws String