The Linux Page

Perforce under Windows

Each customer has a different tool and at times the same customer changes the tools they are using to a better one.

Here I now have to use Perforce. In general, it is fine, but this system is much more complicated to use than any other source control system I've used before. Does that make it better? It certainly makes me waste a lot more time!

For one thing, I have to use it under MS-Windows and that does not make it any simpler.

There are two ways to make use of the system: (1) with the GUI interface, which simply helps you with handling long lists and paths and offering most of the useful commands available to you; (2) with the command line function simply named p4.

The interface is quite complicated and often uses terms different from others.

Also, the terms differ from the Interface and the command line. For instance, Check Out in the Interface is edit on the command line.

In order to use the command line, you have to do some setup. First of all, make sure that p4 is in your path. Usually something like PATH=...;C:\Program File\Perforce;...

At first, you are not unlikely to run in a few problems with the console itself. For instance, if you run the server in Unicode (a good idea) you need your console to either support Unicode or the client to be informed of the encoding you are using. This is done with setting a variable as in:

  p4 set -s P4CHARSET=winansi

Note: the -s is necessary to save the data in your Registry environment.

Perforce has a page about internationalization here: http://kb.perforce.com/P4dServerReference/Internationalization/Internati...

Without setting that variable, you are likely to get the error: Unicode server permits only unicode enabled clients.

You may want to change your editor as well (P4EDITOR). The rest should already be set as required. Try p4 help set and p4 set for more info about the variables.

Once that's work, just log in with: p4 login and you're ready to work.

  • p4 edit <path>   Check out for editing, does not edit anything, it just marks the file read/write and tells the server the you are the one editing.
  • p4 submit <path>   Check in the edited file. If you did not yet run p4 edit, you will not be able to check in anything. That is, you are not supposed to make a file read/write using the MS-DOS options then expect Perforce to do something about it. This is because your state is known on the server and assumed to always be 100% correct.
  • p4 set varname="<varcontent>" set variable <varname> to the value <varcontent>