Working with perforce

If you are new to perforce you came to write place.

To access perforce repositories

You need perforce client


The following is a quick overview of the most common Perforce commands:

     p4 sync     - Sync up with the latest sources
     p4 edit     - Open a file for editing
     p4 add      - Add a new file to the repository
     p4 delete   - Delete a file from the repository
     p4 resolve  - Resolve conflicts if two people edit the same file
     p4 revert   - Revert changes for a currently opened file
     p4 submit   - Submit all changes to the repository
     p4 opened   - List all files you currently have opened




Even to change any single file you must have the entire code base check out.

set client view

cd respective folder

p4 sync

-edit Open an existing file for edit and commit
[usage] p4 edit filename
[usage] p4 submit

-filelog List revision history of files
[usage] p4 filelog filename

-integrate Schedule integration from one file to another
[usage] p4 integrate [FROM] [TO]
*Nore both FROM and TO must be complete file path from //depo or //std on

-p4 have Lists all file revisions that the Perforce server knows you have in the client workspace.
-p4 sync -n Reports what files would be updated in the client workspace by p4 sync without actually performing the sync operation

Creating Branch

p4 branch <branch_name>

  • open p4 client
  • add view
  • //depot/from/… /depot/to/…

p4 integrate -b <branch_name>
p4 submit

6 thoughts on “Working with perforce

  1. Hi,

    This is Santhosh Kumar .R working for Sony India Software.

    I am new to the perforce. Could you please help me out in using perforce.

    We have installed perforce client in Linux machine. Now I am not getting

    1.How to coonect to the server
    2. How to create a work space
    3. How to check-out the files from depo
    4. How to check-in the updated files.

    I request you give the commands usages in detail so that it helps me in understanding perforce better and use it in my project.

  2. Santosh you need to understand the software well before working on it. My suggestion is to read the manual thoroughly before jumping with things

    You go through the manual here

    Setting up your environment for access

    Before you can read or write to the Perforce repository you will need to get an account on the Perforce server. Request your account this will also give you an opportunity to introduce yourself to the community and tell us a little about you plan to do.

    Once you have downloaded the P4 binary and put it on your path, you want to set the following environment variables:

    P4PORT =
    P4EDITOR = (path to your favorite console editor, such as vi)
    where you would replace YOURNAME_YOURMACHINE_YOUROS with a unique name (you can’t use a client workspace that someone else is already using). For instance a valid client workspace name might be: JOEBLOGGS_DEVEL_LINUX

    To check out file you can use “p4 sync”
    To check in you may use “p4 edit” then “p4 submit”

    Hope that answer your question.

  3. Hi Irfan,

    Thanks for the suggestions and guidelines. The manual given by you is very much useful in understanding the perforce usage and I am using it with more confidence and working fine for me.

    One request:

    I am working on Media applications , so I need to writre a code in C++ which extracts the

    1. Exif metada(Exchangeable Image File Format) which is used in all digital cameras.

    2. ID3 metadata from MP3 files.

    May I get the sample code on doing above tasks.

    Thanking You,

    With Regards
    Santhosh Kumar .R

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s