vscode-perforce
vscode-perforce copied to clipboard
Add option to get p4.cfg and client root based on file path
I work in an environment where we symlink files into our perforce stream from another perforce stream. I have realpath set to true, but when trying to edit these files, it tries to edit them in the workspace of the host stream, not in the workspace of the realpath. I have a p4.cfg at the root of all of my workspaces. It would be nice to at least have the option of detecting the client root based on the realpath, rather than from the folder that was opened in vscode.
have you tried to add a .p4config
or .p4settings
file at the root of each workspaces ?
Yes, I have a p4.cfg and (copied .p4config) at each client root.
Let's say I have stream A at //depot/streamA which has client root ~/perforce/streamA and stream B at //depot/streamB has client root ~/perforce/streamB, with a p4.cfg and .p4config in both client roots specifying the p4client.
I then have vscode opening ~/perforce/streamA/src which contains a symlink to ~/perforce/streamB/src at ~/perforce/streamA/src/lib/streamB. When I try to edit any file from under ~/perforce/streamA/src/lib/streamB I would expect it to edit it in the streamB client, instead I get an error similar to the following:
p4 edit "/Users/farooqu/perforce/streamB/src/someFile" ERROR: Path '/Users/farooqu/perforce/streamB/src/someFile' is not under client's root '/Users/farooqu/perforce/streamA'.
This exact behavior works fine in vim with my perforce plugin there.
Based on this last bugfixing, this should be pretty simple: setting the cwd of p4 (PerforceService.ts ::execCommand) to the real directory of the file be operated on. (note that this would break the p4dir feature without appending the relative-to-local-dir to the -d p4dir)
I pushed a new version of the extension (2.2.2) Let me know if it resolve your issue.
Did not resolve this issue unfortunately.
Can you try to change your vscode user settings, clear any previous perforce
parameter and only keep
"perforce.activationMode": "always"
Then reload your vscode workspace. This should let p4
do the bulk of the work.
I don't think this is expected to work given current impl based on what I was looking at. The cwd of p4 would need to be set to each file as it is being executed. New code is required.
Oh ok, I think I see what you mean...