I'm working on a number of projects that are in completely different locations in the depot and I'm wondering if there's any real benefit to using a different workspace for each project versus using a single workspace with the workspace-view comprising a list of client-mappings.
Is there any real benefit to using multiple workspaces here or are they primarily designed for single-user-multiple-machines scenarios? When are multiple workspaces useful?
One "advantage" is that you can have the same file opened multiple times. I quote advantage because perforce has other arguably better ways to deal with that scenario. Another related scenario is the ability to sync down the file twice on one machine. This can be useful for things like headers where consuming code is separated widely in the depot (although for the specific case of a header has other solutions as well). And of course multiple clients are useful for multiple users single machine scenarios as well. You might have a client/user for doing builds separate from one doing development.
The main advantage though is providing a default context for commands like p4 sync, edit etc. While you can specify subsets of your client to sync, and can create multiple pending changelists, this requires some discipline all the time rather than a little discipline upfront. You can still make mistakes with multiple clients and submitting unrelated changes or syncing to the righ label or similar for one piece of code but the wrong one for another, but it reduces the chances of those mistakes by making the universe you're working in smaller.
Perforce has a very rich set (now I sound like an ad) of features for mapping parts of the depot locally. The feature of multiple workspaces makes more sense in the context of those other features. If you can't think of a reason why you'd want to use this functionality, don't. But someday you might find yourself needing to do something weird, so keep it in your pocket.
I use multiple workspaces in order to code on multiple platforms. On my primary Linux PC I have the workspace I use most often. The code also has to support an SGI/Irix platform, so I have a workspace for that machine as well.
I used to have one workspace that was on an NFS drive that was shared among multiple machines, but I get much faster compile times by running locally on the machine. When Perforce supported shelving, I shelve files on one workspace and unshelve in the other.
I also use a workspace for Windows, in which I work on Microsoft Office documents. We have our depot split up into documents and code, with the code mapped to my workspaces on PC/Linux and SGI/Irix. My documents are mapped to my workspace I use on Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With