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

Constructor Summary
Changes(Depot depot)
           
 
Method Summary
 Changelist getChangelist(int number)
          Returns a single changelist specified by its number.
 java.util.List<Changelist> getChangelists(java.lang.String path, int lastChange, int limit)
          Returns a list of changelists that match the parameters
 java.util.List<Changelist> getChangelistsFromNumbers(java.util.List<java.lang.Integer> numbers)
          Converts a list of numbers to a list of changes.
 java.util.List<java.lang.Integer> getChangeNumbers(java.lang.String path, int start, int limit)
          A lightweight call to return changelist numbers for a given path.
 java.util.List<java.lang.Integer> getChangeNumbersInRange(Workspace workspace, int first, int last)
          Return the change numbers in the range [first, last] that apply to the specified workspace.
 java.util.List<java.lang.Integer> getChangeNumbersTo(java.lang.String path, int untilChange)
          Returns a list of changenumbers that start with the most recent change and work back to the specified change.
 java.util.List<java.lang.Integer> getChangeNumbersTo(java.lang.String workspace, java.lang.String path, int untilChange)
          Returns a list of changenumbers that start with the most recent change and work back to the specified change.
 
Methods inherited from class com.tek42.perforce.parse.AbstractPerforceTemplate
getExtraParams, getLogger, getPerforceResponse, 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)
                         throws PerforceException
Returns a single changelist specified by its number.

Parameters:
number -
Returns:
Throws:
PerforceException

getChangelists

public java.util.List<Changelist> getChangelists(java.lang.String path,
                                                 int lastChange,
                                                 int limit)
                                          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
Returns:
Throws:
PerforceException

getChangeNumbers

public java.util.List<java.lang.Integer> getChangeNumbers(java.lang.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 java.util.List<java.lang.Integer> getChangeNumbersTo(java.lang.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 java.util.List<java.lang.Integer> getChangeNumbersTo(java.lang.String workspace,
                                                            java.lang.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 java.util.List<Changelist> getChangelistsFromNumbers(java.util.List<java.lang.Integer> numbers)
                                                     throws PerforceException
Converts a list of numbers to a list of changes.

Parameters:
numbers -
Returns:
Throws:
PerforceException

getChangeNumbersInRange

public java.util.List<java.lang.Integer> getChangeNumbersInRange(Workspace workspace,
                                                                 int first,
                                                                 int last)
                                                          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)
Returns:
list of change numbers
Throws:
PerforceException


Copyright © 2010. All Rights Reserved.