net.sourceforge.cruisecontrol.sourcecontrols
Class ConcurrentVersionsSystem

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.sourcecontrols.ConcurrentVersionsSystem
All Implemented Interfaces:
java.io.Serializable, SourceControl

public class ConcurrentVersionsSystem
extends java.lang.Object
implements SourceControl

This class implements the SourceControlElement methods for a CVS repository. The call to CVS is assumed to work without any setup. This implies that if the authentication type is pserver the call to cvs login should be done prior to calling this class.

There are also differing CVS client/server implementations (e.g. the official CVS and the CVSNT fork).

Note that the log formats of the official CVS have changed starting from version 1.12.9. This class currently knows of 2 different outputs referred to as the 'old' and the 'new' output formats.

Author:
Paul Julius, Robert Watkins, Frederic Lavigne, Jason Yip, Marc Paquette, Johnny Cass, McClain Looney
See Also:
Serialized Form

Field Summary
static java.lang.String LOG_DATE_FORMAT
           
 
Constructor Summary
ConcurrentVersionsSystem()
           
 
Method Summary
 Commandline buildHistoryCommand(java.util.Date lastBuildTime, java.util.Date checkTime)
           
protected  Commandline getCommandline()
           
protected  net.sourceforge.cruisecontrol.sourcecontrols.ConcurrentVersionsSystem.Version getCvsServerVersion()
           
 java.util.List getModifications(java.util.Date lastBuild, java.util.Date now)
          Returns a List of Modifications detailing all the changes between the last build and the latest revision at the repository
protected  OSEnvironment getOSEnvironment()
          for mocking *
 java.util.Map getProperties()
          Any properties that have been set in this sourcecontrol.
 boolean isCvsNewOutputFormat()
           
protected  java.util.List parseStream(java.io.InputStream input)
          Parses the input stream, which should be from the cvs log command.
 void setCvsRoot(java.lang.String cvsroot)
          Sets the CVSROOT for all calls to CVS.
 void setLocalWorkingCopy(java.lang.String local)
          Sets the local working copy to use when making calls to CVS.
protected  void setMailAliases(java.util.Hashtable mailAliases)
           
 void setModule(java.lang.String module)
          Set the cvs module name.
 void setProperty(java.lang.String property)
           
 void setPropertyOnDelete(java.lang.String propertyOnDelete)
           
 void setReallyQuiet(boolean reallyQuiet)
           
 void setTag(java.lang.String tag)
          Set the cvs tag.
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_DATE_FORMAT

public static final java.lang.String LOG_DATE_FORMAT
See Also:
Constant Field Values
Constructor Detail

ConcurrentVersionsSystem

public ConcurrentVersionsSystem()
Method Detail

setCvsRoot

public void setCvsRoot(java.lang.String cvsroot)
Sets the CVSROOT for all calls to CVS.

Parameters:
cvsroot - CVSROOT to use.

setLocalWorkingCopy

public void setLocalWorkingCopy(java.lang.String local)
Sets the local working copy to use when making calls to CVS.

Parameters:
local - String indicating the relative or absolute path to the local working copy of the module of which to find the log history.

setTag

public void setTag(java.lang.String tag)
Set the cvs tag. Note this should work with names, numbers, and anything else you can put on log -rTAG

Parameters:
tag - the cvs tag

setModule

public void setModule(java.lang.String module)
Set the cvs module name. Note that this is only used when localworkingcopy is not set.

Parameters:
module - the cvs module

setProperty

public void setProperty(java.lang.String property)

setPropertyOnDelete

public void setPropertyOnDelete(java.lang.String propertyOnDelete)

setReallyQuiet

public void setReallyQuiet(boolean reallyQuiet)
Parameters:
reallyQuiet - When true, this class should use the -Q cvs option instead of -q for the log command.

getCvsServerVersion

protected net.sourceforge.cruisecontrol.sourcecontrols.ConcurrentVersionsSystem.Version getCvsServerVersion()

isCvsNewOutputFormat

public boolean isCvsNewOutputFormat()

getProperties

public java.util.Map getProperties()
Description copied from interface: SourceControl
Any properties that have been set in this sourcecontrol. Will be passed onto the Builder, which may then pass the properties to the underlying build implementation. For example, the Ant builder will define these properties so that the underlying Ant script can use them.

Specified by:
getProperties in interface SourceControl

getOSEnvironment

protected OSEnvironment getOSEnvironment()
for mocking *


validate

public void validate()
              throws CruiseControlException
Specified by:
validate in interface SourceControl
Throws:
CruiseControlException

getModifications

public java.util.List getModifications(java.util.Date lastBuild,
                                       java.util.Date now)
Returns a List of Modifications detailing all the changes between the last build and the latest revision at the repository

Specified by:
getModifications in interface SourceControl
Parameters:
lastBuild - last build time
now -
Returns:
maybe empty, never null.

buildHistoryCommand

public Commandline buildHistoryCommand(java.util.Date lastBuildTime,
                                       java.util.Date checkTime)
                                throws CruiseControlException
Parameters:
lastBuildTime -
checkTime -
Returns:
CommandLine for "cvs -d CVSROOT -q log -N -dlastbuildtimeThrows:
CruiseControlException

getCommandline

protected Commandline getCommandline()

parseStream

protected java.util.List parseStream(java.io.InputStream input)
                              throws java.io.IOException
Parses the input stream, which should be from the cvs log command. This method will format the data found in the input stream into a List of Modification instances.

Parameters:
input - InputStream to get log data from.
Returns:
List of Modification elements, maybe empty never null.
Throws:
java.io.IOException

setMailAliases

protected void setMailAliases(java.util.Hashtable mailAliases)