If you specify AltRoots, the Perforce Command-Line Client chooses the client root based on where you execute your p4 command. Perforce compares the current working directory against the Root first, and then against the alternate client workspace roots, if present. The first root to match the current working directory is used. If no roots match, the main root is used.
If you use alternate client workspace roots, ensure that you configure your client correctly:
- Since the client can be used from multiple hosts, normally you need to remove the Host field from your client workspace form.
- Specify one or two entries for the AltRoots field. If you are using a Windows directory in any of your client roots, specify the Windows directory as your Root and specify your other workspace root directories in the AltRoots field.
Host: some-vm <======= remove this field
[... remainder of client spec ...]
- If you specify two directories for the AltRoots field, enter the second on a separate line, indented with one or more spaces or tabs
To confirm that your client workspace root is selected correctly on Windows and on Linux/UNIX:
- Log into a Windows host and run p4 where //p_ws/.... The output should resemble this:
C:\my_ws>p4 where //p_ws/...
//depot/... //p_ws/depot/... c:\my_ws\depot\...
//apps/... //p_ws/apps/... c:\my_ws\apps\...
- Log into a Linux/UNIX host and run p4 where //p_ws/.... The output should resemble this:
$ p4 where //p_ws/...
//depot/... //p_ws/depot/... /Users/bruno/client/test/depot/...
//apps/... //p_ws/apps/... /Users/bruno/client/test/apps/...
As an alternative to AltRoots
, or if p4 where
does not choose the client workspace root that you expect, you can use the -d
global option to specify the working path on your p4
commands. For example:
p4 -d /some/root/directory/ <command>