public class PerforceManager extends Object
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.lang3.time.FastDateFormat |
dateFormat |
Constructor and Description |
---|
PerforceManager() |
Modifier and Type | Method and Description |
---|---|
CapabilitySet |
addDefaultPerforceExe(CapabilitySet capabilitySet)
Extracts the default perforce executable from the system properties and creates a capability
|
void |
clearCache() |
List<Commit> |
getChangeLogEntries(com.tek42.perforce.Depot perforceDepot,
List<Integer> changeNumbers)
Retrieves a list of Bamboo Commit including Commit Files based on list of change numbers
|
List<Integer> |
getChangeNumbersFromRevision(com.tek42.perforce.Depot perforceDepot,
String clientViewDepot,
int lastRevisionInBamboo,
boolean useClientMapping) |
List<Integer> |
getChangeNumsBetweenRevisions(com.tek42.perforce.Depot perforceDepot,
String depot,
int firstRevision,
int secondRevision,
boolean useClientMapping)
Retrieves a list of change log numbers after the first number and up to (and including) the second number for the depot.
|
String |
getClientRoot(com.tek42.perforce.Depot perforceDepot)
Retrieves the workspace root as defined in the client configuration
|
protected String |
getDepotFromView(com.tek42.perforce.Depot perforceDepot,
String depotView,
boolean useClientMapping)
Takes in the client view of a depot (right hand side of the view map)
and returns the actual depot (left hand side of the view map)
If it fails it will return the client view, chances are what you are doing will still work with this.
|
Map<String,String> |
getDepotViewCache() |
String |
getFileNameForUrl(String fileName,
String depot,
String clientName) |
String |
getHostFromInfo(com.tek42.perforce.Depot perforceDepot)
parses output of perforce indo command to extract out the address of the perforce server
|
int |
getLatestChangeNumber(com.tek42.perforce.Depot perforceDepot,
String depot,
int latestRevisionInBamboo,
boolean useClientMapping)
retrieves the latest change list number on the perforce server for comparison to the one stored in Bamboo
|
String |
getWorkingDir(String client,
String clientRoot,
String depot)
Extracts the directory from the depot(client view) and source code directory which will contain the build files
|
void |
setupSync(com.tek42.perforce.Depot perforceDepot,
File sourceDirectory)
Sets the directory for perforce to check the code out to.
|
void |
syncToHead(com.tek42.perforce.Depot perforceDepot,
String depot,
boolean forceSync)
Syncs the source code to head
|
void |
syncToRevision(com.tek42.perforce.Depot perforceDepot,
String depot,
int revisionNumber,
boolean forceSync)
Syncs the source code to a specific revision number
|
void |
validateClient(ErrorCollection errorCollection,
com.tek42.perforce.Depot depot,
String client)
Validates the existence of the specified client of the perforce depot.
|
void |
validateConnection(ErrorCollection errorCollection,
com.tek42.perforce.Depot depot)
Validates the connection to the perforce depot.
|
void |
validateDepot(ErrorCollection errorCollection,
com.tek42.perforce.Depot validationDepot,
String depot)
Validates that the depot string specified is correct.
|
void |
validateLogin(ErrorCollection errorCollection,
com.tek42.perforce.Depot depot)
Validates that the login credential supplied (ie user/password combination) is correct.
|
protected static final org.apache.commons.lang3.time.FastDateFormat dateFormat
public void syncToRevision(@NotNull com.tek42.perforce.Depot perforceDepot, @NotNull String depot, int revisionNumber, boolean forceSync) throws RepositoryException
perforceDepot
- containing all connection information except client workspace mappingdepot
- client workspace mappingrevisionNumber
- to sync toforceSync
- whether or not to force a full clean checkoutRepositoryException
- if perforce failed to sync the workspacepublic void syncToHead(@NotNull com.tek42.perforce.Depot perforceDepot, @NotNull String depot, boolean forceSync) throws RepositoryException
perforceDepot
- containing all connection information except client workspace mappingdepot
- client workspace mappingforceSync
- whether or not to force a full clean checkoutRepositoryException
- if perforce failed to sync the workspacepublic void setupSync(@NotNull com.tek42.perforce.Depot perforceDepot, @NotNull File sourceDirectory) throws RepositoryException
perforceDepot
- containing connection informationsourceDirectory
- where you want the sync to occurRepositoryException
- if it fails to connect to the repository@NotNull public String getClientRoot(com.tek42.perforce.Depot perforceDepot) throws RepositoryException
perforceDepot
- the client to extract the workspace root forRepositoryException
- if it fails to connect to the repository@Nullable public String getFileNameForUrl(String fileName, String depot, String clientName)
public int getLatestChangeNumber(@NotNull com.tek42.perforce.Depot perforceDepot, @Nullable String depot, int latestRevisionInBamboo, boolean useClientMapping) throws RepositoryException
perforceDepot
- containing all connection information except the client workspace mappingdepot
- the client workspace mappinglatestRevisionInBamboo
- the last change list number stored in bamboouseClientMapping
- will use the client side mapping rather than the depot mapping for this commandRepositoryException
- if it fails to connect to the repository@NotNull public List<Integer> getChangeNumsBetweenRevisions(@NotNull com.tek42.perforce.Depot perforceDepot, @Nullable String depot, int firstRevision, int secondRevision, boolean useClientMapping) throws RepositoryException
perforceDepot
- containing all connection information except the client workspace mappingdepot
- the client workspace mappingfirstRevision
- change logs will be found which occur after this numbersecondRevision
- change logs will be found up to and including this numberuseClientMapping
- will use the client side mapping rather than the depot mapping for this commandRepositoryException
- on failure to connect to the repositorypublic List<Integer> getChangeNumbersFromRevision(@NotNull com.tek42.perforce.Depot perforceDepot, String clientViewDepot, int lastRevisionInBamboo, boolean useClientMapping) throws RepositoryException
RepositoryException
@NotNull public List<Commit> getChangeLogEntries(@NotNull com.tek42.perforce.Depot perforceDepot, @NotNull List<Integer> changeNumbers) throws RepositoryException
perforceDepot
- containing all connection informationchangeNumbers
- to retrieve changeLog entries forRepositoryException
- if it fails to connect to the repository@Nullable public String getHostFromInfo(@NotNull com.tek42.perforce.Depot perforceDepot)
perforceDepot
- containing connection informationpublic void validateConnection(@NotNull ErrorCollection errorCollection, @NotNull com.tek42.perforce.Depot depot)
errorCollection
- to add validation errors todepot
- containing connection info to validatepublic void validateLogin(@NotNull ErrorCollection errorCollection, @NotNull com.tek42.perforce.Depot depot)
errorCollection
- to add validation errors todepot
- connection information to testpublic void validateClient(@NotNull ErrorCollection errorCollection, @NotNull com.tek42.perforce.Depot depot, @NotNull String client)
errorCollection
- to add any validation errors todepot
- connection information to use to validate client.client
- to check forpublic void validateDepot(@NotNull ErrorCollection errorCollection, @NotNull com.tek42.perforce.Depot validationDepot, @NotNull String depot)
errorCollection
- to add any validation errors tovalidationDepot
- connection information to use to validatedepot
- client workspace to validate@Nullable public String getWorkingDir(@Nullable String client, @Nullable String clientRoot, @Nullable String depot)
client
- - name of the clientclientRoot
- - the location the source will be checked out todepot
- - the depot(client view) as specified by the user@NotNull public CapabilitySet addDefaultPerforceExe(@NotNull CapabilitySet capabilitySet)
capabilitySet
- to add the capability toprotected String getDepotFromView(@NotNull com.tek42.perforce.Depot perforceDepot, @Nullable String depotView, boolean useClientMapping)
perforceDepot
- containing all connection information except the client mappingdepotView
- - the client mapping you want to matchpublic void clearCache()
Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.