Perforce Cheat Sheet



  1. Perforce Git Cheat Sheet
  2. Perforce Commands
  3. P4 Cheat Sheet
  4. Perforce Cheat Sheet Pdf
A way to remember width='100%'>
the answer starts with…
“What are the filenames that…?”“p4 files….”p4 files //depot/…#have
p4 have
p4 files //depot/…
(which is the same as)
p4 files //depot/…#head
p4 files //depot/…@label
p4 files //depot/…@client
p4 files //depot/…@2001/02/12
p4 files //depot/…@1541
“What are the differences between the
workspace copy of XXX and the depot
copy of XXX?”
“p4 diff …”• p4 diff file.c
• p4 diff file.c#2
• p4 diff file.c#head
• p4 diff //… or “p4 diff”
• p4 diff –se
“What are the differences the depot copy
of ______ and the depot copy of ______?”
“p4 diff2 ….”• p4 diff2 file1.c file2.c
• p4 diff2 file1.c#1 file.c#2
• p4 diff2 dir1/… dir2/…
• p4 diff2 dir1/…@now dir1/…@2000/01/02
“Tell me everything about changelist #___.”“p4 describe”• p4 describe 1231
“What’s a list of changelists that….?”“p4 changes….”• p4 changes
(which is the same as)
p4 changes //…
• p4 changes file.c
• p4 changes –i file.c | grep 1255
• p4 changes //depot/…@label1,@label2

HP VM Cheat Sheet. 1) How to Start HP VM? On a host a) # vi / etc / rc.config.d / hpvmconf. Download Packages Download the Perforce C API from ftp://ftp.

P4 changelist cheatsheet 📅 2018-Jun-12 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ changelist, cheatsheet, p4 ⬩ 📚 Archive A changelist in Perforce is identified by an unique number and contains a list of modified files and a description (among other things). SVN Commands Cheat Sheet; Task SVN Commands Helix Core P4 Commands; Create a new depot/repo. Svnadmin create: p4 depot: Add files to the depot/repo. Svn import: p4 reconcile, then p4 submit: Discard changes made to open files and revert back to latest synced version. Svn checkout -r url://path/to/repo: p4 revert: Copy files into the. Jul 25, 2017 - The JRebel blog is home to the latest articles, product updates, and news from our Java experts. See the latest blogs, here.

“Cheat Sheet” of Perforce command-lineThe following list is a set of helpful commands that anyone can run, but that the person administering the Perforce codelines will
be using a lot. They’re included here for quick reference.
Function
Create a new workspace…
1. That’s modeled after the
“1.0dev” workspace – same
mappings
2. That’s the Perforce defaults,
Set the workspace name using “p4 set” or in the environment. Then run:
1. p4 client –t 1.0dev
2. p4 client
Retrieve a file as of
1. Now (head revision)
2. April 15, 2000
3. Label “xyz”
4. Changelist 123456
5. the revision that client
“jab.work” has retrieved
6. The revision you had before
accidently bashing your disk
Use “p4 sync” as follows:
1. p4 sync file.java
p4 sync file.java#head
p4 sync file.java@now
2. p4 sync file.java@2000/04/15
3. p4 sync file.java@xyz
4. p4 sync file.java@123456
5. p4 sync file.java@jab.work
6. p4 sync –f file.java#have
See “p4 help revisions” for more examples. Note that anywhere that “file.java” is used in these
examples, a full pathname (“c:workprojectsfile.java”) or depot name
(“//depot/rel_218/base/projects/file.java”) could be used.
Open a file for:
1. add
2. edit
3. delete
And then publish the change to others
.
Use “p4” with the appropriate verb:
• p4 add file.java
• p4 edit file.java
• p4 delete file.java
Then “p4 submit” to publish it
What have I changed in the files I
have opened for edit?
• p4 diff (for all opened files)
• p4 diff file1 file2 (for specific files)
Undo a checkout.If the file hasn’t been submitted yet:
• Use “p4 revert –a” to find all opened files that have no modifications – it’ll revert those.
• Use “p4 revert file.java” to revert an individual file.
• Use “p4 revert //…” to revert all files.
Remember that “p4 revert” is irreversible.
If the file has been submitted, you’ll need to open the file for edit and check in a prior revision.
Use very good change descriptions to say what you did and why.
Interrupt your work to edit a single
file and check it in, without any other
disruptions. (You’re hacking Java and
someone needs a “relnotes.txt”
updated ASAP to issue a release.)
Two ways:
1. Edit the file and submit only that file.
• p4 edit relnotes.txt
• do the modifications
• p4 submit relnotes.txt
2. Make a new changelist to manage just that change.
• p4 change
remove all the files in this change from the Files: section, it’ll create an empty
change.
• p4 edit –c XXX relnotes.txt
where XXX is the change number in the previous step
• p4 submit –c XXX
Publish your work to others“p4 submit”
Compress the data on the net
because you have a slow modem line
between your workspace and the
server.
Run “p4 client” for your workspace, and change the options from “nocompress” to “compress”.
(Read “p4 help client” for details.)
Get the list of…
1. All changelists applied to the
base codeline
2. … to the prodxyz codeline
3. … to the prodxyz codeline,
including those applied
originally to another codeline
and integrated into prodxyz
4. All revisions of file.java
Use “p4 changes” or “p4 filelog” as follows:
1. p4 changes //depot/eng/…
2. p4 changes //depot/eng/prodxyz/…
3. p4 changes –i //depot/eng/prodxyz/…
4. p4 filelog file.java
Push … from the base codeline
(“prodxyz”) to the 1.0.1 codeline
(“prodxyz-1.0.1”):
1. Push change #1232
2. From change #129 to #134
3. all changes in the base
codeline
Use “p4 integrate –b prodxyz-1.0.1” as the place to start, in each case:
1. p4 integ –b prodxyz-1.0.1 //…@=1232
2. p4 integ –b prodxyz-1.0.1 //…@129,@134
3. p4 integ –b prodxyz-1.0.1 (no additional args)
Note that this assumes that the named branch specification “prodxyz-1.0.1” has been created
by your project lead or administrator using “p4 branch”.
Push … from the prodxyz-1.0.1
codeline to the base (“prodxyz”)
codeline:
1. Push change #1235
2. From change #127 to #128
3. all changes in the base
Use “p4 integrate –b prodxyz-1.0.1” as the place to start, in each case:
1. p4 integ –b prodxyz-1.0.1 –r @=1235
2. p4 integ –b prodxyz-1.0.1 –r //…@127,@128
3. p4 integ –b prodxyz-1.0.1 –r (no additional args)
The “-r” reverses the order of source/target in that named branch specification.
Note that for the ‘selective integration’ cases, you’ll want to be VERY CAUTIOUS of ‘accept
theirs’.
Show the ‘diff’ between the
prodxyz-1.0.1 codeline and its
parent
“p4 diff2 –b prodxyz-1.0.1” (This works because “prodxyz” is the name of the branch
specification, not because “prodxyz” is part of “//depot/prodxyz/…”)
What branches do I have?If you use “p4 branch” to create branch specifications and use them consistently, then “p4
branches” provides this info.
How do I make a new codeline
named prodxyz-2.0?
There are several steps:
1. Make a named branch specification. Save it.
• “p4 prodxyz-2.0”
• if you want to exactly imitate another branch (e.g. prodxyz), use
“p4 branch –o prodxyz-1.0.1 > tmp” to capture the output, edit this temporary file
and replace the “1.0.1” references with “2.0”, then run “p4 branch –i < tmp”.
2. Run the “p4 integrate” command to populate this new codeline. Submit the change.
• p4 integrate –b prodxyz-2.0
or, if you want to push content as of a certain label (e.g. “xyz”) from the parent,
p4 integrate –b prodxyz-2.0 //…@xyz
• p4 submit
3. Send e-mail telling everyone about this codeline and what it’s used for.
Put everything onto a laptop, you’re
going to the beach and want to hack.
(This assumes that you won’t be
connected to a net while away.)
There are several steps:
1. Connect the laptop to the net.
2. Run “p4 sync” to populate the source onto the laptop.
3. Leave for the beach.
4. While editing, use “chmod” or “attrib” to make the files writeable. Make your changes.
5. Get back to work, reconnect to the net.
6. Run the following commands to tell you what’s updated and open them for
add/edit/delete:
• p4 diff –se | p4 –x – edit
• p4 diff –sd | p4 –x – delete
• find . –type f –print | p4 –x – add
Then inspect what’s opened (“p4 opened”) and what you’ve changed (“p4 diff”). Submit or
revert as appropriate.
Run a checkpoint“p4 admin checkpoint” – only an administrator can run this. (An administrator has “super”
permissions in the “p4 protect” data.)
Be sure to back up the checkpoint, the current journal, and each of the “depot” directories on
the server machine!
Change the security/permissions“p4 protect” – only an administrator can run this.
Also…
“p4 protects” – used in 2006.1 and later to TELL you your permissions .
Make a labelIt’s a two-step process:
1. Make the label using “p4 label xxx”
2. Populate it using “p4 labelsync –l xxx”
or if you have a specific list of files,
“p4 labelsync –l xxx file1 file2 …”.
Copy a label’s contents to another
label. Assume that the existing label
is “xxx” and the new label is to be
“abc”.
Again, a two-step process:
1. Make the label using “p4 label –t xxx abc”
2. Populate it using
“p4 labelsync –l abc //…@xxx”
Note that the second step is really identical to the second step in the previous question – we’re
just specifying a very specific list of revisions [of files] to include in the new label.
(Also…
In 2005.1 and later, “p4 tag” will make the label and apply it to a set of files.)
  • Continuous Inspection White_Paper - April 24, 2021
  • Approach to Implement Continuous Integration and Continuous Delivery - April 24, 2021
  • What is Continuous Approval? - April 24, 2021

Tip #1: p4 is your friend

You can generate sophisticated change lists automatically according to custom rules from the shell script, e.g. 'Add a bunch of files into a change list' or 'Split a big changelist into little ones'.

Quick start with p4

  1. Open p4v (visual Perforce client).
  2. Right click on the project folder.
  3. Click 'Open Terminal'.
  4. Now you can use p4 in a preconfigured console, you don't need to setup workspace and server connection.

Create a new change list

  • p4 change -o: default change list description
  • p4 change -i: create new change list

Create 20 new change lists

Add, checkout (edit), delete and revert

  • Default change list:
  • Custom change list:

Add a bunch of files into a change list

Imagine situation, when you need to add 40000 files into a single changelist to create an initial commit.

  • -x is an option where to read the input, and -x- means to read the files from standard input.
  • -c is an option of add operation to specify a concrete change list number.

Split a big changelist into little ones

Now, perhaps, you need to create a 40 changelists with 1000 files in the each one. And perhaps you have a file 'files' with 40000 lines inside one. Then:

Output is 'xaa', 'xab', 'xac' files, total count is 40 new files per 1000 lines.

Create 40 change lists:

Write down change list numbers. For example, we've got numbers 9901, 9902, and so on, up to 9940.

Rename files into existing change list numbers:

Add files according to change lists:

File list '9901' will be added to the 9901 change list
File list '9902' will be added to the 9902 change list.
And so on.

Perforce Git Cheat Sheet

Print files

Perforce Commands

  1. In the local folder of workspace:
  2. In the local folder recursively:
  3. In the remote depot:

The latest revision of a file

P4 Cheat Sheet

Cheat

Perforce Cheat Sheet Pdf

Diff between two revisions





Comments are closed.