Perforce client setup
In this guide, 'camel' is the name of our perforce server which is listening on port 1666. 'lydian' is your client linux workstation.
This example illustrates how to 'map' two projects from the 'camel' server to your 'lydian' workstation. One project is called 'rocket' and the other is called 'mango'.
Prerequisites
Make sure you have a access to perforce client (p4) and man pages in your local machine. Server 'camel' should be running p4d with depot containing our 'rocket' and 'mango' projects. If not, refer to
perforce server setup guide.
Run following command to see if server/connection is OK.
$ p4 -p camel:1666 info
This should produce server info, etc.
Writing client specifications
First, set an environment variable
P4CONFIG to
.p4config:
$ export P4CONFIG=.p4config
Whenever you execute p4 command, it will look for
.p4config file that contains additional parameters (e.g., user name, server port number, and most importantly, a 'client' name).
Since 'rocket' and 'mango' are completely unrelated projects, we want to have two independent clients, one for each project.
Let's say we want to put 'rocket' sources to
/home/jisooy/work/rocket, and 'mango' to
/home/jisooy/play/mango. First, rocket.
Create directory 'rocket', and create/edit
.p4config:
$ cd /home/jisooy/work
$ mkdir rocket
$ vim .p4client
With your editor, modify .p4client to contain following lines:
P4CLIENT=jisooy-rocket-devel
P4PORT=camel:1666
'jisooy-rocket-devel' will be the name of your 'client'. You can choose your client name differently. We need to do next is to create a 'client' for your 'rocket' project:
$ p4 client
This will bring up a text editor with a template 'client specification'. You're supposed to edit this client specification to suit your need. Important lines are:
Client: jisooy-rocket-devel
Root: /home/jisooy/work/rocket
View: //depot/devel/rocket/... //jisooy-rocket-devel/devel/...
This specifies
- the name of the client (as indicated in .p4config file)
- the client's side root directory for this project
- the mapping between server side's view of project directory and client's view of project directory
When you close the editor, the specification file is sent to the server. There is no local copy of the specification file. So, if you want to modify the specification, you must invoke
p4 client jisooy-rocket-devel, which will retrieve the specification from the server over the network.
After creating your specification, you can sync the head revision of project 'rocket':
$ p4 sync
From now on, when you're working under
/home/jisooy/work/rocket, your p4 command will execute under the context of jisooy-rocket-devel client specification.
Now, let's move on to creating 'mango' project client.
Create directory 'mango', and create/edit
.p4config:
$ cd /home/jisooy/play
$ mkdir mango
$ vim .p4client
Content of .p4client is
P4CLIENT=jisooy-mango-release
P4PORT=camel:1666
Execute
p4 client, and in the editor, specify your client as follows
Client: jisooy-mango-release
Root: /home/jisooy/play/mango
View: //depot/release/mango/... //jisooy-mango-release/release/...
You should be able to check out head revision by
p4 sync.
-- Main.jisooy - 16 Jun 2008