Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
Perforce Training Course, 2010.1
1
Introduction toPerforce for Users
Introduction
• IntroductionsIntroductions
• Class Schedule
• GUI vs. CLI
• About the Exercises
Perforce Training Course, 2010.1
2
Course Contents• Overview• Basic File Operations
H l !• Help!• File Information• Changelist Management• Handling File Conflicts• Client Workspace Management• Labels• Branching and Integration• Job Tracking• P4V
Introduction toPerforce for Users
Overview
Perforce Training Course, 2010.1
3
Overview
• Client/Server ModelClient/Server Model
• Server
• Client Programs
• Changelists
• Client...
The Perforce client-server model
Client
Clientprogram
program
Perforceserver
Clientprogram
Clientprogram
Perforce Training Course, 2010.1
4
The Perforce server
Depot
DatabaseDepot
Perforceserver
Database
Perforce client programs
Joe-adminClient
Workspace
Joe-dev Client
Workspace
P4
P4V
P4Web
. . .. . .
Perforce Training Course, 2010.1
5
Changelists
Changelist3567//depot/Jam/MAIN/src/ape.c#23 edit
//depot/Jam/MAIN/src/bear.c#1 add
//depot/Jam/MAIN/src/eland.c#14 edit
//depot/Jam/MAIN/src/lion.c#3 delete
//depot/Jam/MAIN/src/zebra.c#9 edit
Client ...
• Client machine• Client machine
• Client programs
• Client workspaces
Perforce Training Course, 2010.1
6
Showing connection informationp4 infoUser name: bobClient name: bob-jamClient name: bob jamClient host: marsClient root: c:\workCurrent directory: c:\work\Jam\MAIN\srcClient address: 103.14.25.211:1719Server address: london:1666Server root: /usr/perforce/ /pServer date: 2010/06/15 12:55:14 -0800 PSTServer uptime: 382:14:58Server version: P4D/FREEBSD/2010.1/244883...Server license: Perforce Software 200 users...Case Handling: sensitive
If you have a password in Perforce
• Starting a sessionp4 loginEnter password:User marta logged in.
• Ending a sessionp4 logoutp gUser marta logged out.
Perforce Training Course, 2010.1
7
Commands in this Chapter
• p4 infop4 info• p4 login• p4 logout
Introduction toPerforce for Users
Basic File Operations
Perforce Training Course, 2010.1
8
Basic Operations
• Populating a Client Workspace• Populating a Client Workspace
• Editing, Adding and Deleting Files
• Moving Files
• Reverting Files
• Assessing Current Status
• Submitting Changes
Populating a client workspace
p4 sync//depot/Jam/MAIN/src/README#26 - added as//depot/Jam/MAIN/src/README#26 - added as
c:\work\Jam\MAIN\src\README//depot/Jam/MAIN/src/regexp.c#2 - added as
c:\work\Jam\MAIN\src\regexp.c//depot/Jam/MAIN/src/regexp.h#1 - added as
c:\work\Jam\MAIN\src\regexp.h//depot/Jam/MAIN/src/RELNOTES#77 - added as
c \ ork\Jam\MAIN\src\RELNOTESc:\work\Jam\MAIN\src\RELNOTES//depot/Jam/MAIN/src/rules.c#5 - added as
c:\work\Jam\MAIN\src\rules.c
...etc.
Perforce Training Course, 2010.1
9
Editing client workspace files
cd work\Jam\MAIN\src
p4 edit rules.c rules.h
//depot/Jam/MAIN/src/rules.c#5 - opened for edit//depot/Jam/MAIN/src/rules.h#2 - opened for edit
t d lnotepad rules.cnotepad rules.h
Adding new files
notepad alias.c
notepad check cnotepad check.c
p4 add alias.c check.c
//depot/Jam/MAIN/src/alias.c#1 - opened for add//depot/Jam/MAIN/src/check.c#1 - opened for add
4 dd t bi l dfp4 add -t binary logo.pdf
//depot/Jam/MAIN/images/logo.pdf#1 - opened for add
Perforce Training Course, 2010.1
10
Deleting files
p4 delete exec.c //depot/Jam/MAIN/gizmo/dir.c
//depot/Jam/MAIN/src/exec.c#2 - opened for delete
//depot/Jam/MAIN/gizmo/dir.c#3 - opened for delete
Moving files
p4 edit filemac.c
//depot/Jam/MAIN/src/filemac.c#3 - opened for edit
p4 move filemac.c fileosx.c
//depot/Jam/MAIN/src/fileosx c#1 - moved from//depot/Jam/MAIN/src/fileosx.c#1 moved from
//depot/Jam/MAIN/src/filemac.c#3
Perforce Training Course, 2010.1
11
Reverting client workspace files
p4 revert rules.h alias.c fileosx.c // / / / ///depot/Jam/MAIN/gizmo/dir.c //depot/Jam/MAIN/images/logo.pdf
//depot/Jam/MAIN/gizmo/dir.c#3 – was delete, reverted
//depot/Jam/MAIN/images/logo.pdf#none – was add, abandoned//depot/Jam/MAIN/src/alias.c#none - was add, abandonedp
//depot/Jam/MAIN/src/rules.h#2 - was edit, reverted//depot/Jam/MAIN/src/filemac.c#3 - was move/delete, reverted//depot/Jam/MAIN/src/fileosx.c#none - was move/add, deleted
Assessing work in progress
• Which files are you working on?
• What changes have you made?
Perforce Training Course, 2010.1
12
Which files are you working on?
p4 opened//depot/Jam/MAIN/src/check.c#1 - add default change (text)
//d t/J /MAIN/ / #2 d l t d f lt h (t t)//depot/Jam/MAIN/src/exec.c#2 - delete default change (text)
//depot/Jam/MAIN/src/rules.c#5 - edit default change (text)
//depot/Jam/MAIN/src/filemac.c#3 - move/delete default change (text)
//depot/Jam/MAIN/src/fileosx.c#1 - move/add default change (text)
p4 opened -C bojam//depot/Jam/MAIN/src/make.c#5 - edit default change (text) by bob@bojam//d t/J /MAIN/ / #7 dit d f lt h (t t) b b b@b j//depot/Jam/MAIN/src/rcp.c#7 - edit default change (text) by bob@bojam
p4 opened –u bob//depot/Jam/MAIN/src/make.c#5 - edit default change (text) by bob@bojam//depot/Jam/MAIN/src/rcp.c#7 - edit default change (text) by bob@bojam//depot/Jam/MAIN/src/trans.h#9 - edit default change (text) by bob@jelly
What changes have you made?
p4 diff rules.c
==== //depot/Jam/MAIN/src/rules.c#5 -c:\work\Jam\MAIN\src\rules.c ====
76c76< TARGET target, t = ⌖---> TARGET target *t = ⌖> TARGET target, *t = ⌖
Perforce Training Course, 2010.1
13
Submitting files
Depot
Client Workspace
50565057
5058
5059
5060
rules.c#5check.c#1
exec.c#2
5060
5061
Change 5061 created with 6 open file(s).Ch
Submitting a changelist
p4 submitChange 5061 created with 6 open file(s).Submitting change 5061.Locking 6 files ...add //depot/Jam/MAIN/src/check.c#1delete //depot/Jam/MAIN/src/exec.c#3move/delete //depot/Jam/MAIN/src/filemac.c#2move/add //depot/Jam/Main/src/fileosx.c#1
Change: newDescription:
<enter description here>
Files://depot/Jam/MAIN/src/check.c # add//depot/Jam/MAIN/src/exec c # delete
Added “check” function.Added “check” function.
edit //depot/Jam/MAIN/src/parse.c#7edit //depot/Jam/MAIN/src/rules.c#6Change 5061 submitted..
//depot/Jam/MAIN/src/exec.c # delete//depot/Jam/MAIN/src/filemac.c # move/delete//depot/Jam/MAIN/src/fileosx.c # move/add//depot/Jam/MAIN/src/parse.c # edit//depot/Jam/MAIN/src/rules.c # edit
Perforce Training Course, 2010.1
14
Previewing client workspace file update
p4 sync -n//depot/Jam/MAIN/src/README#27 - updating//depot/Jam/MAIN/src/README#27 updating
c:\work\Jam\MAIN\src\README//depot/Jam/MAIN/src/regexp.c#3 - updating
c:\work\Jam\MAIN\src\regexp.c//depot/Jam/MAIN/src/regexp.h#2 - updating
c:\work\Jam\MAIN\src\regexp.h//depot/Jam/MAIN/src/RELNOTES#79 - updating
c:\work\Jam\MAIN\src\RELNOTESc:\work\Jam\MAIN\src\RELNOTES//depot/Jam/MAIN/src/varexp.c#8 – added as
c:\work\Jam\MAIN\src\varexp.c
...etc.
New Commands in this Chapter
• p4 sync • p4 revertp y
• p4 edit
• p4 add
• p4 delete
• p4 move
p
• p4 opened
• p4 diff
• p4 submit
• p4 move
Perforce Training Course, 2010.1
15
Introduction toPerforce for Users
Help!
Help!
• Command Summary Helpy p
• Help for a Specific Command
• Online Perforce Documentation
• E-mail Perforce
• Perforce-User Mailing ListPerforce User Mailing List
Perforce Training Course, 2010.1
16
Command summary helpp4 help
p4 is Perforce's client tool for the command line. Try:
p4 help simple p4 help commandsp4 help command
p4 help charsetp4 help environmentp4 help filetypes
list most common commandslist all commandshelp on a specific command
help on character set translationlist environment and registry variableslist supported file types
p4 help jobviewp4 help revisionsp4 help usagep4 help views
pp yphelp on jobview syntaxhelp on specifying file revisionsgeneric command line argumentshelp on view syntax
Perforce commands
p4 help commands
Perforce client commands:
add Open a new file to add it to the depotadmin Perform administrative operations on the serverannotate Print file lines along with their revisionsbranch Create or edit a branch specificationbranches Display list of brancheschange Create or edit a changelist descriptionchanges Display list of pending and submitted changelistsg p y p g gchangelist Create or edit a changelist descriptionchangelists Display list of pending and submitted changelists
...etc.
Perforce Training Course, 2010.1
17
Help for a specific commandp4 help delete
delete -- Open an existing file to delete it from the depot
p4 delete [ -c changelist# ] [ -n –v ] file ...
Opens a file that currently exists in the depot for deletion. If the file is present on the client it is removed. If a pending changelist number is given with the -c flag the opened file is associated with that changelist, otherwise it is associated with the 'default' pending changelist.
Files that are deleted generally do not appear on the have list.
The -n flag displays what would be opened for delete without actually changing any files or metadata.
The -v flag allows deleting of files that are not synced into the client workspace.
Documentation on Perforce’s web site
• Introducing Perforce• P4 User’s Guide• Perforce Command Reference• Perforce System Administrator’s Guide• Release Notes
K l d B• Knowledge Base• White Papers
Perforce Training Course, 2010.1
18
Help via E-mail
• E-mail Perforce at:• [email protected]• [email protected]• [email protected]• [email protected]
• Perforce-User mailing list• Subscribe from Perforce web site• Exchange ideas with other Perforce users
New Commands in this Chapter
• p4 helpp4 help
Perforce Training Course, 2010.1
19
Introduction toPerforce for Users
File Information
File patterns
• Wildcardsp4 syncp4 sync ...p4 sync //depot/Jam/MAIN/...p4 sync //depot/Jam/MAIN/doc/J*p4 sync //depot/Jam/MAIN/src/*p4 sync ..\...
L l d t i• Local vs. depot expansionp4 sync *.cp4 sync "*.c"
Perforce Training Course, 2010.1
20
Help for revision specifications
p4 help revisions
Specifying file revisions and revision ranges:Some file-related Perforce client commands can limit theiractions to specific file revisions. A revision specification is tacked onto the end of the filename, andis one of the following:
#rev - A revision number.@change - A change number: the revision as of that change.@client - A client name: the revision on the client.@label - A label name: the revision in the label.@ abe abe a e: t e e s o t e abe .@date - A date or date/time: the revision as of that time.
Either yyyy/mm/dd or yyyy/mm/dd:hh:mm:ssNote that yyyy/mm/dd means yyyy/mm/dd:00:00:00,so if you want to include all events on that day refer to the next day.
#rev has special variants, to be used literally:...
Revision specifications
Type SyntaxRevision number #7Revision number #7
Changelist number @30
Client Workspace name @sams_ws
Label name @rlslabel
Latest revision #head
Revision last synced #have
Non-existent revision #none or #0
Date @2006/08/23
Perforce Training Course, 2010.1
21
Revision specification examplesp4 sync utils.c#2p4 sync utils.c@431p4 diff utils.c@431p4 sync @431p4 changes ...@431p4 changes //depot/Jamgraph/DEV/gizmo/*.c@431p4 files //my_ws/Jamgraph/DEV/src/...@431p4 sync @sams_wsp4 sync @janslabelp4 sync util c#headp4 sync util.c#headp4 files //depot/Acme-api/...#havep4 sync //depot/notes/....txtp4 sync #nonep4 sync util.c@2001/05/29p4 files //depot/Jam/...@2001/05/29:15:37:00
Revision ranges
• Limiting commands to a revision rangep4 changes abc.c@20,@32p4 changes abc.c@20,@32p4 changes [email protected],@jam-2.0
p4 files //depot/Jam/MAIN/...@431,@431
• Some commands accept revision rangesp4 changes p4 integ p4 syncp4 changes p4 integ p4 syncp4 jobs p4 files p4 printp4 fixes
Perforce Training Course, 2010.1
22
Comparing files in the depot
p4 diff2 hash.c#1 hash.c#2
==== //depot/Jam/MAIN/src/hash.c#1 –//depot/Jam/MAIN/src/hash.c#2 ====
2c2,4< * Copyright 1993 Christopher Seiwald.---> * Copyright 1993, 1995 Christopher Seiwald.> *> *> * This file is part of Jam - see jam.c for
Copyright information.
What files have changed?
p4 diff2 -q //depot/...@231 //depot/...@250
==== //depot/Jam/MAIN/src/jam.1#30 (text) –//depot/Jam/MAIN/src/jam.1#32 (text) ==== content
==== //depot/Jam/MAIN/src/jam.c#13 (text) –
//depot/Jam/MAIN/src/jam.c#15 (text) ==== content
==== //depot/Jam/MAIN/src/jam.h#17 (text) –
//depot/Jam/MAIN/src/jam.h#18 (text) ==== content//depot/Ja / /s c/ja . # 8 (te t) co te t
==== <none> - //depot/Jam/MAIN/src/Jambase.ps#1 ====
==== <none> - //depot/Jam/MAIN/src/Jamfile.ps#1 ====
Perforce Training Course, 2010.1
23
Deleting and re-adding a filep4 delete parse.h//depot/Jam/MAIN/src/parse.h#9 - opened for
delete
p4 submitp4 submitChange 5066 created with 1 open file(s).Submitting change 5066.delete //depot/Jam/MAIN/src/parse.h#10Change 5066 submitted.
p4 sync parse.h#9
p4 add parse.h// / / / / #//depot/Jam/MAIN/src/parse.h#10 – opened for add
p4 submitChange 5068 created with 1 open file(s).Submitting change 5068.add //depot/Jam/MAIN/src/parse.h#11Change 5068 submitted.
File reporting
• Depot info for one revision p4 files utils.c// / / / ///depot/Jam/MAIN/gizmo/utils.c#3 -
edit change 121 (text)
p4 files utils.c#2//depot/Jam/MAIN/gizmo/utils.c#2 -
edit change 119 (text)
• Revision history• Revision historyp4 filelog utils.c//depot/Jam/MAIN/gizmo/utils.c... #3 change 121 edit ... ‘add reuse feature’... #2 change 119 edit ... ‘fix startup bug’... #1 change 67 add ... ‘add Gizmo src files’
Perforce Training Course, 2010.1
24
Show file contents with revisions
p4 annotate jam.c//depot/Jam/MAIN/src/jam.c#35 - edit change 627 (text)
/1: /*1: * /+\16: * +\ Copyright 1993, 1996 Christopher Seiwald.
...etc.
p4 annotate -a -c jam.c
//d t/J /MAIN/ /j #35 dit h 627 (t t)//depot/Jam/MAIN/src/jam.c#35 - edit change 627 (text)1-627: /*1-627: * /+\1-1: * +\ Copyright 1993 Christopher Seiwald.30-248: * +\ Copyright 1993, 1995 Christopher Seiwald.
...etc.
Search for patterns in filesp4 grep -e "rules.h" //depot/Jam/MAIN/...@390//depot/Jam/MAIN/src/command.c#8:
# include "rules.h"//depot/Jam/MAIN/src/compile.c#25:
# include "rules.h"//depot/Jam/MAIN/src/compile.c#25:
* directly to the rule (as defined in rules.h).//depot/Jam/MAIN/src/headers.c#5:
# include "rules.h"//depot/Jam/MAIN/src/jam.c#35:
# include "rules.h“//depot/Jam/MAIN/src/Jamfile#55:
regexp.c regexp.h rules.c rules.h scan.c scan.h
...etc.
Perforce Training Course, 2010.1
25
What's in your client workspace?
p4 have
//depot/Jam/MAIN/src/Build.com#7 –\ k\ \ \ \ ildc:\work\Jam\MAIN\src\Build.com
//depot/Jam/MAIN/src/Build.mpw#1 –c:\work\Jam\MAIN\src\Build.mpw
//depot/Jam/MAIN/src/command.c#8 –c:\work\Jam\MAIN\src\command.c
p4 files //depot/Jam/MAIN/src/Build.com#have//depot/Jam/MAIN/src/Build.com#7 –
edit change 4668 (text)
• Base file types:text symlink unicode utf16
File types
binary apple resource
• Workspace storage attributes+x - executable+w - always writable+k - RCS keyword
+ko - RCS keyword (old style)+l - exclusive open+m - sync vs submit modtime
• Server storage attributes+S - latest revision+C - compressed
+k RCS keyword +m sync vs. submit modtime
+D - deltas+F - full file
Perforce Training Course, 2010.1
26
Changing existing file types
p4 edit -t text genfilesp4 edit t text genfiles
p4 reopen -t binary+lm doit
p4 reopen -t +w runtime.txt
New Commands in this Chapter
• p4 help revisions • p4 filelog• p4 help revisions• p4 changes• p4 have• p4 files
• p4 filelog• p4 annotate• p4 diff2• p4 reopen
Perforce Training Course, 2010.1
27
Introduction toPerforce for Users
Changelist Management
Change: new
Working with multiple changelists
p4 change
Change: newClient: bob-jamUser: bobStatus: newDescription:
<enter description here>Files
Fix off-by-one error.Files:
//depot/Jam/MAIN/src/compile.c # edit
Change 5069 created with 1 open file(s).
Perforce Training Course, 2010.1
28
Editing the new changelist
p4 change 5069
Change: 5069Change: 5069Client: bob-jamUser: bobStatus: pendingDescription:
Fix off-by-one error. Use UTC time.y
Files://depot/Jam/MAIN/src/compile.c #edit
Manipulating files in changelists
• Open files into specific changelistp4 edit -c 1542 //cl/Jam/MAIN/src/make.c
p4 add -c 528 hash.h hash.c
p4 delete -c 49 //depot/Jam/MAIN/src/filent.c
• M fil b t h li tp4 reopen -c 1542 *.sh
p4 reopen -c default //...
• Move open files between changelists
Perforce Training Course, 2010.1
29
Listing changelists
p4 changes headers cp4 changes headers.c
Change 316 ... 'Finalized jam support for actio'Change 284 ... 'Support for multiple :'s on jam'Change 77 ... 'Include newstr.'Change 30 ... 'Copyright info.'Change 1 ... 'Initial revision'
p4 submit c 5072
Submitting a numbered changelist
p4 submit -c 5072
Submitting change 5072.Locking 3 files ...add //depot/Jam/MAIN/src/newstr.c#1delete //depot/Jam/MAIN/src/execmac.c#3edit //depot/Jam/MAIN/src/rules.c#7Change 5072 renamed 5079 and submitted.
Perforce Training Course, 2010.1
30
Shelving opened filesp4 shelveShelving files for change 700.di //d / / / /j #45Change: newedit //depot/Jam/MAIN/src/jam.c#45edit //depot/Jam/MAIN/src/lists.c#6edit //depot/Jam/MAIN/src/lists.h#4Change 700 files shelved.
Client: bob-jamUser: bobStatus: newDescription:
<enter description here>Files:// / / / /
Shelving current edits.
//depot/Jam/MAIN/src/jam.c # edit//depot/Jam/MAIN/src/lists.c # edit//depot/Jam/MAIN/src/lists.h # edit
p4 revert //...
Shelved files are accessible to other users
p4 unshelve -s 700//depot/Jam/MAIN/src/jam.c#45 - unshelved,
opened for editopened for edit//depot/Jam/MAIN/src/lists.c#6 - unshelved,
opened for edit//depot/Jam/MAIN/src/lists.h#4 - unshelved,
opened for edit
p4 diff jam.c@=700//d / / / /j #45==== //depot/Jam/MAIN/src/jam.c#45 –c:\earl-os2\Jam\MAIN\src\jam.c ====
37,39d36< # ifdef NTFS< # include "daylight.h"< # endif
Perforce Training Course, 2010.1
31
Owners may delete shelved files
p4 changes -s shelvedChange 700 on 2009/11/06 by bob@bob-jam *pending* 'Shelvingcurrent edits. '
4 h l d 700p4 shelve -d -c 700Shelve 700 deleted.
Showing changelist detail
p4 describe 135Change 135 by earl@earl-dev on 2000/07/02 10:15:38
Windows NT changes.Affected files ...... //depot/Jam/MAIN/src/Jambase#52 edit... //depot/Jam/MAIN/src/Jamfile#18 edit... //depot/Jam/MAIN/src/RELNOTES#15 editDifferences ...==== //depot/Jam/MAIN/src/Jambase#52 (text) ====
...etc.
Perforce Training Course, 2010.1
32
New Commands in this Chapter
• p4 changep4 change
• p4 shelve
• p4 unshelve
4 d ib• p4 describe
Introduction toPerforce for Users
Handling File Conflicts
Perforce Training Course, 2010.1
33
Handling File Conflicts
• File ConflictsFile Conflicts
• Resolving Conflicts
• Conflicting Diffs
• Reporting Commands
• Backing out a Changelist
File conflicts
T dit th fil• Two users edit the same file
• First user submits
• Second user submits or re-syncs
• Resolve is ‘scheduled’• Resolve is scheduled
Perforce Training Course, 2010.1
34
xyz.cp4 syncp4 editp4 submit
p4 syncp4 editp4 submit
p4 syncp4 editp4 syncp4 edit
xyz.c
depotjon-jam ann-jamxyz.c#3
xyz.c#4p4 submitp4 submit
p4 submitp4 submit
A failedxyz.cp4 resolvep4 resolve
p4 submitp4 submitxyz.c#5
A failedsubmit
A failed submit
p4 submitCh 5085 t d ith 4 fil ( )Change 5085 created with 4 open file(s).Submitting change 5085.//depot/Jam/MAIN/src/rules.c -must resolve before submitting
//depot/Jam/MAIN/src/rules.c –must resolve #6,#7
Out of date files must be resolved orOut of date files must be resolved orreverted.
Submit failed -- fix problems above then use ‘p4 submit -c 5085’.
Perforce Training Course, 2010.1
35
When to use resolve
• After a failed submitAfter a failed submit
• After re-syncing opened files
• When integrating between branches
depotclient workspace
xyz.c#3
“b ”“b ”editor
xyz.c
“base”“base”
“merged”“merged”
xyz.c
“yours”“yours”xyz.c#4
“theirs”“theirs”xyz.c
“result”“result”
gg
Perforce Training Course, 2010.1
36
Resolve interactively
p4 resolvep
c:\work\Jam\MAIN\src\rules.c- merging //depot/Jam/MAIN/src/rules.c#6,#7
Diff chunks: 0 yours + 1 theirs + 0 both + 1 conflicting
Accept(a) Edit(e) Diff(d) Merge (m) Skip(s) Help(?) e:Skip(s) Help(?) e:
Using resolve help
p4 resolve...Accept(a) Edit(e) Diff(d) Merge(m)
Skip(s) Help(?) e: ?...Accept:at Keep only changes to their file.ay Keep only changes to your file.y p y g yam Keep merged file.ae Keep merged and edited file.a Keep autoselected file.
...
Perforce Training Course, 2010.1
37
Resolve’s “accept” actions
• Accept mergedAccept merged
• Accept edited
• Accept theirs
• Accept yoursp y
Before accepting, you can...
Edit... Diff...• merged file
• your file
• their file (read-only)
• yours vs. base
• theirs vs. base
• merged vs. base
• merged vs. yours
Skip• to resolve later, or revert
Perforce Training Course, 2010.1
38
Resolving conflicting diffs
• T pes of diff ch nks• Types of diff chunks• theirs
• yours
• both
• conflicting
Conflict markers in the merged file
# include "jam.h"# include "option.h"
# include "jam.h"# include "option.h"
theirs yours
# include option.h# include "patchlev.h"# include "make.h"
# include option.h# include "patchlevel.h"# include "make.h"
# include "jam.h"# include "option.h"
# include "jam.h"# include "option.h">>>> ORIGINAL //depot/Jam/MAIN/xyz c#3
merged result (after editing)
# ifdef FATFS# include "patchlev.h"# else# include "patchlevel.h"# endif# include "make.h"
>>>> ORIGINAL //depot/Jam/MAIN/xyz.c#3==== THEIRS //depot/Jam/MAIN/xyz.c#4# include "patchlev.h"==== YOURS //bruno_ws/Jam/MAIN/xyz.c# include "patchlevel.h"<<<<# include "make.h"
Perforce Training Course, 2010.1
39
Resolve many files by accepting...
• Yours (workspace file)p4 resolve -ay
• Theirs (depot file)p4 resolve -at
• Yours or theirs, if only one differsp4 resolve -as
• Yours, theirs or merged, if no conflictsp4 resolve -am
Textual vs. binary resolves
• Three-way resolvesO t t t fil• Operate on text files
• Use Yours, Theirs, and Base• Files can be merged
• Two-way resolves• Operate (by default) on binary files• No binary diffs stored, so files can’t be merged• Resolve choices: accept yours or theirs
Perforce Training Course, 2010.1
40
Showing which files need resolvingp4 resolve -nc:\work\Jam\MAIN\src\rules.c -
merging //depot/Jam/MAIN/src/rules.c#6,#7
Listing files already resolvedp4 resolvedc:\work\Jam\MAIN\src\hash.c -
merged from //depot/Jam/MAIN/src/hash.c#4,#6
Re-doing a resolvep4 resolve -f hash.c
Showing revision at last sync
p4 have rules.c//depot/Jam/MAIN/src/rules.c#5 –
c:\work\Jam\MAIN\src\rules.c
Locking files
p4 lock rules cp4 lock rules.c
//depot/Jam/MAIN/src/rules.c - locking
Perforce Training Course, 2010.1
41
Showing opened filesp4 opened//depot/Jam/MAIN/src/check.c#1 - add change 5085//depot/Jam/MAIN/src/exec c#2 delete change 5085
Showing pending changelists
//depot/Jam/MAIN/src/exec.c#2 - delete change 5085//depot/Jam/MAIN/src/hash.c#6 – edit change 5085//depot/Jam/MAIN/src/rules.c#7 - edit change 5085
p4 changes –s pending
Change 5085 on 2005/11/27 by bob@bob-jam*pending* 'Added "check" function '
p4 submit -c 5085
Resubmitting a changelist
p4 submit c 5085
Submitting change 5085.Locking 4 files ...add //depot/Jam/MAIN/src/check.c#1delete //depot/Jam/MAIN/src/exec.c#3edit //depot/Jam/MAIN/src/hash.c#7dit //d t/J /MAIN/ / l #8edit //depot/Jam/MAIN/src/rules.c#8Change 5085 renamed change 5089 and submitted.
Perforce Training Course, 2010.1
42
When submit fails
• Default changelist becomes numberedDefault changelist becomes numbered changelist
• Depot and client workspace files unchanged
• Out-of-date files marked unresolved and opened at #headopened at #head
Why submit fails
• If it is interruptedp
• If any file in the changelist is:• not opened at #head
• unresolved
• locked in another client workspacep
• not accessible in your client workspace
Perforce Training Course, 2010.1
43
depotjon-jam ann-jam
xyz.cp4 syncp4 syncp4 editp4 editp4 syncp4 syncp4 editp4 edit
xyz.cp4 syncp4 syncp4 editp4 editp4 submitp4 submit
p4 syncp4 syncp4 editp4 editp4 submitp4 submit
xyz.c#3
Re-syncingd
xyz.c
p4 syncp4 syncp4 syncp4 syncp4 resolvep4 resolvep4 resolvep4 resolve
xyz.c#4pppp
an openedfilep4 submitp4 submitp4 submitp4 submit xyz.c#5
Re-syncing client workspace with opened files
p4 sync
//depot/Jam/MAIN/src/regexp.c#5 - updating c:\work\Jam\MAIN\src\regexp.c
//depot/Jam/MAIN/src/regexp.h#9 - updating c:\work\Jam\MAIN\src\regexp.h
//depot/Jam/MAIN/src/RELNOTES#79 - is d d t b i h dopened and not being changed
... //depot/Jam/MAIN/src/RELNOTES must resolve #79 before submitting
Perforce Training Course, 2010.1
44
Backing out a changelist
p4 sync @6024
p4 edit index c command hp4 edit index.c command.h
p4 sync
p4 resolve -ay
p4 submitCh 6026 t d ith 2 fil ( )Change 6026 created with 2 open file(s).Locking 2 files ...Submitting change 6026.edit //depot/Jam/MAIN/src/index.c#11edit //depot/Jam/MAIN/src/command.h#6Change 6026 submitted.
New Commands in this Chapter
• p4 resolvep
• p4 resolved
• p4 lock
Perforce Training Course, 2010.1
45
Introduction toPerforce for Users
Client Workspace Management
Client Workspace Management
• Creating a Client Workspace• Creating a Client Workspace
• Client Workspace View Mappings
• Referring to Files: Three Syntaxes
• Working OfflineWorking Offline
• Environment Setup
Perforce Training Course, 2010.1
46
Client workspaces
Client workspace spec includesClient workspace spec includes
• Name
• Root
• View of the depotView of the depot
Creating a client workspace specp4 clientClient: bob-devU d t 2009/11/15 12 39 47Update: 2009/11/15 12:39:47Access: 2010/06/03 16:33:25Owner: bobHost: perseusDescription:
Bob's main development workspace.Root: c:\workOptions: noallwrite noclobber nocompress unlocked
nomodtime normdirSubmitOptions: submitunchangedLineEnd: localView://depot/Jam/MAIN/... //bob-dev/Jam/MAIN/...
Perforce Training Course, 2010.1
47
Client workspace view mappings
Client: bob-jam
p4 client
Root: c:\p4work
View://depot/Jam/MAIN/src/... //bob-jam/Jam/MAIN/src/...
-//depot/Jam/MAIN/src/tests/... //bob-jam/Jam/MAIN/src/tests/...
//depot/Jam/MAIN/src/*.h //bob-jam/Jam/MAIN/src/hfiles/*.h
//depot/Jam/MAIN/cfg/* //bob-jam/Jam/MAIN/config/*//depot/Jam/MAIN/cfg/ //bob jam/Jam/MAIN/config/
//depot/Acme-api/....cpp //bob-jam/Acme-api/....CC
//depot/Jam/REL1.0/src/... //bob-jam/Jam/REL1.0/src/...
+//depot/Jam/PATCH1.0/src/... //bob-jam/Jam/REL1.0/src/...
Client workspace options
• Sync options[no]allwrite [no]compress[no]clobber [un]locked[no]modtime [no]rmdir
• Submit optionssubmitunchangedrevertunchangedrevertunchangedleaveunchanged
• LineEnd valueslocal unix mac win share
Perforce Training Course, 2010.1
48
Creating additional client workspaces
• Use multiple client workspaces
p4 client bob-jam-project_a
• Copy a client workspace’s view and options
p4 client -t bob-jam-dev mary-jam-dev
• List only your user’s client workspace specs
p4 clients -u bob
Commands that start up a text editor
p4 client p4 branchp4 clientp4 submitp4 changep4 user
p4 branchp4 jobp4 label
Perforce Training Course, 2010.1
49
Testing client workspace view mappings
• Show depot and client workspace paths
p4 where command.c//depot/Jam/MAIN/src/command.c //mel-dev/Jam/MAIN/src/command.c d:\mel-dev\Jam\MAIN\src\command.c
• File doesn’t have to exist for p4 where to work
Referencing files
• Depot syntaxp4 sync //depot/Jam/MAIN/src/util cp4 sync //depot/Jam/MAIN/src/util.c
• Client Workspace syntax
p4 sync //jungle-jam/Jam/MAIN/src/util.c
• Local syntaxLocal syntaxp4 sync util.cp4 sync c:\work\Jam\MAIN\src\util.cp4 sync ..\src\util.c
Perforce Training Course, 2010.1
50
Listing client workspace files altered offline
p4 diff -seContents changed since last sync
p4 diff -sdFiles removed since last syncy
Building a changelist after working detached
cd c:\sean-jam\Jam\MAIN\srccd c:\sean jam\Jam\MAIN\src
dir /s/b/a-d | p4 -x - add
p4 diff -sd ... | p4 -x - delete
p4 diff -se ... | p4 -x - edit
Perforce Training Course, 2010.1
51
New Commands in this Chapter, Part 1
• p4 client• p4 client
• p4 where
• p4 diff -sd
• p4 diff -se
• p4 -x - or p4 -x filename
Client Workspace Management
Intermission!
Client Workspace Management Exercises Part 1
Perforce Training Course, 2010.1
52
Environment setup
• Showing connection information
• Resetting server port and client workspace
• Setting the Perforce configuration
Showing connection information
p4 infoUser name: bobClient name: bob-jamClient host: marsClient root: c:\workCurrent directory: c:\work\Jam\MAIN\srcClient address: 103.14.25.211:1719Server address: london:1666Server root: /usr/perforceServer root: /usr/perforceServer date: 2010/06/15 14:55:14 -0800 PSTServer uptime: 384:14:58Server version: P4D/FREEBSD/2010.1/244883...Server license: Perforce Software 200 users...Case Handling: sensitive
Perforce Training Course, 2010.1
53
Setting server port and client workspace
• Unixsetenv P4PORT neptune:1666
setenv P4CLIENT lisas-jam-dev
• Windowsp4 set P4PORT=neptune:1666
p4 set P4CLIENT=lisas-jam-dev
Using Environment or Registry Variables
Variable Default
• P4CLIENT
• P4PORT
• P4USER
host machine name
perforce:1666
$USER or %USERNAME%
Variable Default
Perforce Training Course, 2010.1
54
Using command-line flags
• Command syntax
• -p <port> -u <user> -c <clientname>
p4 usageflags
command command flags
filepatterns
p4 -p mars:1666 -u amir -c amir-api client
p4 -c rlo-jam-main sync -n
Using configuration files
• Set P4CONFIG to a file nameSet P4CONFIG to a file name
p4 set P4CONFIG=config.txt
• Place files in client workspace roots
• List environment variables in filesList environment variables in files
P4PORT=lemon:1909
P4CLIENT=graphics_proj
Perforce Training Course, 2010.1
55
P4CONFIG exampleEnvironment Variables:Environment Variables:P4PORT=perforce:1666P4PORT=perforce:1666P4CLIENT=P4CLIENT=jonjon--jamjam--mainmainP4USER=P4USER=jonjonP4CONFIG=config.txtP4CONFIG=config.txt
C:\Doc\Projects\
P4PORT=tyro:1777P4CLIENT=jon-jamgraph-docs
Jam\MAIN\
Jamgraph\MAIN\
docs
docs
config.txtconfig.txt
fi t tfi t t
P4PORT=pine:1666P4CLIENT=jon-talk-docs
config.txtconfig.txt
config.txtconfig.txt
docs
Talkhouse\MAIN\
config.txtconfig.txt
Configuration order of precedence
• Command-line flags
• P4CONFIG files
• Environment variable settings
• Registry variable settings (on Windows)
• Default environment variable values
Perforce Training Course, 2010.1
56
Setting a password
• Use p4 passwd to set password on server
• A ‘strong’ password...
• ...is at least eight characters
• ...includes two of:• Upper case charactersUpper case characters• Lower case characters• Non-alphabetic characters
User authentication
• Log in to get a ticketp4 login
• Password use depends on security level:0 or 1 –
Can use environment or registry variable
2 –setenv P4PASSWD password (some UNIX)
p4 -P password <command>
3 –Password-based authentication rejected
Perforce Training Course, 2010.1
57
Other environment variables
• P4EDITOR , P4DIFF, P4MERGE, ,
• TMP, TEMP, P4TICKETS
• P4CHARSET
New Commands in this Chapter, Part 2
• p4 set
• p4 [flags]
• p4 passwd
Perforce Training Course, 2010.1
58
Introduction toPerforce for Users
Labels
About Labels
• Labels vs. Changelist NumbersLabels vs. Changelist Numbers
• Creating a Label
• Tagging Files with a Label
• Static vs. Automatic Labels
• Locking a Label
Perforce Training Course, 2010.1
59
Labels vs. changelist numbers
U d t i d fil t• User-determined file set
• Can be changed
• Meaningful names
Tagging files with a label (static)
p4 tag -l release1 //depot/Jam/R1.0/...
//depot/Jam/R1.0/svr/jamfile#1 - added//depot/Jam/R1.0/svr/libsvc.c#3 - added//depot/Jam/R1.0/svr/libsvc.h#5 - added//depot/Jam/R1.0/svr/rmtsvc.c#8 - added//depot/Jam/R1.0/svr/rmtsvc.h#2 - added//depot/Jam/R1.0/svr/userhelp.c#4 - added
...etc.
Perforce Training Course, 2010.1
60
Label: goodbuild
Creating a label specification
p4 label goodbuild
Owner: bob
Description:Build label for development work.
Options: unlocked
View://depot/Jam/MAIN/svr/...//depot/Jam/MAIN/api/...-//depot/Jam/MAIN/api/db/...
Tagging client workspace files (static)
p4 labelsync -l goodbuild
//depot/Jam/MAIN/svr/jamfile#2 - added//depot/Jam/MAIN/svr/libsvc.c#4 - added//depot/Jam/MAIN/svr/libsvc.h#3 - added//depot/Jam/MAIN/svr/rmtsvc.c#6 - added//depot/Jam/MAIN/svr/rmtsvc h#10 - added//depot/Jam/MAIN/svr/rmtsvc.h#10 added//depot/Jam/MAIN/svr/userhelp.c#7 - added
...etc.
Perforce Training Course, 2010.1
61
Updating files tagged with a label
p4 labelsync -l goodbuild //depot/Jam/MAIN/api/...
p4 labelsync -l goodbuild //depot/Jam/MAIN/api/key.c#7
p4 labelsync -a -l goodbuild //depot/Jam/MAIN/svr/...
p4 labelsync -d -l goodbuild //depot/Jam/MAIN/svr/spec/p4 labelsync -d -l goodbuild //depot/Jam/MAIN/svr/spec/...
Automatic labels
Label: MAIN-build-apr23 10
p4 label MAIN-build-apr23_10Label: MAIN build apr23_10
Owner: bob
Description:April 23, 2010, build file set.
Options: unlocked
Revision: @10357
View://depot/Jam/MAIN/svr/... //depot/Jam/MAIN/api/...
Perforce Training Course, 2010.1
62
Syncing your client workspace to a label
p4 sync @release1
p4 sync //depot/Jam/R1.0/api/...@release1
p4 sync //depot/Jam/R1.0/svr/rmtsvc.h@release1
Showing files tagged with a label
p4 files @release1
p4 files //depot/Jam/R1.0/api/...@release1
p4 files //depot/Jam/R1.0/svr/libsvc.h@release1
Perforce Training Course, 2010.1
63
Locking a label
p4 label jam1.0Label: jam1 0Label: jam1.0
Owner: bob
Description:Label for Release 1 - production.
Options: lockedOptions: locked
View://depot/Jam/REL1.0/...
Showing labelsp4 labels –e "jam-*"Label jam-1.1.0 2008/01/09 'Created by earl. '
Label jam-2.0.5 2009/01/01 'Created by earl. 'Label jam 2.0.5 2009/01/01 Created by earl.
Label jam-2.1.0 2009/05/04 'Created by earl. '
Label jam-2.1.0-mac-export 2009/05/06 'Created by earl. '
Label jam-2.2.1 2010/05/03 'Created by bruno. '
...etc.
p4 labels //depot/Jam/MAIN/src/jam.c#1,#20Label jam-1.1.0 2008/01/09 'Created by earl. '
Label jam-2.0.5 2009/01/01 'Created by earl. '
Label jam-2.1.0 2009/05/04 'Created by earl. '
...etc.
Perforce Training Course, 2010.1
64
New Commands in this Chapter
• p4 tagp g
• p4 label
• p4 labelsync
• p4 sync @labelname
• p4 files @labelname
• p4 labels
Introduction toPerforce for Users
Branching and Integration
Perforce Training Course, 2010.1
65
Branching and integration
• Inter-File BranchingInter File Branching
• Creating a Branch
• Propagating Changes Between Branches
• Selective Integrations
• Renaming Files
What “integrate” means in Perforce
• Copying a branch to create a new one
• Propagating changes between branches
Perforce Training Course, 2010.1
66
Creating a branch
//depot/Jam/R1.0/...target
//depot/Jam/MAIN/...source
MAIN
R1.0
Integrating by branch specification
• Branch spec view stores source/target pairs• Branch spec view stores source/target pairs
• Integrate using branch spec name
• Create new branch
• Re-use to propagate changes
Perforce Training Course, 2010.1
67
Creating a branch specification
p4 branch JamMAIN-to-R1.0
Branch: JamMAIN-to-R1.0
Owner: bobDescription:
Jam Release 1.0 branch for Server & APIOptions: unlockedView://d t/J /MAIN/ / //d t/J /R1 0/ ///depot/Jam/MAIN/svr/... //depot/Jam/R1.0/svr/...//depot/Jam/MAIN/api/... //depot/Jam/R1.0/api/...
target pathssource paths
Integration steps (new branch)
• Add target branch to client workspace view
• Open files for integration
• Submit files
Perforce Training Course, 2010.1
68
Client ben jam
Add target branch to client workspace view
p4 client
Client: ben-jamDescription:
Ben’s Jam client workspace.Root: c:\demoView:
//depot/Jam/MAIN/... //ben-jam/Jam/MAIN/...//d t/J /R1 0/ //b j /J /R1 0///depot/Jam/R1.0/... //ben-jam/Jam/R1.0/...
Put target branchin this list
Creating a new branch using a branch spec
p4 integ -b JamMAIN-to-R1.0
//depot/Jam/R1 0/svr/regexp h#1 - branch/sync//depot/Jam/R1.0/svr/regexp.h#1 - branch/sync from //depot/Jam/MAIN/svr/regexp.h#1,#3
//depot/Jam/R1.0/svr/rules.c#1 - branch/sync from //depot/Jam/MAIN/svr/rules.c#1,#7
//depot/Jam/R1.0/svr/rules.h#1 - branch/sync from //depot/Jam/MAIN/svr/rules.h#1,#4
...etc.
p4 submit...
Perforce Training Course, 2010.1
69
depotclient workspace
p4 client
p4 submit
p4 integ -b JamMAIN-to-R1.0
p
xyz.c
MAIN/svr/xyz.c#6
R1.0/svr/xyz.c#1C:\demo\Jam\R1.0\svr\xyz.c
Propagating changes across branches
MAIN
R1.0
Perforce Training Course, 2010.1
70
Integration steps (propagation)
• Check client workspace viewCheck client workspace view
• Open files for integration
• Resolve
• Submit
Propagating changes using a branch spec
p4 integ -r -b JamMAIN-to-R1.0//depot/Jam/MAIN/api/make.c#4 - integrate from
//depot/Jam/R1.0/api/make.c#2,#3//depot/Jam/MAIN/api/make1.c#7 - integrate from
//depot/Jam/R1.0/api/make1.c#2
p4 resolve...
p4 submit...
Perforce Training Course, 2010.1
71
depotclient workspace
p4 submit
R1.0/api/xyz.c#3p4 resolvep4 integ -r -b JamMAIN-to-R1.0
xyz.c
editor“base”“base”
xyz.c“yours”“yours”
R1.0/api/xyz.c#4
xyz.cMAIN/api/xyz.c#8
MAIN/api/xyz.c#9“merged”“merged”
xyz.c
“result”“result”
“theirs”“theirs”
Resolving for integrate
Th i S• Theirs = Source
• Yours = Target
• Base = Closest common ancestor
Perforce Training Course, 2010.1
72
What is the history of a branched file?
p4 filelog -i //depot/Jam/REL2.1/src/hash.c
//depot/Jam/REL2.1/src/hash.c#2 869 2006/10/13 @... #2 change 869 edit on 2006/10/13 by quinn@quinn-integ (text) 'Fixed off-by-one error. '
... #1 change 749 branch on 2004/11/23 by ines@ines-rose (text) 'Create Jam 2.1 release branch. '
... ... branch from //depot/Jam/MAIN/src/hash.c#1,#3//depot/Jam/MAIN/src/hash.c... #3 change 137 edit on 1999/05/02 by earl@earl-dev-
guava (text) 'Get all function declarations. 'guava (text) Get all function declarations. ... ... branch into //depot/Jam/REL2.1/src/hash.c#1... #2 change 30 edit on 1999/01/10 by earl@earl-dev-
guava (text) 'Copyright info. '... ... branch into //depot/Jam/REL2.0/src/hash.c#1... #1 change 1 add on 1998/09/23 by earl@earl-dev-guava
(text) 'Initial revision '
New Commands in this Chapter, Part 1
• p4 branchp4 branch
• p4 integ
• p4 filelog -i
Perforce Training Course, 2010.1
73
Branching and Integration
Intermission!
Branching & Integration Exercises Part 1
Creating a new branch using a file spec
p4 integ //depot/Jam/MAIN/... //depot/Jam/R1.0/...
//depot/Jam/R1.0/src/Regexp.c#1 - branch/sync from //depot/Jam/MAIN/src/regexp.c#1,#2
//depot/Jam/R1.0/src/Regexp.h#1 - branch/sync from //depot/Jam/MAIN/src/regexp.h#1
//depot/Jam/R1.0/src/RELNOTES#1 - branch/sync from //depot/Jam/MAIN/src/RELNOTES#1,#77
etc...etc.
p4 submit...
Perforce Training Course, 2010.1
74
depotclient workspace
p4 client
p4 submit
p4 integrate //depot/Jam/MAIN/... //depot/Jam/R1.0/....
xyz.c
MAIN/svr/xyz.c#6
R1.0/svr/xyz.c#1C:\demo\Jam\R1.0\svr\xyz.c
Propagating changes using a file spec
p4 integ //depot/Jam/R1.0/... //depot/Jam/MAIN/...
//d t/J /MAIN/ / k #4 i t t f//depot/Jam/MAIN/src/make.c#4 - integrate from
//depot/Jam/R1.0/src/make.c#2,#3//depot/Jam/MAIN/src/make1.c#7 - integrate from
//depot/Jam/R1.0/src/make1.c#2
p4 resolve...
p4 submit...
Perforce Training Course, 2010.1
75
depotclient workspace
p4 submitR1.0/api/xyz.c#3
p4 resolve
p4 integ //depot/Jam/R1.0/... //depot/Jam/MAIN/...
xyz.c
editor “base”“base”
xyz.c“yours”“yours”
R1.0/api/xyz.c#4
xyz.cMAIN/api/xyz.c#8
MAIN/api/xyz.c#9“merged”“merged”
xyz.c
“result”“result”
“theirs”“theirs”
What changelists have been integrated?
p4 changes -i //depot/Jam/R1.0/...
Change 5047 on 2008/12/29 by bob@bob-jam 'Create release branch'
Change 5028 on 2008/12/23 by baron@baron-bios 'Upgrade to latest metrowerks on'
Change 5026 on 2008/12/22 by jean@jean-spice 'Added all the old press release'
Change 5025 on 2008/12/22 by jean@jean-spiceChange 5025 on 2008/12/22 by jean@jean spice 'Press releases now just use standard'
Change 5014 on 2008/12/19 by berger@berger-spice 'Put in fix for jam's NT handle '
...etc.
Perforce Training Course, 2010.1
76
More on p4 changes -i
MAIN
197178p4 changes -i
p4 changes
R1.0
163
167148 155141121 192
What integrations have been performed?
p4 integrated //depot/Jam/MAIN/...
//depot/Jam/MAIN/src/jam.html#1,#4 - branch into //depot/Jam/R1.0/src/jam.html#1
//depot/Jam/MAIN/src/jam.html#5 - edit from //depot/Jam/R1.0/src/jam.html#2,#3
//depot/Jam/MAIN/src/parse.c#1,#2 - branch into //depot/Jam/R1.0/src/parse.c#1
//depot/Jam/MAIN/src/parse.c#3 - copy from //depot/Jam/R1 0/src/parse c#2 #3//depot/Jam/R1.0/src/parse.c#2,#3
//depot/Jam/MAIN/src/rules.h#6,#9 - branch into //depot/Jam/R1.0/src/Rules.h#1
...etc.
Perforce Training Course, 2010.1
77
Showing integ resolve actions in file history
p4 filelog //depot/Jam/R2.1/src/jam.c
#5 change 829 integrate ‘New main feature... #5 change 829 integrate ... New main feature skipped.'
... ... ignored //depot/Jam/MAIN/src/jam.c#39
... #4 change 827 integrate ... 'Re-worked list function'
... ... edit from //depot/Jam/MAIN/src/jam.c#38
... #3 change 825 integrate ... 'Added index function.'
... ... copy from //depot/Jam/MAIN/src/jam.c#17,#37
... #2 change 821 edit ... 'Added list function.'
... ... merge into //depot/Jam/MAIN/src/jam.c#36
... #1 change 749 branch ... 'Create Jam 2.1 release branch.'
... ... branch from //depot/Jam/MAIN/src/jam.c#1,#16
Which files differ between branches?
//depot/Jam/MAIN/src/command.c#9 (text) –
p4 diff2 -q -b MAIN-to-R1.0
//depot/Jam/MAIN/src/command.c#9 (text) //depot/Jam/R1.0/src/command.c#1 (text) content
//depot/Jam/MAIN/src/regexp.c#2 (text) –//depot/Jam/R1.0/src/regexp.c#2 (text) content
//depot/Jam/MAIN/src/RELNOTES#77 (text) –//depot/Jam/R1.0/src/RELNOTES#2 (text) content
//depot/Jam/MAIN/src/pic.jpg#7 (ubinary) –//depot/Jam/R1.0/src/pic.jpg#2 (ubinary) content
//d / / / / #18//depot/Jam/MAIN/src/scan.c#18 - <none>//depot/Jam/MAIN/src/scan.h#12 - <none><none> - //depot/Jam/R1.0/src/truescan.h#1
...etc.
Perforce Training Course, 2010.1
78
More on integration
R1.0R2.0
21
136
5736
33
24
28 11278
49
116MAIN
26
59 82 105 114
49
DEVZ
Selective integrations
p4 integ //depot/Jam/MAIN/xyz.c#4 //depot/Jam/R1.0/xyz.c
p4 integ //depot/Jam/MAIN/xyz.c#4,#6 //depot/Jam/R1.0/xyz.c
p4 integ //depot/Jam/MAIN/...@78 //depot/Jam/R1.0/...
p4 integ //depot/Jam/MAIN/[email protected] //depot/Jam/R1.0/...
p4 integ -b mybranch //...@251
p4 integ -b R3.0 //depot/Jam/R3.0/gizmo/...@43,@43
Perforce Training Course, 2010.1
79
Selecting a base
3
DEVA/make c
1 2
DEVB/ k
DEVA/make.c
MAIN/make.c24232221
revisions
321DEVB/make.c
Integrating special cases of deletes
• Target or source file deletedp4 integ -d //depot/Jam/MAIN/svr/... //depot/Jam/R1.0/svr/...
• Source file deleted/re-added
• Ignore delete/re-add when finding basep4 integ -Di //depot/Jam/MAIN/svr/ //depot/Jam/R1 0/svr/p4 integ Di //depot/Jam/MAIN/svr/... //depot/Jam/R1.0/svr/...
• Use re-added revision as base p4 integ -i //depot/Jam/MAIN/svr/... //depot/Jam/R1.0/svr/...
Perforce Training Course, 2010.1
80
Renaming files by integrating
• Integrate into file with new name
• Delete old file
• For example, renaming abc.c to xyz.c:p4 integ abc.c xyz.c//depot/Jam/MAIN/src/xyz.c#1 - branch/sync from
//depot/Jam/MAIN/src/abc.c#1,#4// p / / / / # ,#
p4 delete abc.c//depot/Jam/MAIN/src/abc.c#4 - opened for delete
p4 submit
Suggested branching policy
• What is a branch used for?
• Who checks in changes?
• Is it okay to check in code that doesn’t build?
• Who fixes broken checkins?
• Who pushes content to parent & children?• Who pushes content to parent & children?
Perforce Training Course, 2010.1
81
New Commands in this Chapter, Part 2
• p4 integ <source file spec> <target file spec>
• p4 changes -i
• p4 integrated
Introduction toPerforce for Users
Job Tracking
Perforce Training Course, 2010.1
82
Job Tracking
• Perforce JobsPerforce Jobs
• Creating a Job
• Searching Jobs
• Linking Jobs to Changelists
Perforce jobs
• Perforce’s defect tracking systemg y
• Textual descriptions of unit of work
• Can be customized
• Can integrate with external defect tracker
Perforce Training Course, 2010.1
83
Job: new
Creating a job
p4 job
User: bob
Status: open
Date: 2009/08/01
Description:<enter description here>
Job job100123 saved.
Add buttons to Gizmo space window.
Job: job100123
Editing an existing job
p4 job job100123
Job: job100123
User: bob
Status: open
Date: 2009/09/12
Description:Add buttons to Gizmo space window.Buttons should be mauve or taupe.
Perforce Training Course, 2010.1
84
Listing jobs
p4 jobs
/ /job000001 on 1999/01/19 by aban *closed* 'Add clean uninstall functionality '
job000002 on 1999/02/28 by aban *closed* 'Need release notes for jam project '
job000003 on 1999/02/28 by leslie *closed* 'Make serialized release notes '
job000004 on 1999/07/19 by aban *closed* 'Jam port to FreeBSD. 'p
job000005 on 1999/10/23 by aban *closed* ‘Jam port to SCO. '
...etc.
Searching jobs
p4 jobs -e "filter email"p j
p4 jobs -e "status|email"
p4 jobs -e "status=open user=edk"
p4 jobs -e "date>=2008/07/14"
p4 jobs -e "description=filter*"p4 jobs e description filter
p4 jobs -e "doesn't return zero"
Perforce Training Course, 2010.1
85
Automatically linking jobs to changelists
p4 user
User: bobUser: bob
Email: [email protected]: 2008/08/09 13:45:59Access: 2010/06/07 16:45:05FullName: Bob EverlyJobView: user=bob status=openJobView: user bob status open
• Link changelist and job
Manually linking jobs to changelists
• Link changelist and jobp4 fix -c changelist# jobname
• Submit sets job status to closed by default
Perforce Training Course, 2010.1
86
Showing a closed job
J b j b100123
p4 job job100123
Job: job100123
User: bob
Status: closed
Date: 2009/12/17
Description:Add buttons to Gizmo space window.Buttons should be mauve or taupe.
• What changelist fixed a job?p4 fixes j jobname
Job fix reporting
p4 fixes -j jobname
• What job was fixed by a changelist?p4 fixes -c changelist#
O t t f b th d i• Output of both commands is:p4 fixes -j job001234 or p4 fixes -c 12345job001234 fixed by change 12345 on 2010/01/22 by
jrice@rover
Perforce Training Course, 2010.1
87
p4 jobs //depot/Jam/MAIN/src/
Listing jobs linked to submitted changelists
p4 jobs //depot/Jam/MAIN/src/...
job001001 on 2008/01/23 by tsmith *closed* 'execunix.c blows up on fputs()'
job001162 on 2008/03/21 by tsmith *closed* 'MAXLINE on NT can't account for'
job004053 on 2009/01/22 by hjones *closed* j y j'Jam port to QNX '
New Commands in this Chapter
• p4 jobp j
• p4 jobs
• p4 user
• p4 fix
• p4 fixes
Perforce Training Course, 2010.1
88
Introduction toPerforce for Users
Supporting Client Programs, Plug-ins & Integrations,Plug ins & Integrations,
Tools & Utilities,Related Software
Supporting Client Programs
P4V Visual Client Program g
P4Merge Visual Merge Tool
P4Web Web Client Program
Perforce Training Course, 2010.1
89
P4V
P4Merge
Perforce Training Course, 2010.1
90
The P4Web client model
Browser:IE, Opera,
etc.Perforceserver
Browser: IE, Opera,
etc.
P4Web
P4Web
Perforce Training Course, 2010.1
91
Plug-ins & Integrations
P4WSAD Plug in for Eclipse and WebSphere StudioP4WSAD Plug-in for Eclipse and WebSphere Studio
P4SCC SCC Plug-in
P4EXP Plug-in for Windows Explorer
P4DTG Defect Tracking Gateway
P4GT Plug-in for Graphical Tools
P4OFC Plug-in for Microsoft Office
P4WSAD in Eclipse
Perforce Training Course, 2010.1
92
P4SCC in Microsoft Visual Studio .NET
P4EXP in Windows Explorer
Perforce Training Course, 2010.1
93
P4DTG Configuration
P4GT in 3D Studio
Perforce Training Course, 2010.1
94
P4OFC
• ExcelExcel
• PowerPoint
• Project
• Word
Word diff
Perforce Training Course, 2010.1
95
Tools & Utilities
P4Report Reporting system p p g y
P4Thumb Thumbnail Generator
P4FTP FTP Plug-in
P4Report
Jobs Logged vs. Operating System
300
400
500
600
700
800
JobsAIX
0
100
200
300
AIX Mac NT UnixOperating System
AIXMacNTUnix
Perforce Training Course, 2010.1
96
P4V’s thumbnail viewer
Perforce Thumbnail Generator
Perforce Training Course, 2010.1
97
P4FTP with Dreamweaver
Related Software
• API tools and build integrationsAPI tools and build integrations
• P4toDB Perforce Integration with SQL Databases
• New user to Perforce
Perforce Training Course, 2010.1
98
API tools and build integrations
• Perforce C/C++ API• P4ObjC
• P4Perl
• P4PHP
• P4Python
• P4Ruby
• P4Java
• Jam
• Third-party build tool integrations
• Various IDE Plug-ins
P4toDB
• Replicate Perforce metadata to:Replicate Perforce metadata to:• Oracle 11
• MySQL 5
• SqlServer 2005
• DB2 9
• Postgres 8
Perforce Training Course, 2010.1
99
New user to Perforce
• Conversion utilities
• CVS2P4
• PVCStoP4
• p4convert-svn
• VSStoP4
• Sample Depot
Discovering named Perforce servers
p4 browsepname = [Main]description = [Production Server]version = [P4D/NTX86/2010.1/244883]hostname = [p4demo.com.]port = [1492]
...etc.
Perforce Training Course, 2010.1
100
... and there’s more!
Visit Perforce –www.perforce.comp
and our Public Depot –
http://public.perforce.com/public/index.html
f t li ti f il bl ftfor current listings of available software
Perforce Highlights
FAST
Easy to learn
Superior technical support
Cross-platform compatibility
Atomic change transactions
Powerful integration algorithm
Perforce Training Course, 2010.1
101
The End
Please fill out class evaluations.
All Perforce manuals and technical notes are available at www.perforce.com.
Report problems and get technical help from [email protected].
Share tips and ideas with other users on [email protected]