Perforce Revision Control System Lab

Perforce Revision Control System Lab

This lab helps you get started with Perforce.

  1. Set up your client. Set your .bash_profile and /home/user/depot/.p4 file according to the lecture notes. Here is the .p4 file again.
    P4CLIENT=user.nfs
    P4USER=user
    P4PASSWD=
    P4PORT=phantom:1666
    
    Since you haven't set up a password yet, either don't add that line or leave it empty. Set P4CONFIG=.p4 in your .bash_profile.
  2. Verify that you can connect to the server. You should see (with parrt replaced with your user):
    [parrt@nexus depot]$ p4 info
    User name: parrt
    Client name: parrt.nfs
    Client host: nexus.cs.usfca.edu
    Client root: /home/parrt/depot
    Current directory: /home/parrt/depot
    Client address: 138.202.170.4:58303
    Server address: phantom.cs.usfca.edu:1666
    Server root: /var/local/perforce
    Server date: 2003/10/21 13:21:54 -0700 PDT
    Server version: P4D/LINUX24X86/2003.1/46260 (2003/07/03)
    Server license: Univ. of San Francisco 35 users (expires 2004/08/11) 
    
  3. Check out your client:
    $ p4 client -o user.nfs
    
    It will look something like this:
    Client: parrt.nfs
    
    Update: 2004/01/29 11:31:07
    
    Access: 2004/01/29 11:31:07
    
    Owner:  parrt
    
    Description:
            Created by parrt.
    
    Root:   /home/parrt/depot
    
    Options:        noallwrite noclobber nocompress unlocked nomodtime normdir
    
    LineEnd:        local
    
    View:
            //depot/cs342/parrt/... //parrt.nfs/...
    
  4. Make sure you set your password via p4 user. In the editor, add the following line:
    Password: your-password
    
    And then make sure your .p4 file has the correct password.
  5. Your /home/user/depot directory reflects the state of the depot location //depot/cs342/user/depot. Create a subdirectory of depot called test. Then, create files A.java:
    /** A is a test file */
    public class A {
    	int i;
    }
    
    and B.java
    public class B {
      public void foo() {
      }
    }
    
  6. Add the files to the depot with
    $ p4 add *.java
    
  7. Commit the files to the depot with
    $ p4 submit
    
    The editor will come up; type in a description and then exit.
  8. Try to edit A.java. You will see that the file is readonly. Inform perforce that you want to edit the file with:
    $ p4 edit A.java
    
    and now change the comment to include your name.
  9. Ask perforce to tell you what you have changed with
    $ p4 diff A.java
    
  10. Submit to the depot with
    $ p4 submit
    
    Again, type in a description such as "added my name" and exit the editor.
  11. Do a p4 changes to see what changes have been made.