To revert someone else's files, you'd ideally know the $USER, $CLIENT, $CHANGE (optionally), and $FILESPEC.
- $USER, the username as indicated by perforce
- $CLIENT, also known as the workspace
- $CHANGE, the number of the changelist (or
default
) - $FILESPEC, the file specification used to determine which or what pattern of files to apply this to
# Find the workspace host
p4 client -o $CLIENT
# Impersonate the user
p4 login $USER
# Revert the files as that user, on that workspace, on that machine
p4 -u $USER -c $CLIENT -H $HOST revert $FILESPEC
If someone else has erroneously checked out a file (especially one with an exclusive-open mode) and has left for vacation, you can revert this on the CLI if you have administrative powers.
# Revert files on a given client
p4 revert -C $CLIENT $FILESPEC
# Optionally include a specific changelist to modify
p4 revert -C $CLIENT -c $CHANGELIST $FILESPEC
Source: Reverting Another User's Files