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

P4 API for Go Documentation | 2025.2

# Get file history for a specific file

The following is an example of how to get the file history for a specific file using P4 API for Go.

Copy

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    // Run filelog for a specific file
    filelog, err := p4api.RunFilelog("//depot/example.txt")
    if err != nil {
        fmt.Println("Error fetching filelog:", err)
        return
    }

    // Print file history
    for _, file := range filelog {
        fmt.Println("File:", file.Name)
        for _, rev := range file.Revisions {
            fmt.Printf("Revision %d: %s by %s@%s\n", rev.Rev, rev.Action, rev.User, rev.Client)
            fmt.Println("Description:", rev.Desc)
        }
    }

Your search for returned results