Initializing a Personal Server

This section describes how to start up a personal server, presenting two different approaches.

  1. The first approach initializes an empty server. Choose this if you want to work in isolation on a personal server, developing and possibly branching code, and versioning locally. See Run p4 init.
  2. The second approach copies content from another server to populate the newly initialized server with files and history; this is known as cloning. This approach is best when working collectively on an existing project; users work on a set of project files that are managed on a shared server. The users make changes to the files on their personal server and then push the changes to a shared server. The shared server makes these changes available to other project users. At any given time, users can fetch the latest content from the shared server. See Run p4 clone.

Initialize an empty server

Use this approach if you want to work in isolation on a personal server, developing and possibly branching code.

In this workflow, you invoke the p4 init command in your working directory to initialize a personal server and set it up with everything needed to start versioning files.

Read this first

In order to fetch from or push to a shared server, the case sensitivity of your personal server must match that of your shared server. When you run p4 init, Helix attempts to set the case sensitivity of your personal server to match that of the shared server specified in your current P4PORT setting.

If you know which shared server your personal server will be fetching from and pushing to, run p4 init -p, passing in the address of the shared server. This tells the Helix Versioning Engine to discover the shared server’s case sensitivity and Unicode support settings and apply them to your personal server; this makes the two servers compatible.

If Helix can’t discover a shared server, the p4 init command will fail. You must then run this command:

$ p4 init -Cx

where C0 sets the server to case-sensitive and C1 sets it to case-insensitive; set the option to match the case sensitivity of the shared server with which you’re communicating.

Similarly, in order to fetch from or push to a shared server, the Unicode support of your personal server must match that of the shared server. When you run p4 init, Helix attempts to set the Unicode support of your personal server to match that of the shared server specified in your current P4PORT setting. If Helix can’t discover a shared server, Unicode support defaults to off. If you later want to turn Unicode support on, you can run this command:

$ p4d -xi -r /users/username/dvcsdir/.p4root

Run p4 init

Here is the p4 init command syntax:

p4 [-u user] [-d dir] [-c client] init [-h -q] [-c stream] [-Cx] [-xi -n] [-p]

p4 init includes a number of command-line arguments:

  • To configure your personal server without Unicode support, pass the -n option.
  • To have Helix create the personal server’s files in a directory other than the current directory, specify the directory with the -d option.
  • Use the -q option to suppress informational messages.
  • Use the -c [stream] option to create the specified stream as the mainline stream rather than the default //stream/main.

Directories and files

The p4 init command creates the following directories and files in the directory in which the command is invoked:

  • .p4root - A directory containing the database files that will contain the metadata about files checked into Helix.
  • .p4ignore - A list of files Helix shouldn’t add or reconcile.
  • .p4config - A file containing configuration parameters for the client-server connection.

In addition, the p4 init command does the following:

  • Creates a P4CLIENT workspace. Note that the client option allwrite is set by default, making files writable without the need to check them out with p4 edit first. You must, however, issue a p4 reconcile command before shelving or submitting files.
  • Creates a stream depot.
  • Creates an initial stream, called main.

Add files

At this point, you are ready to add files to your server. You can create them, copy them and then run p4 reconcile — or p4 rec for short — to mark all of your source files to be added to Helix and then p4 submit to submit them. If you are new to Helix, see the "Managing Files and Changelists" chapter of the Helix Versioning Engine User Guide.

Prepare to fetch and push content between servers

If you subsequently want to push your work to a shared server or fetch files from a shared server, you must create a remote spec with the p4 remote command. See “Fetching and Pushing” and “Understanding Remotes” for more information.