Creating a remote from an already existing depo

Today, I created a remote depo, so that I can use the DVCS functionality in P4 with one of my projects.

First, I connected to my perforce server and typed:

$p4 remotes

To see all of the remotes that were on the server. Before doing this command you have to type:

$p4 login

Which thankfully, my username on the linux server is the same as my username in the Perforce server so I didn’t have to type that again.

Once I was logged in and saw that there was no remote set up for the project I wanted to use with DVCS, I typed:

$p4 remote PROJECT_CODE_NAME

This brought up NANO (I know some of you out there are rolling your eyes) and I modified the //local/… //remote/… paths to my liking. Remember, the left side represents the local depo representation on your computer and the right side of that mapping is the remote depo representation that is on your Perforce server.

Now, in another terminal, I typed:

$cd PATH_WHERE_YOU_HAVE_YOUR_DEVELOPMENT_WORK
$mkdir PROJECT_CODE_NAME
$cd PROJECT_CODE_NAME
$p4 -u jaimerios clone -p 192.168.1.10:1666 -r PROJECT_CODE_NAME

The last command then takes the files specified in the mapping and clones it to your local filesystem.

You can check that the origin server is set up by typing:

$p4 remote -o origin

Now, in my project, I had two read-only depos in my Perforce server that was for the Boost headers and the Google gtest framework libs.

For those normally import+ folders, I created a symbolic link to those folders that were already on my local filesystem:

$cd PROJECT_CODE_NAME/libs
$ln -s /Users/jaimerios/Development/Perforce/READONLY/libs/Boost ./Boost
$ln -s /Users/jaimerios/Development/Perforce/READONLY/libs/Google ./Google

And so far, everything seems to work well … except there are a few files I want p4 status to ignore, so:

$cd PROJECT_CODE_NAME
$nano .p4ignore

I added some folders and files to ignore and life is good.

So, onto happy coding 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *