Reputation: 576
I am new to Perforce.
What would you consider P4 best practices in terms of views/branches.
Would you create 1 view with access to many branches, or would you create 1 view / branch ?
I am not sure switching between views/worspaces is that easy in Perforce.
Thanks,
Thomas
Upvotes: 2
Views: 1859
Reputation: 4938
I am not sure switching between views/worspaces is that easy in Perforce.
It is easy. Assuming you use the command-line, create a p4config.txt
at the root directory of each client-spec (aka view). In each p4config.txt
, set the P4CLIENT
variable to the name of the client-spec. You can leave the other variables as they are.
Here is my sample p4config.txt
:
P4USER=deepaknag
P4PORT=SJCPperforce01:1666
P4CLIENT=deepaknag_fbsd
Then set the P4CONFIG
environment variable as follows:
export P4CONFIG=p4config.txt
Now it automatically uses the "correct" client-spec whenever you change client directories. Try issuing:
p4 info
in your client directories to verify.
This is also documented in Perforce Knowledge Base (works with p4
for me).
Upvotes: 2
Reputation: 7763
Upvotes: 0
Reputation: 5729
If by "view" you mean workspace (aka client-spec), then I strive to have one client spec for each branch I am working on. I'm assuming by branch you mean you have a typical system where you have mainline, development branches, and maybe release branches too?
The reason for keeping the 1-1 correspondence is it just keeps things simpler. It can also prevent accidents - e.g. when I am in a development client spec, I know I cannot accidentally look at or modify a file of the same name in another branch. This can be a big help when you are down in the depths of a deep source folder hierarchy.
Keeping views "tight" is generally good practice in Peforce - as in anything. It helps server performance, which in turn helps performance of Perforce on your client machine. But beyond performance, I think the concept of only seeing what you need to see - letting the computer do the filtering for you - is just generally a good thing. It lets you concentrate on the job at hand without distraction.
I don't have any difficultly switching workspaces, and there are a number of ways to do this depending on your circumstances and preferences. P4V has a simple drop-down at the top of the left pane, for example. What difficulties are you having switching workspaces?
Upvotes: 6