belkiss / niftyplugins

Simple Perforce integration for Visual Studio 2017 to 2022
MIT License
24 stars 4 forks source link

Better support for multiple workspaces (P4CLIENTs) #33

Closed hcorion closed 2 years ago

hcorion commented 2 years ago

I work with Perforce streams and find myself switching between multiple Workspaces, often with multiple Visual Studio instances open at the same time. This workflow just isn't possible with the current setup. It would be nice to be able to set the P4CLIENT per Solution. I don't mind putting in the work to get this implemented, but I've never worked on a plugin, so if someone could direct me to how I would interface with per-solution settings that would be very helpful.

belkiss commented 2 years ago

Heya!

In such cases I recommend not setting any connection info in nifty but have UseSystemEnv set to true. Then use to the P4CONFIG environment variable, set to a name (usually p4config.txt, see p4 documentation), and create a p4config.txt at the root of each and every workspace you work in, like this:

P4PORT=ssl:ida:3548
P4USER=joe
P4CLIENT=joes_client

Since nifty invokes p4 (or p4vc) directly, all the operations will work in the proper server/workspace :)

Hope that helps!

hcorion commented 2 years ago

Oooh! Very smart! I didn't even think about using p4config.txt for that!