How can I query Perforce for a list of users who h

2019-08-09 14: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.

标签: perforce
1条回答
对你真心纯属浪费
2楼-- · 2019-08-09 15:22

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.

查看更多
登录 后发表回答