To get a list of all files in a Perforce depot that are outside of your current workspace, you can use the p4 command-line client with specific options. The basic idea is to use the p4 files command with a depot path and exclude the paths that are within your workspace. However, directly achieving this can be a bit tricky because workspaces can have complex views with multiple mappings.
Here are a few approaches to help you list files in the depot outside your workspace:
1. Using p4 files with a Depot Path
If you know the depot path you're interested in and your workspace doesn't include that entire path, you can simply use:
p4 files //depot/path/...
This command lists all files under //depot/path/ and its subdirectories. If your workspace includes a subset of this path, files outside that subset will be shown.
2. Finding Files Not in Your Workspace
If your workspace has a specific view, you can try to exclude its paths. For example, if your workspace view is:
//depot/project1/...
//depot/utils/...
You could list files not in project1 or utils like this:
p4 files //depot/...
- //depot/project1/...
- //depot/utils/...
This command lists all files in the depot and then excludes (-) files in //depot/project1/ and //depot/utils/.
3. Using a Client Spec
Another approach is to create a temporary client spec that maps the depot in a way that excludes your workspace paths, then use that client to run p4 files.
- Create a new client spec:
p4 client temp_client
- Edit the client spec to include only the depot paths you're interested in:
p4 edit client temp_client
In the client spec, define a view that includes the depot paths you want, for example:
View:
//depot/other_project/...
- List files using the new client:
p4 -c temp_client files //...
- Finally, delete the temporary client:
p4 client -d temp_client
4. Using p4 where
The p4 where command can help you understand the mapping between depot and workspace paths, which might be useful in constructing a command to list files outside your workspace.
Conclusion
The best approach depends on your specific workspace view and what exactly you're trying to achieve. If your workspace has a simple view and you're interested in depot paths not covered by your workspace, using p4 files with depot paths and exclusions might be straightforward. For more complex scenarios, creating a temporary client spec can provide a flexible way to list files outside your workspace.