문제

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

도움이 되었습니까?

해결책

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?

다른 팁

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).

  • Here's what Perforce says on the subject.
  • Also Eric Sink has a good discussion.
  • I create one view with accesses to many branches. Since branches appear in everyone's view by default, you want to have a user area off the main line.
  • Many engineers are more comfortable with the concept of branches, since they exist in all SCM systems. But views may be concerning, if they haven't seen that concept
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top