Click or drag to resize

RepositoryGetChangelists Method

Get a list of changes from the repository

Namespace:  Perforce.P4
Assembly:  p4api.net (in p4api.net.dll) Version: 2023.2.255.3501
Syntax
public IList<Changelist> GetChangelists(
	Options options,
	params FileSpec[] files
)

Parameters

options
Type: Perforce.P4Options
options for the changes commandChangesCmdOptions
files
Type: Perforce.P4FileSpec
array of FileSpecs for the changes command

Return Value

Type: IListChangelist
A list containing the matching changes
Remarks

p4 help changes

changes -- Display list of pending and submitted changelists
changelists -- synonym for 'changes'

p4 changes [options] [file[revRange] ...]

options: -i -t -l -L -f -c client -m max -s status -u user

Returns a list of all pending and submitted changelists currently
stored in the server.

If files are specified, 'p4 changes' lists only changelists that
affect those files. If the file specification includes a revision
range, 'p4 changes' lists only submitted changelists that affect
the specified revisions. See 'p4 help revisions' for details.

If files are not specified, 'p4 changes' limits its report
according to each change's type ('public' or 'restricted').
If a submitted or shelved change is restricted, the change is
not reported unless the user owns the change or has list
permission for at least one file in the change. Only the owner
of a restricted and pending (not shelved) change is permitted
to see it.

The -i flag also includes any changelists integrated into the
specified files.

The -t flag displays the time as well as the date.

The -l flag displays the full text of the changelist
descriptions.

The -L flag displays the changelist descriptions, truncated to 250
characters if longer.

The -f flag enables admin users to view restricted changes.

The -c client flag displays only submitted by the specified client.

The -m max flag limits changes to the 'max' most recent.

The -s status flag limits the output to changelists with the specified
status. Specify '-s pending', '-s shelved', or '-s submitted'.

The -u user flag displays only changes owned by the specified user.

Examples
To get all changelists owned by user bsmith:
ChangesCmdOptions opts = new ChangesCmdOptions(ChangesCmdFlags.None,
    null, 0, ChangeListStatus.None, "bsmith");

IList<Changelist> changes =
Repository.GetChangelists(opts, null);
To get all shelved changelists in file path //depot/main/...:
   ChangesCmdOptions opts =new ChangesCmdOptions(ChangesCmdFlags.None,
       null, 0, ChangeListStatus.Shelved, null);

FileSpec file =
new FileSpec(new DepotPath("//depot/main/..."), null, null, null);

   IList<Changelist> changes =
   Repository.GetChangelists(opts, file);
To the 20 latest submitted changelists from client "build_workspace" with their full description:
ChangesCmdOptions opts =new ChangesCmdOptions(ChangesCmdFlags.FullDescription,
    "build_workspace", 20, ChangeListStatus.Submitted, null);

IList<Changelist> changes =
Repository.GetChangelists(opts, null);
To get all pending changelists as an admin user in file path //depot/finance/... including restricted changelists:
   ChangesCmdOptions opts =new ChangesCmdOptions(ChangesCmdFlags.ViewRestricted,
       null, 0, ChangeListStatus.Pending, null);

FileSpec file =
new FileSpec(new DepotPath("//depot/finance/..."), null, null, null);

   IList<Changelist> changes =
   Repository.GetChangelists(opts, file);
See Also