CONFIDENTIAL
Perforce Usage
presentation by
Rajan Kodivel
December 15th 2007
Why Perforce
Perforce is a easy to use Software Configuration
Management Tool (SCM).
Available in P4web,P4win,p4(CLI),P4V(p4 Visual).
To manage the Software changes & releases effectively.
It is a fast SCM built to provide maximum control &
minimum interference with high performance.
It is a networked architecture for managing the ‘local-
files’ with ‘central-database’ through Streaming protocol.
2 07/04/23 Perforce Usage CONFIDENTIAL
Concept of Perforce
Workspaces stores local copies of the
files on our computer running P4Win/P4V
which connects perforce server which
manages depots, repositories of the files
under perforce control.
3 07/04/23 Perforce Usage CONFIDENTIAL
Perforce View
Jobs
Pending Branch Labels Client Users
Submitted
Change-lists Specification Specification
Change-lists
4 07/04/23 Perforce Usage CONFIDENTIAL
Display Pane Icons-Details
Stop Operation
Revision History
Revert Change Settings
Sync Bookmarks Diff with Depot
Lock Display Server Info.
Open for Edit Connection View
Unlock Launch Editor
Add
Open for
Delete Submit
Slide No 4
5 07/04/23 Perforce Usage CONFIDENTIAL
Depot Pane-Files Icon
File in the local workspace is
not the latest
File in the Workspace is
most Latest Revision
File is checked out by you
locked for Submission & You have the latest file in Workspace.
6 07/04/23 Perforce Usage CONFIDENTIAL
Client-Spec for creating Workspace
Owner of the Client-Spec
Machine Name hosting this
client-Spec
Client-Machine Root Directory
All file in the P4 sync overwrites
client-space is writable the unopened
writable files
Allows owner to
change/modify/delete files Preserve the time the file
was last submitted in
perforce.
Compress Data sent
between client &
Server
Specifies which Line ending
convention to be used when
synched to local client. All file in the
Options are client-space is
Loacl/unix/Mac/WIN/Share. writable
7 07/04/23 Perforce Usage CONFIDENTIAL
What is ClientSpec or workspace
A Perforce client workspace is a set of directories on the client
machine where you work on file revisions that are managed by
Perforce.
Each workspace is given a name that identifies the client
workspace to the Perforce Server.
If no workspace name is specified (by setting the P4CLIENT
environment variable) the default workspace name is the name of
the client machine. To specify the effective workspace name, set
the P4CLIENT environment variable. A client machine can contain
multiple workspaces.
Perforce manages the files in a client workspace as follows:
• Files in the workspace are created, updated, and deleted as
determined by your changes.
• Write permission is enabled when you edit a file, and disabled
when you submit your changes.
8 07/04/23 Perforce Usage CONFIDENTIAL
Perforce Features
General features
Sync, Add Files, Edit Files, Diff Files ,Submit & Revert files
Lock Files, Unlock files
Integrate Files & Resolve files
Book mark the files.
Special features
Time Lapse View & Annotation.
It enables to display all changes made to a file in a variety of ways
using change list, revision number & date for any range of revisions.
Graph View of change-list
It represents the multiple change-list submitted info in the graphical
pattern.
Configure to view any Editor
Open the files using any editor.
9 07/04/23 Perforce Usage CONFIDENTIAL
Time Lapse View
10 07/04/23 Perforce Usage CONFIDENTIAL
File Integration Methods.
File Integration from One Branch to another Branch can be done for
the following…
Bunch of Change-list
Changes between the date.
Label
Client
Different Revision of Files.
11 07/04/23 Perforce Usage CONFIDENTIAL
P4 commands Classification
Client Workspace Commands
File Manipulation Commands
Change-list Commands
Branching & Merging Commands
Security Commands
Administration commands
Environment Settings commands
Jobs commands
12 07/04/23 Perforce Usage CONFIDENTIAL
Client Workspace Commands
P4 client/P4 workspace
Create or edit a client workspace specification and its
view.
P4 Clients/P4 workspaces
• List all client workspaces currently known to the
system.
P4 flush
•Update a client workspace’s have list without actually
copying any files. It updates only “have List” files on the
Perforce server without copying files into client machine.
13 07/04/23 Perforce Usage CONFIDENTIAL
Client Workspace Commands….Cont…
P4 sync
Copy files from the depot into the workspace. Updates
“have list” and also copies the updated files into client
area.
P4 Where
• Show where a particular file is located, as determined
by the client view.
14 07/04/23 Perforce Usage CONFIDENTIAL
File Manipulation Commands
P4 add
•Open file(s) in a client workspace for addition to the depot.
P4 Delete
•Open file(s) in a client workspace for deletion from the depot.
P4 diff
Compare a client workspace file opened for Edit to a revision in the depot.
P4 diff2
Compare Depot file revisions.
P4 dirs
List the immediate subdirectories of specified depot directories
(ex:P4 dirs //SetTopBox/Branches/…)
P4 edit
Opens file(s) in a client workspace for edit.
15 07/04/23 Perforce Usage CONFIDENTIAL
File Manipulation Commands…cont…
P4 files
Provide information about files in the depot without accessing their contents.
P4 fstat
Dump file info(depot path,clientspec path,Head rev,Headchange,HeadTime etc) in the format
suitable for parsing by scripts (TCL/TK,Pl etc).
P4 lock
Lock an opened file against changelist submission.
P4 print
Print the contents of a depot file revision.
P4 rename
Renaming files under Perforce.
P4 revert
Discard changes made to open files.
P4 sizes
Display size information for files in the depot.
P4 unlock
Release the lock on a file.
16 07/04/23 Perforce Usage CONFIDENTIAL
Change-list Commands
p4 change/p4 changelist
Create or edit a changelist specification.
P4 changelists
List submitted and pending changelists applicable to the clientspec.
P4 describe
Provides information about changelists and the changelists’ files.
p4 filelog
Print detailed information about files’ revisions.
p4 opened
ist files that are open in pending changelists.
P4 reopen
Move opened files between changelists or change the files’ type.
P4 review
List all submitted changelists above a provided changelist number.
P4 submit
Send changes made to open files to the depot.
17 07/04/23 Perforce Usage CONFIDENTIAL
Branching & Merging Commands
P4 branch
Create or edit a branch specification and its view. p4 branch
enables you to construct a mapping between two sets of files
for use with p4 integrate.
P4 branches
List existing branch specifications.
P4 integrate
Open files for branching or merging.
P4 integrated
Show integrations that have been submitted.
18 07/04/23 Perforce Usage CONFIDENTIAL
Branching & Merging commands..Cont.
P4 label
Create or edit a label specification and its view.
P4 labels
Display list of defined labels.
P4 labelsync
Synchronize a label with the contents of the current client workspace.
P4 tag
Tag files with a label. Use p4 tag to tag specified file revisions with a label
P4 resolve
Resolve conflicts between file revisions. Use p4 resolve to combine the contents of two files or file
revisions into a single file revision.
P4 resolved
Display a list of files that have been resolved but not yet submitted.
19 07/04/23 Perforce Usage CONFIDENTIAL
Jobs Commands
P4 fix
Link jobs to the changelists that fix them. The p4 fix command links jobs
(descriptions of work to be done) to a changelist (a set of changes to files that does
the work described by a job).
P4 fixes
List jobs and the changelists that fix them.
P4 job
Create or edit a defect, enhancement request, or other job specification.
P4 jobs
List jobs known to the Perforce server.
P4 jobsepc
Edit the jobs template.
20 07/04/23 Perforce Usage CONFIDENTIAL
Security Commands
P4 group
Add or delete users from a group, or set the maxresults, maxscanrows, and timeout
limits for the members of a group.
P4 groups
List groups of users.
P4 login
Log in to a Perforce server by obtaining a ticket.
p4 logout
Log out of a Perforce server by removing or invalidating a ticket.
P4 passwd
Change a user’s Perforce password on the server.
21 07/04/23 Perforce Usage CONFIDENTIAL
Security Commands…Cont..
P4 protect
Control users’ access to files, directories, and commands.
P4 protects
Display protections in place for a given user, group, or path.
P4 tickets
Display all tickets granted to a user by p4 login. The p4 tickets command lists all
tickets stored in the user’s ticket file.
P4 user
Create or edit Perforce user specifications and preferences.
P4 users
Print a list of all known users of the current server.
22 07/04/23 Perforce Usage CONFIDENTIAL
Administrator Commands
P4 admin
Perform administrative operations on the server.
P4 counter
Access, set, or delete a persistent variable.
P4 counters
Display list of long-term variables used by Perforce and associated scripts.
P4 depot
Create or edit a depot specification.
P4 depots
Display a list of depots known to the Perforce server.
P4 license
Update or display the license file. The p4 license command allows Perforce superusers to update or
display the Perforce license file.
P4 logger
Report changed jobs and changelists. It is meant for use in external programs that call Perforce.
23 07/04/23 Perforce Usage CONFIDENTIAL
Perforce functional Area commands-
Command Line Interface-Cont..
Environment Commands:-
– p4 set, Environment and Registry Variables,
P4AUDIT,P4CHARSET, P4COMMANDCHARSET, P4CLIENT,
P4CONFIG, P4DEBUG,P4DIFF, P4DIFFUNICODE, P4EDITOR,
P4HOST, P4JOURNAL,P4LANGUAGE, P4LOG, P4MERGE,
P4MERGEUNICODE, P4PAGER,P4PASSWD, P4PCACHE,
P4PFSIZE, P4POPTIONS, P4PORT, P4ROOT,P4TARGET,
P4TICKETS, P4USER, PWD, TMP, TEMP
24 07/04/23 Perforce Usage CONFIDENTIAL
Commands Usage-Backup
Commands Usage
BACKUP
25 07/04/23 Perforce Usage CONFIDENTIAL
Main Features
Add Files procedure:
Ensure that the file to be edited is available inside the
workspace directory which is known by the client-spec for the
Perforce server.
Open the files for Add.
From the Pending change-list “Submit” the file with the
description.
26 07/04/23 Perforce Usage CONFIDENTIAL
Sync Command
sync all the code in the client spec to tip of tree…
p4 sync
force sync all the code in the client spec to tip of tree..
p4 sync -f
Force sync grabs all the files even if it exists on the local machine
sync firmware to label SDK_M102.0_rc02
p4 sync //dtvfirmware/…@ SDK_M102.0_rc02
sync drivers to date 2006/12/04
p4 sync //SetTopBox/Branches/X260_dev/…@2006/12/04
27 07/04/23 Perforce Usage CONFIDENTIAL
Sync Command (Cont…)
sync xval_2.0 to changelist 140854 …
Cd /nfsroot/usr/src/x260_dev/validation/testapps/xval_2.0
p4 sync …@140854
sync file xval_vico.cpp and to version #79
p4 sync /nfsroot/usr/src/X260_dev/validation/testapps/xval_2.0/source/
xval_vico.cpp#79
28 07/04/23 Perforce Usage CONFIDENTIAL
ClientSpec
create a clientspec for yourself using clientspec
template_hdtv2_stw_solo_X260_dev_fw as a template..
p4 client –t template_hdtv2_stw_solo_X260_dev_fw
rajan_suse_solo_X260_dev
To make your client Spec as Default Client-Spec….
Export P4CLIENT= rajan_suse_solo_X260_dev
Search for a Client Spec with Search Strings in Perfroce Client Specs…
P4 clients | grep template | grep X260 | grep dev
29 07/04/23 Perforce Usage CONFIDENTIAL
Labels
Create a Label
P4 label <SDK_M28.15_rc01>
Sync the Files with the created Label
P4 labelsync –l SDK_M28.15_rc01
//SetTopBox/Branches/M28/M28_15/…
30 07/04/23 Perforce Usage CONFIDENTIAL
31 07/04/23 Perforce Usage CONFIDENTIAL