com.tek42.perforce.parse
Class Changes

java.lang.Object
  extended by com.tek42.perforce.parse.AbstractPerforceTemplate
      extended by com.tek42.perforce.parse.Changes

public class Changes
extends AbstractPerforceTemplate

Base API object for interacting with changelists.

Author:
Mike Wille, Brian Westrich

Nested Class Summary
 
Nested classes/interfaces inherited from class com.tek42.perforce.parse.AbstractPerforceTemplate
AbstractPerforceTemplate.ResponseFilter
 
Constructor Summary
Changes(Depot depot)
           
 
Method Summary
 Changelist getChangelist(int number, int maxFiles)
          Returns a single changelist specified by its number.
 List<Changelist> getChangelists(String path, int lastChange, int limit, int maxFiles)
          Returns a list of changelists that match the parameters
 List<Changelist> getChangelistsFromNumbers(List<Integer> numbers, int maxFiles)
          Converts a list of numbers to a list of changes.
 List<Integer> getChangeNumbers(String path, int start, int limit)
          A lightweight call to return changelist numbers for a given path.
 List<Integer> getChangeNumbersInRange(Workspace workspace, int first, int last, boolean showIntegChanges)
          Return the change numbers in the range [first, last] that apply to the specified workspace.
 List<Integer> getChangeNumbersInRange(Workspace workspace, int first, int last, String paths, boolean showIntegChanges)
           
 List<Integer> getChangeNumbersInRangeForSinglePath(Workspace workspace, int first, int last, String path, boolean showIntegChanges)
           
 List<Integer> getChangeNumbersTo(String path, int untilChange)
          Returns a list of changenumbers that start with the most recent change and work back to the specified change.
 List<Integer> getChangeNumbersTo(String workspace, String path, int untilChange)
          Returns a list of changenumbers that start with the most recent change and work back to the specified change.
 Integer getHighestLabelChangeNumber(Workspace workspace, String label, String path)
           
 
Methods inherited from class com.tek42.perforce.parse.AbstractPerforceTemplate
getExtraParams, getLogger, getP4Exe, getPerforceResponse, getPerforceResponse, getRawPerforceResponseBytes, getRawPerforceResponseLines, hitMax, login, parseList, saveToPerforce
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Changes

public Changes(Depot depot)
Method Detail

getChangelist

public Changelist getChangelist(int number,
                                int maxFiles)
                         throws PerforceException
Returns a single changelist specified by its number.

Parameters:
number -
maxFiles - The maximum number of affected files that will be recorded to a changelist. With negative value include all the files.
Returns:
Throws:
PerforceException

getChangelists

public List<Changelist> getChangelists(String path,
                                       int lastChange,
                                       int limit,
                                       int maxFiles)
                                throws PerforceException
Returns a list of changelists that match the parameters

Parameters:
path - What point in the depot to show changes for?
lastChange - The last changelist number to start from
limit - The maximum changes to return if less than 1, will return everything
maxFiles - The maximum amount of affected files in a changelist to be recorded
Returns:
Throws:
PerforceException

getChangeNumbers

public List<Integer> getChangeNumbers(String path,
                                      int start,
                                      int limit)
                               throws PerforceException
A lightweight call to return changelist numbers for a given path.

To get the latest change in the depot for the project, you can use:

 depot.getChangeNumbers("//project/...", -1, 1)
 

Note: this method follows perforce in that it starts at the highest number and works backwards. So this might not be what you want. (It certainly isn't for Hudson)

Parameters:
path - Path to filter on
start - The number of the change to start from
limit - The number of changes to return
Returns:
Throws:
PerforceException

getChangeNumbersTo

public List<Integer> getChangeNumbersTo(String path,
                                        int untilChange)
                                 throws PerforceException
Returns a list of changenumbers that start with the most recent change and work back to the specified change.

Parameters:
path -
untilChange -
Returns:
Throws:
PerforceException

getChangeNumbersTo

public List<Integer> getChangeNumbersTo(String workspace,
                                        String path,
                                        int untilChange)
                                 throws PerforceException
Returns a list of changenumbers that start with the most recent change and work back to the specified change.

Parameters:
workspace -
path - one or more paths, e.g. "//testproject/... //testfw/...". Paths are assumed to be delimited by a single space.
untilChange -
Returns:
Throws:
PerforceException

getChangelistsFromNumbers

public List<Changelist> getChangelistsFromNumbers(List<Integer> numbers,
                                                  int maxFiles)
                                           throws PerforceException
Converts a list of numbers to a list of changes.

Parameters:
numbers -
maxFiles - The maximum number of affected files that will be recorded to a changelist. With negative value include all the files.
Returns:
Throws:
PerforceException

getChangeNumbersInRange

public List<Integer> getChangeNumbersInRange(Workspace workspace,
                                             int first,
                                             int last,
                                             boolean showIntegChanges)
                                      throws PerforceException
Return the change numbers in the range [first, last] that apply to the specified workspace. The change numbers are returned highest (most recent) first.

Parameters:
first - The number of the change to start from
last - The last change to include (if applies to the workspace)
showIntegChanges - True if integrated changelists should be counted as well
Returns:
list of change numbers
Throws:
PerforceException

getChangeNumbersInRange

public List<Integer> getChangeNumbersInRange(Workspace workspace,
                                             int first,
                                             int last,
                                             String paths,
                                             boolean showIntegChanges)
                                      throws PerforceException
Throws:
PerforceException

getHighestLabelChangeNumber

public Integer getHighestLabelChangeNumber(Workspace workspace,
                                           String label,
                                           String path)
                                    throws PerforceException
Throws:
PerforceException

getChangeNumbersInRangeForSinglePath

public List<Integer> getChangeNumbersInRangeForSinglePath(Workspace workspace,
                                                          int first,
                                                          int last,
                                                          String path,
                                                          boolean showIntegChanges)
                                                   throws PerforceException
Throws:
PerforceException


Copyright © 2004-2013 Hudson. All Rights Reserved.