Reverting Another User's Files
https://community.perforce.com/s/article/2567
Reverting Another User's Files
How to revert files for a Perforce Helix Core user or client that no longer exists. How to revert files opened in another user's client workspace
May 23, 2018
PROBLEM
How do I revert files opened in another user's client workspace?
How do I revert files for a user or client that no longer exists?
SOLUTION
Use p4 opened to report opened files for a specific user:
p4 opened -u bruno //depot/www/dev/Jam.html#2 - edit default change (text) by bruno@bruno_ws
The user@workspace is reported at the end of each line of the p4 opened output.
REVERTING SELECTED FILES FROM A WORKSPACE
Helix Server 2015.1 or later
As a user with admin or super privileges, use p4 revert -C supplying the workspace name and the files to be reverted.
Revert a single file in the bruno_ws workspace:
p4 revert -C bruno_ws //depot/www/dev/Jam.html
Revert all files in the bruno_ws workspace:
p4 revert -C bruno_ws //...
Revert all files in the bruno_ws workspace in change 12115:
p4 revert -c 12115 -C bruno_ws //...
When reverting files using p4 revert -C, the -k flag is implied which marks the file as reverted in server metadata without altering files in the client workspace.
Helix Server 2014.2 or earlier
As a user with super privileges, impersonate the user that owns the client workspace and use p4 revert -k to revert files.
p4 opened -u bruno //depot/www/dev/Jam.html#2 - edit default change (text) by bruno@bruno_ws p4 login bruno User bruno logged in. p4 -u bruno -c bruno_ws -H bingo.perforce.com revert -k //depot/www/dev/Jam.html //depot/www/dev/Jam.html#2 - was edit, cleared
The p4 login user command generates a login ticket for the user allowing you to run p4 revert with the credentials of the workspace owner without requiring a password. Use the global options to p4 to set the user (-u), client workspace (-c), and host (-H) fields and use the -k flag with p4 revert which marks the file as reverted in server metadata without altering files in the workspace. Use p4 client -o workspace to get the hostname to use with the -H host option to p4 revert -k, for example:
p4 -F %Host% -ztag client -o bruno_ws bingo.perforce.com
REVERTING FILES BY DELETING THE CLIENT WORKSPACE
If files are opened in a workspace that's no longer needed, delete the client workspace:
p4 client -df bruno_ws
which automatically reverts opened files as part of the workspace removal. Deleting a client workspace does not remove files from the client workspace. To clean up the deleted workspace file system, you must delete the files on the machine containing the workspace.
Workspaces containing shelved files require special consideration as deletion is prevented:
p4 client -df bruno_ws ... File(s) shelved in change 12107 ... File(s) shelved in change 12106 Client 'bruno_ws' has files shelved; use 'shelve -df' to remove them, and then try again, or use 'client -df -Fs' to delete the client and leave the shelved changes intact.
With Helix Server 2014.1 or later, you can force the workspace to be deleted using the -Fs flag to p4 client -df:
p4 client -df -Fs bruno_ws Client bruno_ws deleted.
which deletes the client workspace leaving shelved changes intact.
Alternatively, you can use p4 shelve -df to delete each shelved change and then delete the workspace:
p4 shelve -df -c 12106 Shelved change 12106 deleted. p4 shelve -df -c 12107 Shelved change 12107 deleted. p4 client -df bruno_ws Client bruno_ws deleted.
With Helix Server 2013.3 or earlier, you must delete shelved changes before deleting the workspace. If the message from p4 client -df does not contain shelved changes numbers, use p4 changes -s shelved -u user -c workspace to find shelved changes for a specific user@workspace.
To delete a client workspace or a shelved change using p4 client -df or p4 shelve -df, you must be a user with admin or super privileges.
RESETTING USER PASSWORDS
Sometimes impersonating the perforce user and client to do a revert can require a Helix Server super user to reset their password. The superuser can simply change the user's password, login as the user, and then revert the files. For example, to reset the password:
p4 passwd username
When prompted, enter a new password for user username.
LOCKED CLIENT WORKSPACE
In cases where the client workspace is locked, the Helix Server admin can use the -f flag option with the p4 client command to modify another user's workspace. For example:
p4 client -f clientname
Superusers can use the -f flag to delete or modify locked workspaces owned by other users, and non-superusers can use this flag to delete or modify locked workspaces that they themselves own.
RELATED LINKS
Helix VCS
HELIX COREPROTECTION & SECURITYCOMMON QUESTIONSSUPERUSER TASKSADMIN TASKSGETTING STARTEDI