<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>p4 files Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/p4-files/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/p4-files/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:55:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>“Cheat Sheet” of Perforce command-line &#124; Perforce command-line Guide</title>
		<link>https://www.scmgalaxy.com/tutorials/cheat-sheet-of-perforce-command-line/</link>
					<comments>https://www.scmgalaxy.com/tutorials/cheat-sheet-of-perforce-command-line/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Sat, 20 Jun 2009 04:59:12 +0000</pubDate>
				<category><![CDATA[Perforce]]></category>
		<category><![CDATA[Cheat Sheet]]></category>
		<category><![CDATA[Command line]]></category>
		<category><![CDATA[Data-mining commands]]></category>
		<category><![CDATA[p4]]></category>
		<category><![CDATA[p4 changes]]></category>
		<category><![CDATA[p4 filelog]]></category>
		<category><![CDATA[p4 files]]></category>
		<category><![CDATA[P4V]]></category>
		<category><![CDATA[Perforce Command Reference]]></category>
		<category><![CDATA[Perforce command-line]]></category>
		<category><![CDATA[Perforce command-line Cheat Sheet]]></category>
		<category><![CDATA[Perforce command-line Guide]]></category>
		<category><![CDATA[Perforce command-line Help]]></category>
		<category><![CDATA[Perforce command-line List]]></category>
		<category><![CDATA[Perforce command-line Reference]]></category>
		<category><![CDATA[Perforce command-line Resource]]></category>
		<category><![CDATA[Perforce command-line Tutorial]]></category>
		<category><![CDATA[Reference guide]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2009/06/20/cheat-sheet-of-perforce-command-line/</guid>

					<description><![CDATA[<p>A way to remember data-mining commands The following is a set of questions that will be used during the Perforce [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/cheat-sheet-of-perforce-command-line/">“Cheat Sheet” of Perforce command-line | Perforce command-line Guide</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="aligncenter wp-image-4061 size-full" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2009/06/perforce-command-line-cheat.png" alt="perforce-command-line-cheatsheet" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2009/06/perforce-command-line-cheat.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2009/06/perforce-command-line-cheat-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<table border="0" width="100%">
<tbody>
<tr>
<td class="HEADING">A way to remember data-mining commands</td>
</tr>
<tr>
<td class="HEADING_BODY">The following is a set of questions that will be used during the Perforce training to remind students which “data-mining” commands to use for specific situations. Perforce is a terrific tool, but it’s easy to get lost in the choices between “p4 files” and “p4 changes” and “p4 filelog” and so on. This list can help a great deal.</p>
<table border="1" width="100%">
<tbody>
<tr>
<td bgcolor="#666666">
<div align="center"><strong><span style="color: #ffffff;">the question starts with…</span></strong></div>
</td>
<td bgcolor="#666666">
<div align="center"><strong><span style="color: #ffffff;">the answer starts with…<br />
</span></strong></div>
</td>
<td bgcolor="#666666">
<div align="center"><strong><span style="color: #ffffff;">Examples</span></strong></div>
</td>
</tr>
<tr>
<td>“What are the filenames that…?”</td>
<td>“p4 files….”</td>
<td>p4 files //depot/…#have<br />
p4 have<br />
p4 files //depot/…<br />
(which is the same as)<br />
p4 files //depot/…#head<br />
p4 files //depot/…@label<br />
p4 files //depot/…@client<br />
p4 files //depot/…@2001/02/12<br />
p4 files //depot/…@1541</td>
</tr>
<tr>
<td>“What are the differences between the<br />
workspace copy of XXX and the depot<br />
copy of XXX?”</td>
<td>“p4 diff …”</td>
<td>• p4 diff file.c<br />
• p4 diff file.c#2<br />
• p4 diff file.c#head<br />
• p4 diff //… or “p4 diff”<br />
• p4 diff –se</td>
</tr>
<tr>
<td>“What are the differences the depot copy<br />
of ______ and the depot copy of ______?”</td>
<td>“p4 diff2 ….”</td>
<td>• p4 diff2 file1.c file2.c<br />
• p4 diff2 file1.c#1 file.c#2<br />
• p4 diff2 dir1/… dir2/…<br />
• p4 diff2 dir1/…@now dir1/…@2000/01/02</td>
</tr>
<tr>
<td>“Tell me everything about changelist #___.”</td>
<td>“p4 describe”</td>
<td>• p4 describe 1231</td>
</tr>
<tr>
<td>“What’s a list of changelists that….?”</td>
<td>“p4 changes….”</td>
<td>• p4 changes<br />
(which is the same as)<br />
p4 changes //…<br />
• p4 changes file.c<br />
• p4 changes –i file.c | grep 1255<br />
• p4 changes //depot/…@label1,@label2</td>
</tr>
</tbody>
</table>
<p>&nbsp;</td>
</tr>
<tr>
<td class="HEADING">“Cheat Sheet” of Perforce command-line</td>
</tr>
<tr>
<td class="HEADING_BODY">The following list is a set of helpful commands that anyone can run, but that the person administering the Perforce codelines will<br />
be using a lot. They’re included here for quick reference.</p>
<table border="1" width="100%">
<tbody>
<tr>
<td align="left" valign="top" bgcolor="#999999">
<div align="center"><span style="color: #ffffff;"><strong>Function</strong></span></div>
</td>
<td align="left" valign="top" bgcolor="#999999">
<div align="center"><span style="color: #ffffff;"><strong>Commands</strong></span></div>
</td>
</tr>
<tr>
<td align="left" valign="top">Create a new workspace…<br />
1. That’s modeled after the<br />
“1.0dev” workspace – same<br />
mappings<br />
2. That’s the Perforce defaults,</td>
<td align="left" valign="top">Set the workspace name using “p4 set” or in the environment. Then run:<br />
1. p4 client –t 1.0dev<br />
2. p4 client</td>
</tr>
<tr>
<td align="left" valign="top">Retrieve a file as of<br />
1. Now (head revision)<br />
2. April 15, 2000<br />
3. Label “xyz”<br />
4. Changelist 123456<br />
5. the revision that client<br />
“jab.work” has retrieved<br />
6. The revision you had before<br />
accidently bashing your disk</td>
<td align="left" valign="top">Use “p4 sync” as follows:<br />
1. p4 sync file.java<br />
p4 sync file.java#head<br />
p4 sync file.java@now<br />
2. p4 sync file.java@2000/04/15<br />
3. p4 sync file.java@xyz<br />
4. p4 sync file.java@123456<br />
5. p4 sync file.java@jab.work<br />
6. p4 sync –f file.java#have<br />
See “p4 help revisions” for more examples. Note that anywhere that “file.java” is used in these<br />
examples, a full pathname (“c:\work\projects\file.java”) or depot name<br />
(“//depot/rel_218/base/projects/file.java”) could be used.</td>
</tr>
<tr>
<td align="left" valign="top">Open a file for:<br />
1. add<br />
2. edit<br />
3. delete<br />
And then publish the change to others<br />
.</td>
<td align="left" valign="top">Use “p4” with the appropriate verb:<br />
• p4 add file.java<br />
• p4 edit file.java<br />
• p4 delete file.java<br />
Then “p4 submit” to publish it</td>
</tr>
<tr>
<td align="left" valign="top">What have I changed in the files I<br />
have opened for edit?</td>
<td align="left" valign="top">• p4 diff (for all opened files)<br />
• p4 diff file1 file2 (for specific files)</td>
</tr>
<tr>
<td align="left" valign="top">Undo a checkout.</td>
<td align="left" valign="top">If the file hasn’t been submitted yet:<br />
• Use “p4 revert –a” to find all opened files that have no modifications – it’ll revert those.<br />
• Use “p4 revert file.java” to revert an individual file.<br />
• Use “p4 revert //…” to revert all files.<br />
Remember that “p4 revert” is irreversible.<br />
If the file has been submitted, you’ll need to open the file for edit and check in a prior revision.<br />
Use very good change descriptions to say what you did and why.</td>
</tr>
<tr>
<td align="left" valign="top">Interrupt your work to edit a single<br />
file and check it in, without any other<br />
disruptions. (You’re hacking Java and<br />
someone needs a “relnotes.txt”<br />
updated ASAP to issue a release.)</td>
<td align="left" valign="top">Two ways:<br />
1. Edit the file and submit only that file.<br />
• p4 edit relnotes.txt<br />
• do the modifications<br />
• p4 submit relnotes.txt<br />
2. Make a new changelist to manage just that change.<br />
• p4 change<br />
remove all the files in this change from the Files: section, it’ll create an empty<br />
change.<br />
• p4 edit –c XXX relnotes.txt<br />
where XXX is the change number in the previous step<br />
• p4 submit –c XXX</td>
</tr>
<tr>
<td align="left" valign="top">Publish your work to others</td>
<td align="left" valign="top">“p4 submit”</td>
</tr>
<tr>
<td align="left" valign="top">Compress the data on the net<br />
because you have a slow modem line<br />
between your workspace and the<br />
server.</td>
<td align="left" valign="top">Run “p4 client” for your workspace, and change the options from “nocompress” to “compress”.<br />
(Read “p4 help client” for details.)</td>
</tr>
<tr>
<td align="left" valign="top">Get the list of…<br />
1. All changelists applied to the<br />
base codeline<br />
2. … to the prodxyz codeline<br />
3. … to the prodxyz codeline,<br />
including those applied<br />
originally to another codeline<br />
and integrated into prodxyz<br />
4. All revisions of file.java</td>
<td align="left" valign="top">Use “p4 changes” or “p4 filelog” as follows:<br />
1. p4 changes //depot/eng/…<br />
2. p4 changes //depot/eng/prodxyz/…<br />
3. p4 changes –i //depot/eng/prodxyz/…<br />
4. p4 filelog file.java</td>
</tr>
<tr>
<td align="left" valign="top">Push … from the base codeline<br />
(“prodxyz”) to the 1.0.1 codeline<br />
(“prodxyz-1.0.1”):<br />
1. Push change #1232<br />
2. From change #129 to #134<br />
3. all changes in the base<br />
codeline</td>
<td align="left" valign="top">Use “p4 integrate –b prodxyz-1.0.1” as the place to start, in each case:<br />
1. p4 integ –b prodxyz-1.0.1 //…@=1232<br />
2. p4 integ –b prodxyz-1.0.1 //…@129,@134<br />
3. p4 integ –b prodxyz-1.0.1 (no additional args)<br />
Note that this assumes that the named branch specification “prodxyz-1.0.1” has been created<br />
by your project lead or administrator using “p4 branch”.</td>
</tr>
<tr>
<td align="left" valign="top">Push … from the prodxyz-1.0.1<br />
codeline to the base (“prodxyz”)<br />
codeline:<br />
1. Push change #1235<br />
2. From change #127 to #128<br />
3. all changes in the base</td>
<td align="left" valign="top">Use “p4 integrate –b prodxyz-1.0.1” as the place to start, in each case:<br />
1. p4 integ –b prodxyz-1.0.1 –r @=1235<br />
2. p4 integ –b prodxyz-1.0.1 –r //…@127,@128<br />
3. p4 integ –b prodxyz-1.0.1 –r (no additional args)<br />
The “-r” reverses the order of source/target in that named branch specification.<br />
Note that for the ‘selective integration’ cases, you’ll want to be VERY CAUTIOUS of ‘accept<br />
theirs’.</td>
</tr>
<tr>
<td align="left" valign="top">Show the ‘diff’ between the<br />
prodxyz-1.0.1 codeline and its<br />
parent</td>
<td align="left" valign="top">“p4 diff2 –b prodxyz-1.0.1” (This works because “prodxyz” is the name of the branch<br />
specification, not because “prodxyz” is part of “//depot/prodxyz/…”)</td>
</tr>
<tr>
<td align="left" valign="top">What branches do I have?</td>
<td align="left" valign="top">If you use “p4 branch” to create branch specifications and use them consistently, then “p4<br />
branches” provides this info.</td>
</tr>
<tr>
<td align="left" valign="top">How do I make a new codeline<br />
named prodxyz-2.0?</td>
<td align="left" valign="top">There are several steps:<br />
1. Make a named branch specification. Save it.<br />
• “p4 prodxyz-2.0”<br />
• if you want to exactly imitate another branch (e.g. prodxyz), use<br />
“p4 branch –o prodxyz-1.0.1 &gt; tmp” to capture the output, edit this temporary file<br />
and replace the “1.0.1” references with “2.0”, then run “p4 branch –i &lt; tmp”.<br />
2. Run the “p4 integrate” command to populate this new codeline. Submit the change.<br />
• p4 integrate –b prodxyz-2.0<br />
or, if you want to push content as of a certain label (e.g. “xyz”) from the parent,<br />
p4 integrate –b prodxyz-2.0 //…@xyz<br />
• p4 submit<br />
3. Send e-mail telling everyone about this codeline and what it’s used for.</td>
</tr>
<tr>
<td align="left" valign="top">Put everything onto a laptop, you’re<br />
going to the beach and want to hack.<br />
(This assumes that you won’t be<br />
connected to a net while away.)</td>
<td align="left" valign="top">There are several steps:<br />
1. Connect the laptop to the net.<br />
2. Run “p4 sync” to populate the source onto the laptop.<br />
3. Leave for the beach.<br />
4. While editing, use “chmod” or “attrib” to make the files writeable. Make your changes.<br />
5. Get back to work, reconnect to the net.<br />
6. Run the following commands to tell you what’s updated and open them for<br />
add/edit/delete:<br />
• p4 diff –se | p4 –x – edit<br />
• p4 diff –sd | p4 –x – delete<br />
• find . –type f –print | p4 –x – add<br />
Then inspect what’s opened (“p4 opened”) and what you’ve changed (“p4 diff”). Submit or<br />
revert as appropriate.</td>
</tr>
<tr>
<td align="left" valign="top">Run a checkpoint</td>
<td align="left" valign="top">“p4 admin checkpoint” – only an administrator can run this. (An administrator has “super”<br />
permissions in the “p4 protect” data.)<br />
Be sure to back up the checkpoint, the current journal, and each of the “depot” directories on<br />
the server machine!</td>
</tr>
<tr>
<td align="left" valign="top">Change the security/permissions</td>
<td align="left" valign="top">“p4 protect” – only an administrator can run this.<br />
Also…<br />
“p4 protects” – used in 2006.1 and later to TELL you your permissions .</td>
</tr>
<tr>
<td align="left" valign="top">Make a label</td>
<td align="left" valign="top">It’s a two-step process:<br />
1. Make the label using “p4 label xxx”<br />
2. Populate it using “p4 labelsync –l xxx”<br />
or if you have a specific list of files,<br />
“p4 labelsync –l xxx file1 file2 …”.</td>
</tr>
<tr>
<td align="left" valign="top">Copy a label’s contents to another<br />
label. Assume that the existing label<br />
is “xxx” and the new label is to be<br />
“abc”.</td>
<td align="left" valign="top">Again, a two-step process:<br />
1. Make the label using “p4 label –t xxx abc”<br />
2. Populate it using<br />
“p4 labelsync –l abc //…@xxx”<br />
Note that the second step is really identical to the second step in the previous question – we’re<br />
just specifying a very specific list of revisions [of files] to include in the new label.<br />
(Also…<br />
In 2005.1 and later, “p4 tag” will make the label and apply it to a set of files.)</td>
</tr>
<tr>
<td align="left" valign="top"></td>
<td align="left" valign="top"></td>
</tr>
</tbody>
</table>
<p>&nbsp;</td>
</tr>
</tbody>
</table>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/cheat-sheet-of-perforce-command-line/">“Cheat Sheet” of Perforce command-line | Perforce command-line Guide</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/cheat-sheet-of-perforce-command-line/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
