A simple Perforce backup script for the home

I use the free license of Perforce on my home network just to ensure version control and management of home coding projects, university thesis stuff, and general files that I just want to ensure I have previous versions of. It’s a really nice part of the Perforce licensing model that I can get two users and five clients for free. My network has my main PC (with Perforce depot), my personal laptop, my wife’s laptop, and my work laptop all connected. It’ll get worse when my four-year old starts wanting to source control things from his PC!

Having been responsible for some pretty heavyweight Perforce installations in my working life, I did not want to forget the golden rule of checkpointing and backing up. While it would not be a disaster if my Perforce data got lost or messed up, it would be an inconvenience. The scripts published on Perforce user forums, however, tend to be focussed on industrial installations and can be quite complex. For the home it is nice to have something more simple.
Continue reading

Perforce server logging problem

When setting up a server it is often useful to enable one of the logging levels. The admin guide states that you need to do this:

  • p4 set P4DEBUG=server=2


which sets the server logging level to 2. You then need to restart the Perforce server.

However, if Perforce is running as a service (the default under Windows), then this does not work. The reason is that “p4 set” only sets the variable in for HKEY_CURRENT_USER in the Windows registry. However, when running as a service, p4d picks up its environment variables from HKEY_LOCAL_MACHINE. To do this you need to set the ‘-s’ flag. E.g.

  • p4 set -s P4DEBUG=server=2