Reverting Another User‘s Files

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

Deleting a User
 

Helix VCS

HELIX COREPROTECTION & SECURITYCOMMON QUESTIONSSUPERUSER TASKSADMIN TASKSGETTING STARTEDI

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值