How can I query Perforce for a list of users who have workspaces that reference a particular file in the depot?

南笙酒味 提交于 2019-12-11 11:26:57

问题


I would like to query my Perforce server to get a list of all users who have an active workspace whose view specification references a given file in the depot.

For example, given the file //root/folder/file.txt this command should return a list of the users who have an active workspace whose view specification references //root/folder/file.txt

Alternatively the command could just return the workspaces that reference the file, and then it should be straight forward to get the list of owners of those workspaces.


回答1:


First you'll get the workspaces, and then you can run through the list of workspaces to get the owner.

To get the workspaces you will need to loop over every workspace in your server and run(assuming your filename from the question):

p4 files //root/folder/file.txt@<workspace name>

If you get a 'no such files' error, then the workspace doesn't have any version of that file synced. For all of the workspaces that do have the file, you can then look up the owner in the spec.

Note that this query is checking to see if the workspace has the file synced, not just mapped. My general assumption is if they map it and don't sync it, the file is nearly as good as unmapped.



来源:https://stackoverflow.com/questions/30761453/how-can-i-query-perforce-for-a-list-of-users-who-have-workspaces-that-reference

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!