Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 API for Go Documentation | 2025.1

# P4DepotFile struct

## Description

The `P4DepotFile` struct provides a utility for accessing and managing the attributes of a file in a P4 Server depot. Each `P4DepotFile` instance contains summary information about the file and a list of revisions (`P4Revision` structs) associated with that file. This struct is primarily used in conjunction with the `RunFilelog` method, which returns a slice of `P4DepotFile` instances.

## Table of methods

This struct returns the attributes of files in the depot. Use `the RunFilelog()` method to get the file attributes.

Method | Description
--- | ---
`Name` | Name of the depot file to which this struct refers. This is the primary identifier for the file in the depot.
`Revisions` | A slice of `P4Revision` pointers, representing all the revisions of the depot file. Each revision contains detailed information such as the revision number, change number, action, type, user, and integrations.

## Examples

### `NewDepotFile(name string) -> *P4DepotFile`

Creates and returns a new `P4DepotFile` instance with the specified depot file name. This is typically used to initialize a new depot file object.

### `df.NewRevision() -> *P4Revision`

Creates a new `P4Revision` instance and appends it to the `Revisions` slice of the `P4DepotFile`. This method is used to add a new revision to the file.

### `df.Revisions -> []*P4Revision`

Returns the slice of `P4Revision` instances associated with the depot file. Each revision provides detailed metadata about a specific version of the file.

Your search for returned results