mjcrouch / vscode-perforce

Perforce commands for Visual Studio Code
MIT License
62 stars 48 forks source link

Allow resolution of symlinks at top of tree #202

Open jimgrier opened 3 years ago

jimgrier commented 3 years ago

Is your feature request related to a problem? Please describe. Our build environment places a symlink - to the actual Perforce tree - in the user's directory. The actual path is unwieldy. Using the user-friendly symlink fails to resolve, although this works naturally with CLI Perforce. It would be nice if the initialization could resolve from the symlink to the actual path automatically.

Describe the solution you'd like It would be nice if the initialization could resolve from the symlink to the actual path automatically.

Describe alternatives you've considered Find the absolute path and use that.

Additional context

mjcrouch commented 3 years ago

Hi, thanks for raising your use case

Could you give a little context around:

Have you tried adjusting the perforce.dir setting at all? I'm not convinced it helps for your case but IIRC it was added for a symlink use case

jimgrier commented 3 years ago

The symlink is as below. By convention, all Perforce sandboxes are on a different volume symlinked into the user's "$HOME/p4" directory. The actual sangbox volume may be one of several. rwxrwxrwx 1 grier tape 50 Feb 11 22:05 /u/grier/p4/qqqq -> /x/eng/bbxyz2/users/grier/qqqq_5925343_2102112204

file:///u/grier/p4/qqqq/qqqq/nnn/vc: Trying to initialise SCM Providers in this workspace. Note: the following overrides apply in this workspace: perforce.port: none (will not override) perforce.user: none (will not override) perforce.client: none (will not override) perforce.dir: /u/grier/p4/qqqq (!OVERRIDE!) Explicit overrides may prevent auto-detection of other perforce client workspaces Looking for a client root using the workspace root directory /u/grier/p4/qqqq/qqqq/nnn/vc: /u/grier/bin/p4-quiet.sh '-d' '/u/grier/p4/qqqq' 'info' file:///u/grier/p4/qqqq/qqqq/nnn/vc: Found workspace using root directory

  • VS Code workspace root directory : Client name: grier:qqqq Client root: /x/eng/bbxyz2/users/grier/qqqq_5925343_2102112204 User name: grier Server address: p4xyzedge-01.xyz.acme.com:1666 !! Folder IS NOT in client root - USING ANYWAY because working dir override is set file:///u/grier/p4/qqqq/qqqq/nnn/vc: NOT scanning for P4CONFIG files due to working directory override file:///u/grier/p4/qqqq/qqqq/nnn/vc: NO valid perforce clients found in this directory. If you were expecting a valid client to be found:
  • Check if you can run perforce commands in this directory from the command line.
  • Look at the perforce commands above, see if they match your expectations and can be run in the directory shown.
  • Review your override settings in vscode, perforce.port, perforce.user, perforce.client, perforce.dir
  • you may need to set or unset them appropriately file:///u/grier/p4/qqqq/qqqq/nnn/vc: To FORCE activation for the client 'grier:qqqq': set perforce.activationMode to always. This should allow you to view and manage changelists in that client, but is unlikely to be useful for files in this workspace

Initialisation finished

Standard usage:

scspr2053294001 $ cd p4/qqqq/ scspr2053294001 $ p4 info (b4p4: using $P4CLIENT grier:qqqq; $P4PORT p4-1666.xyz.acme.com:1666) User name: grier Client name: grier:qqqq Client host: scspr2053294001 Client root: /x/eng/bbxyz2/users/grier/qqqq_5925343_2102112204 Current directory: /x/eng/bbxyz2/users/grier/qqqq_5925343_2102112204 Peer address: 10.234.166.139:54642 Client address: 10.234.166.139 Server address: p4xyzedge-01.xyz.acme.com:1666 Server root: /perforce/edge/1666/p4_database/p4root Server date: 2021/02/11 19:24:22 -0800 PST Server uptime: 742:30:50 Server version: P4D/LINUX26X86_64/2019.2/1927395 (2020/03/04) ServerID: xyz_edge Server services: edge-server Replica of: p4server-01.eng.acme.com:1666 Changelist server: p4server-01.eng.acme.com:1666 Server license: none Case Handling: sensitive scspr2053294001 $

The perforce.dir setting didn't help. Neither did setting perforce.realpath to true.

jimgrier commented 3 years ago

I would take a shot at fixing this. Unfortunately, Typescript is rather far from C/C++/Go. I'd make a hash of it.

Other than this, the extension is marvelous.