<HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; U; OSF1 V4.0 alpha) [Netscape]"> <TITLE>Basic Perforce FAQ</TITLE> <x-html> </HEAD> <BODY> <H1> Basic Perforce FAQ</H1> <H3> Note - the intended audience for this FAQ is a person using Perforce for software development. There's a separate <A HREF="admin.html">FAQ for system administrators</A>, and eventually we'll have one for advanced Perforce users.</H3> <I>This FAQ assumes that there is a Perforce Administrator who knows some of the more complex parts of Perforce, who can provide help, counseling, and deal with policy-specific issues. This FAQ is taken from an initial set of questions provided by <A HREF="mailto:rmg@perforce.com">Richard Geiger</A> and <A HREF="mailto:jab@pobox.com">Jeff Bowles</A>.</I> <BR> <OL> <H4> <B>Initial List</B></H4> <LI> <A HREF="#begin...">Where do I begin?</A></LI> <LI> <A HREF="#whatisSCM">What is S.C.M.?</A></LI> <H4> Getting and modifying files</H4> <LI> <A HREF="#checkoutsource">How do I check out a source tree?</A></LI> <LI> <A HREF="#changefiles">How do I make a change to a file and check it in?</A></LI> <LI> <A HREF="#changeeditor">What if I have a favorite editor and want to use it when I do a change submission?</A></LI> <LI> <A HREF="#addfile">How do I add a new directory?</A></LI> <LI> <A HREF="#removefile">How do I remove a directory?</A></LI> <LI> <A HREF="#olderversion">How do I check out some older version of a file?</A></LI> <LI> <A HREF="#oldertree">How do I check out an entire tree as of some date?</A></LI> <LI> <A HREF="#alltree">How do I check out an entire tree corresponding to some build or release?</A></LI> <H4> Comparing what you've gotten to the reference copy</H4> <LI> <A HREF="#diff">How do I compare a working file to the base?</A></LI> <LI> <A HREF="#difftree">How do I compare a whole tree to the base?</A></LI> <LI> <A HREF="#diffoptions">How do I get my favorite diff behaviors with p4 diff?</A></LI> <LI> <A HREF="#updatetree">How do I update a tree from the base?</A></LI> <LI> <A HREF="#comparefiles">How do I compare a working file to an older version (other than the base)?</A></LI> <H4> Getting information about a file or workspace</H4> <LI> <A HREF="#p4have">How do I get a list of all files I have open on all my client workspaces?</A></LI> <LI> <A HREF="#p4describe">How do I examine the change log for a file?</A></LI> <H4> Abandoning work and starting over</H4> <LI> <A HREF="#p4revert">How do I abandon my changes and pick up a clean copy from the base?</A></LI> <LI> <A HREF="#individual_change">How do I propagate an individual change made in one branch to another?</A></LI> <LI> <A HREF="#deletefile_weird">I created a file that begins with a dash, and want to 'p4 delete' it and cannot. What can I do?</A></LI> <H4> Changing your workspace (moving it, deleting it)</H4> <LI> <A HREF="#deleteclient">How do I delete a client workspace?</A></LI> <LI> <A HREF="#moveclient">How do I move a client workspace?</A></LI> <h4>Miscellaneous problems</h4> <LI> <A HREF="#sync_fails">I can't "p4 sync" a particular file. What might be going on?</li> </OL> <OL> <HR> <LI> <A NAME="begin..."></A><B>Where do I begin?</B></LI> <BR>Start with <A HREF="http://perforce.com/perforce/doc.982/cmdguide/quickstart.html">chapters #3-5 of the user's guide</A> - that's referred to as the <I>Quick Start</I> to the product. <A HREF="http://perforce.com/perforce/technical/">All</A> of the documentation is on-line. <P>It's probably best to create a small workspace (the term is "client") to play in, so that you can experiment with a few files and not necessarily the 16,000 files that you're planning to manage with source control. <BR> <HR> <LI> <A NAME="whatisSCM"></A><B>What is S.C.M.?</B></LI> <BR>Short answer: it's a way to maintain revisions of files so that you can easily recreate a version of a file from any moment in time. <P>The "S.C.M." translates to "Source Code Management" or perhaps "Software Code Management" or "Software Control Management" - the better systems let you manage large sets of files, have multiple people working with the same body of files (a development team of 1 person isn't much fun), and work on different platforms (such as Windows/NT and Unix) transparently. <P>There are a lot of S.C.M. products around - this FAQ won't try to spend a lot of time enumerating them or contrasting them. <HR> <LI> <A NAME="checkoutsource"></A><B>How do I check out a source tree?</B></LI> <BR> <BR>Another way to phrase the question is "How do I get files and begin editing them?". This question will answer the first part of the question - the next FAQ will answer the rest. <BR> <H5> To get a set of files...</H5> Each of the following cases assumes you have a "Perforce client" (a.k.a. 'workspace') already. If not, see the FAQ to create one. <BR> <BR><I>Case #1: you need to get all the files - the most recent revision of each file.</I> <BR> <UL>Type <P><TT><FONT COLOR="#990000"> p4 sync</FONT></TT> <P>That will get you a read-only copy of the "head "revision of every file that your client can see.</UL> <I>Case #2: You need to get the files in a specific directory - the most recent revision of each file.</I> <BR> <UL>You'll want to "cd" (chdir) to the directory you want to get. Then type p4 sync ... to get the files that should go into that directory. For example: <P><TT><FONT COLOR="#990000"> cd <I>directoryname</I><BR> p4 sync ...</FONT></TT> <P>That will get you a read-only copy of the "head" revision of every file <I>in that directory and its subdirectories </I>that your client can see.</UL> <I>Case #3: You need to get the files from some `label' someone made for you.</I> <BR> <UL>If the label name is "BUILD_28", you'll be updating your client (a.k.a. workspace) the "the revision of each file that is included in label 'BUILD_28'." Note that this means that your local copy of files not included in 'BUILD_28' are removed. <P>Some examples: <BR> <OL> <OL> <CENTER><TABLE BORDER WIDTH="80%" NOSAVE > <TR> <TD><TT><FONT COLOR="#990000">p4 sync @BUILD_28</FONT></TT></TD> <TD>Update the local copies of files on the current client to be the exact revision specified in label "BUILD_28". The local copy of files not included in the label, but managed by Perforce, are removed from the client.</TD> </TR> <TR NOSAVE> <TD><TT><FONT COLOR="#990000">cd <I>directoryname</I></FONT></TT> <BR><TT><FONT COLOR="#990000">p4 sync ...@BUILD_28</FONT></TT></TD> <TD NOSAVE>Update the local copies of files <I>in directoryname (and underneath that tree)</I> on the current client to be the exact revision specified in label "BUILD_28". <P>The local copy <I>in directoryname (and underneath that tree) </I>of files not included in the label, but managed by Perforce, are removed from the client. Files not under <I>directoryname</I> aren't touched.</TD> </TR> <TR> <TD><TT><FONT COLOR="#990000">p4 sync <I>directoryname</I>/...@BUILD_28</FONT></TT></TD> <TD>Should do exactly the same thing as the previous example. (Neat, huh?)</TD> </TR> <CAPTION ALIGN=BOTTOM> </CAPTION> </TABLE></CENTER> </OL> </OL> </UL> <BR> <HR> <LI> <A NAME="changefiles"></A><B>How do I make a change to a file and check it in?</B></LI> <BR> <H5> To edit a set of files...</H5> Normally, you will edit a file using three steps: <UL> <LI> Open the file for the 'edit' operation - you can open more than one file at a time;</LI> <LI> Do the editing in your favorite editor, and make the contents of the files into what you want.</LI> <LI> Submit the modifications as one 'atomic' change so that they're available to other people.</LI> </UL> <H5> Step #1:</H5> <UL>The basic edit command is <BR> <BR> <TT><FONT COLOR="#990000"> p4 edit <I>filename</I></FONT></TT> <BR> <BR>or, <BR> <BR><TT><FONT COLOR="#990000"> p4 edit <I>filename1 filename2 </I> </FONT></TT><I>(and so on)</I> <BR> <BR>and occasionally, <BR> <BR><TT><FONT COLOR="#990000"> p4 edit <I>directoryname</I>/... </FONT></TT><I>(edit all files in `directoryname' and its subdirectories)</I> <BR> </UL> <H5> Step #2:</H5> <UL>Do the editing using your favorite editor - Perforce isn't directly involved in this step. You can always run through "Step #1" on other files, if you decide you need to edit more files. <P><I>In Perforce, the 'working' copy of the file is a local copy stored in the "client area". The modified contents are sent back to the server only when you do a 'p4 submit'.</I></UL> <H5> Step #3:</H5> <UL>The basic "submit my changes" command is: <BR> <BR><TT><FONT COLOR="#990000"> p4 submit </FONT><I><FONT COLOR="#000000">(submit all modifications)</FONT></I></TT> <BR> <BR>or, occasionally, <BR> <BR><TT><FONT COLOR="#990000"> p4 submit <I>filename </I></FONT></TT><I>(submit only this one file's modifications, leave the rest checked out)</I> <P><B>When you run...</B> <BR> <BR><B><TT><FONT COLOR="#990000"> p4 submit</FONT></TT></B> <BR> <BR><B>...you'll be dumped into the editor, to write a description of why you made these changes. </B>See the manual for more details. <BR> </UL> <HR> <LI> <A NAME="changeeditor"></A><B>What if I have a favorite editor and want to use it when I do a change submission?</B></LI> <BR> <BR>You can either set the environment variable "P4EDITOR" to be the name of the editor you want to run, or if you're on Windows/NT, use: <BR> <BR> <BR><TT><FONT COLOR="#990000"> p4 set P4EDITOR=<I>commandname</I></FONT></TT> <BR><B> </B><HR> <LI> <A NAME="addfile"></A><B>How do I add a new directory?</B></LI> <BR> <BR>You don't need to add a directory, explicitly. You simply add files in that directory, using <P><TT><FONT COLOR="#990000"> cd <I>directoryname</I><BR> p4 add <I>filename</I></FONT></TT> <P>or, <P><TT><FONT COLOR="#990000"> p4 add <I>directoryname</I>/<I>filename1 directoryname/filename2 </I> </FONT></TT><I>(and so on)</I> <P>The final step, which is to run <TT><FONT COLOR="#990000">p4 submit</FONT> </TT>, will make these new files available to other Perforce clients. <P>Perforce infers the existence of new directories whenever it sees a new directory it hasn't seen before. <HR> <LI> <A NAME="removefile"></A><B>How do I remove a directory?</B></LI> <P> <BR>You don't need to remove a directory, explicitly. You simply remove files in that directory, using <BR> <BR><TT><FONT COLOR="#990000"> cd <I>directoryname</I><BR> p4 delete <I>filename</I></FONT></TT> <BR> <BR>or, <BR><TT><FONT COLOR="#990000"> p4 delete <I>directoryname</I>/<I>filename1 directoryname/filename2 </I> </FONT></TT><I>(and so on)</I> <P>and occasionally, <BR> <BR><TT><FONT COLOR="#990000"> p4 delete <I>directoryname</I>/... </FONT></TT><I>(remove all files in `directoryname' and its subdirectories)</I> <P>The penultimate step, which is to run <TT><FONT COLOR="#990000">p4 submit</FONT> </TT>, will these deletions to other Perforce clients. <P><B>The final step is to remove the empty directories on your client: "p4 delete / p4 submit" removed the files, but not the directories.</B> <HR> <LI> <A NAME="olderversion"></A><B>How do I check out some older version of a file?</B></LI> <BR> <BR>You'll need to retrieve that revision first, then <TT><FONT COLOR="#990000">p4 edit </FONT></TT>the file. That's the easy part. The hard part is deciding how to submit the change. (Let's save that for later in the answer.) <P>For example, if you want to edit revision #12 of xyz.java, you'll need to type: <BR> <BR><TT> <FONT COLOR="#990000"> p4 sync <I>xyz.java#12</I><BR> p4 edit <I>xyz.java</I></FONT></TT> <P>The first command, of course, isn't needed if you already have revision #12 of <I>xyz.java</I>. (You can tell which revision you have by typing <TT><FONT COLOR="#990000">p4 files <I>xyz.java</I> </FONT><FONT COLOR="#000000">.</FONT></TT> <P><B><FONT COLOR="#000000">You'll be told, when you run </FONT><FONT COLOR="#990000">p4 edit xyz.java</FONT><FONT COLOR="#000000">, that you're not editing the most recent revision and that you'll need to resolve later revisions prior to submitting your changes. </FONT></B><FONT COLOR="#000000">(If you think about it, that makes sense.)</FONT> <BR>Now the file's opened for "edit", and you can do whatever you want to the file. Submitting it, however, is going to be a problem: you don't want to inadvertently overwrite the contents of later revisions of the files. <P><I>Case #1: you really do want to <U>overwrite</U> the later revisions for some reason.</I> <BR> <UL>When you run the command... <P><TT><FONT COLOR="#990000"> p4 submit</FONT></TT> <P>you'll be told that the your changes need to be resolved against more recent revisions prior to submitting. <B>Write down the change number it gives in the error message (e.g. "submit -c 12345")</B>, although you can always find it again by running the command <TT><FONT COLOR="#990000">p4 changes -s pending </FONT><FONT COLOR="#000000">.</FONT></TT> <BR> <BR> <BR> </UL> <I>Case #2: You don't want to overwrite anything - you were just experimenting with an old version of a file to debug something.</I> <BR> <UL>From <A HREF="#p4revert">another question</A> in this FAQ: use <TT><FONT COLOR="#990000">p4 revert <I>filename</I> </FONT></TT><FONT COLOR="#000000">to discard the modifications you've made to <I>filename</I> and retrieve a fresh copy of the <U>exact same revision</U> you had prior to typing</FONT> <TT><FONT COLOR="#990000">p4 edit <I>filename</I> </FONT><FONT COLOR="#000000">.</FONT></TT> <BR> </UL> <HR> <LI> <A NAME="oldertree"></A><B>How do I check out an entire tree as of some date?</B></LI> <BR> <H5> For release 98.2...</H5> <UL>There's an entry in the <A HREF="http://perforce.com/perforce/doc.982/user/relnotes.txt">release notes</A> that says:</UL> <UL> <CENTER><TABLE COLS=1 WIDTH="70%" NOSAVE > <TR NOSAVE> <TD NOSAVE><I><FONT COLOR="#009900"> </FONT><FONT COLOR="#660000">Wherever revision specifications are supported, @date and "@datetime" can now be used in addition to @change and @label. The format for date is YYYY/MM/DD, and the format for datetime is YYYY/MM/DD:HH:MM:SS. If no time is given, midnight is assumed.</FONT></I></TD> </TR> </TABLE></CENTER> </UL> <UL>That means that the command <TT><FONT COLOR="#990000">p4 sync ...@<I>1998/09/02 </I></FONT></TT><FONT COLOR="#000000">will retrieve all files that map to the current directory (and its subdirectories!), at the revisions that were current at midnight on September 2, 1998.</FONT></UL> <H5> <FONT COLOR="#000000">For releases prior to 98.2...</FONT></H5> <UL><FONT COLOR="#000000">You'll need to use </FONT> <FONT COLOR="#990000"><TT>p4 changes </TT> </FONT><FONT COLOR="#000000">to find the change number <U>immediately prior</U> to the desired date, and then use the command </FONT> <TT><FONT COLOR="#990000">p4 sync ...@<I>changenum</I> </FONT></TT><FONT COLOR="#000000">to retrieve the fileset you want.</FONT></UL> <HR> <LI> <A NAME="alltree"></A><B>How do I check out an entire tree corresponding to some build or release?</B></LI> <P>In general, you'll need to have a piece of data from your build person: the label name used for that build. (You can always hunt for it, using the command <FONT COLOR="#000000"> </FONT> <TT><FONT COLOR="#990000">p4 labels </FONT></TT><FONT COLOR="#000000">.)</FONT> <P><FONT COLOR="#000000">If the label is <I> release3.2label</I>, you can update your client area to this by typing:</FONT> <P><TT><FONT COLOR="#990000"> p4 sync @release3.2label</FONT></TT> <P><FONT COLOR="#000000">This will update your client to this label, <U>removing local copies of files that aren't in the label.</U></FONT> <BR> <BR>If you want subdirectory xyz to be updated, but no other directories on your client, you would type: <P><TT><FONT COLOR="#990000"> p4 sync xyz/...@release3.2label</FONT></TT> <BR> <HR> <LI> <A NAME="diff"></A><B>How do I compare a working file to the base?</B></LI> <BR> <BR>Use <TT><FONT COLOR="#990000"> p4 diff <I>filename</I> </FONT></TT>, which will compare the <U>local copy</U> of a file you've opened for edit or an integrate operation against the revision of the file you were original given. <P>For example, say you've opened <I>xyz.java</I> using the command: <BR> <BR><TT> <FONT COLOR="#990000"> p4 edit <I>xyz.java</I></FONT></TT> <BR> <BR>To see your modifications, type: <BR> <BR><TT> <FONT COLOR="#990000">p4 diff <I>xyz.java</I></FONT></TT> <BR> <BR>Note that this is not comparing your local copy of the file against the most recent changes that other people have checked in - it's comparing against the revision you were working against. (That's <TT><FONT COLOR="#990000">p4 diff <I>filename#head </I></FONT>.)</TT><HR> <LI> <A NAME="difftree"></A><B>How do I compare a whole tree to the base?</B></LI> <BR> <BR>Use <TT><FONT COLOR="#990000">p4 diff <I>directory/...</I> </FONT></TT>, which will compare the <U>local copy</U> of every file in <I>directory</I> that is opened for edit or an integrate operation against the revision of the file you were original given. <P>For example, say you've opened <I>xyz.java</I> and<I> z.java </I>in directory dir1 using the command: <BR> <BR><TT> <FONT COLOR="#990000"> p4 edit <I>dir1/xyz.java dir1/z.java</I></FONT></TT> <BR> <BR>To see your modifications, type: <BR> <BR><TT> <FONT COLOR="#990000">p4 diff <I>dir1/...</I></FONT></TT> <BR> <BR>Note that this is not comparing your local copy of the file against the most recent changes that other people have checked in - it's comparing against the revision you were working against. (That's <TT><FONT COLOR="#990000">p4 diff <I>dir1/...#head </I></FONT>.)</TT> <HR> <LI> <A NAME="diffoptions"></A><B>How do I get my favorite diff behaviors with p4 diff?</B></LI> <BR> <BR>The environment variable $DIFF is the command line that's run when you run: <P><TT><FONT COLOR="#990000"> p4 diff <I> file1 file2</I></FONT></TT> <P><FONT COLOR="#000000">If, for example, the command </FONT><TT><FONT COLOR="#990000">"diff -c"</FONT></TT><FONT COLOR="#000000"> produces "context output format", then the sequence:</FONT> <P><TT><FONT COLOR="#990000"> DIFF="diff -c"<BR> export DIFF<BR> p4 diff <I> file1 file2</I></FONT></TT> <P><FONT COLOR="#000000">will produce that type of output for the differences between the two files.</FONT> <P><FONT COLOR="#000000">Note that </FONT> <TT><FONT COLOR="#990000">p4 diff2 <I>file1 file2 </I></FONT></TT><FONT COLOR="#000000">doesn't honor this variable, because the "diff" operation is run on the server and only the formatted output is returned to the user.</FONT> <BR> <HR> <LI> <A NAME="updatetree"></A><B>How do I update a tree from the base?</B></LI> <BR> <BR>Use <TT><FONT COLOR="#990000">p4 sync <I>directory/...</I> </FONT></TT>, which will retrieve the most recent revision of every file in <I>directory</I> (and its subdirectories!) that you haven't already got a copy of. <BR> <BR>This makes several assumptions: <UL> <LI> That there's something to get - if you have already updated <I>directory</I> to the most recent revisions and nothing's been changed since, <TT><FONT COLOR="#990000">p4 sync </FONT></TT><FONT COLOR="#000000">won't retrieve the revisions again. (</FONT> <TT><FONT COLOR="#990000">p4 sync -f <I>directory/...#have</I> </FONT></TT><FONT COLOR="#000000">will do that.)</FONT></LI> <LI> <FONT COLOR="#000000">That <I>directory</I> is located under your local Perforce's client root. </FONT> The command...<BR> <BR></LI> <BR><TT><FONT COLOR="#990000"> p4 info</FONT></TT> <BR> <BR><FONT COLOR="#000000">will tell you what your client's root directory is.</FONT> <LI> <FONT COLOR="#000000">That <I>directory</I> is mapped in from the Perforce depot using your client specification. The command...</FONT><BR> <BR></LI> <BR><TT><FONT COLOR="#990000"> cd <I>directory</I><BR> p4 where <I>xxx</I></FONT></TT> <P><FONT COLOR="#000000">will product output that looks something like:</FONT> <BR><TT><FONT COLOR="#000000"> xxx - file(s) not in client view.</FONT></TT> <BR><FONT COLOR="#000000">if the directory's not included in your client view. (You'll want to see the documentation for help on this, but you'll know where to start: <U>client specification</U>.)</FONT></UL> <HR> <LI> <A NAME="comparefiles"></A><B>How do I compare a working file to an older version (other than the base)?</B></LI> <BR> <BR>Use <TT><FONT COLOR="#990000"> p4 diff <I>filename#revision</I> </FONT></TT>, which will compare the <U>working copy</U> of a file you've opened for edit or an integrate operation against the revision of the file you specify using "#revision". <P>For example, say you've opened <I>xyz.java</I> using the command: <BR> <BR><TT> <FONT COLOR="#990000"> p4 edit <I>xyz.java</I></FONT></TT> <BR> <BR>Various "diff" commands follow: <BR> <UL> <DL> <CENTER><TABLE BORDER WIDTH="80%" NOSAVE > <TR NOSAVE> <TD><TT><FONT COLOR="#990000">p4 diff <I>xyz.java</I></FONT></TT></TD> <TD NOSAVE>Compares your working copy against the revision your edits are on - if you are editing revision #4 of a file, this will compare your working copy against revision #4.</TD> </TR> <TR> <TD><TT><FONT COLOR="#990000">p4 diff <I>xyz.java#2</I></FONT></TT></TD> <TD>Compares your working copy against the revision #2.</TD> </TR> <TR> <TD><TT><FONT COLOR="#990000">p4 diff xyz.java#head </FONT></TT></TD> <TD>Compares your working copy against the most recent revision in the depot.</TD> </TR> <CAPTION ALIGN=BOTTOM> </CAPTION> </TABLE></CENTER> </DL> </UL> <HR> <LI> <A NAME="p4have"></A><B>How do I get a list of all files I have open on all my client workspaces?</B></LI> <BR> <BR>If your username is <I>joe</I>, then the following command will show you your opened files for all workspaces: <P><TT><FONT COLOR="#990000"> p4 opened -a | grep <I>joe</I></FONT></TT> <P>If you don't have "grep" (i.e. you're on Windows) you'll need to search the output of <TT><FONT COLOR="#990000">p4 opened</FONT></TT><FONT COLOR="#000000"> for this.</FONT> <BR> <HR> <LI> <A NAME="p4describe"></A><B>How do I examine the change log for a file?</B></LI> <BR> <BR>Use <TT><FONT COLOR="#990000">p4 filelog <I>filename</I> </FONT></TT><FONT COLOR="#000000">to get the list of <U>revisions</U> since a file was created in a particular codeline.</FONT> <P>Use <TT><FONT COLOR="#990000">p4 changes -i <I>directory/...</I> </FONT></TT><FONT COLOR="#000000">to get the list of <U>change numbers</U> since a file stored originally in Perforce.</FONT> <P><FONT COLOR="#000000">You'll recall that the difference between a <U>revision</U> and a <U>change number</U> is that the revision is specific to a file...</FONT> <BR><FONT COLOR="#000000"><TT> x.c#1 </TT><I>(revision #1 of file x.c)</I></FONT> <BR><FONT COLOR="#000000"><TT> x.c#2 </TT><I>(revision #2 of file x.c)</I></FONT> <BR><FONT COLOR="#000000"><TT> y.java#1 </TT><I>(revision #1 of file y.java)</I></FONT> <BR><FONT COLOR="#000000"><TT> y.java#2 </TT><I>(revision #2 of file y.java)</I></FONT> <BR><FONT COLOR="#000000"><TT> y.java#3 </TT><I>(revision #3 of file y.java)</I></FONT> <BR><FONT COLOR="#000000">The change number is a list of revisions that got changed as part of one atomic change to the Perforce depot. For example, change #12345 might be a change to add comments to x.c and y.java, and this change might've created revision #2 of<I> x.c</I> and #3 of <I>y.java.</I></FONT><HR> <LI> <A NAME="p4revert"></A><B>How do I abandon my changes and pick up a clean copy from the base?</B></LI> <BR> <BR>Use <TT><FONT COLOR="#990000">p4 revert <I>filename</I> </FONT></TT><FONT COLOR="#000000">to discard the modifications you've made to <I>filename</I> and retrieve a fresh copy of the <U>exact same revision</U> you had prior to typing</FONT> <TT><FONT COLOR="#990000">p4 edit <I>filename</I> </FONT><FONT COLOR="#000000">.</FONT></TT> <P>Use <TT><FONT COLOR="#990000">p4 revert <I>directory/...</I> </FONT></TT><FONT COLOR="#000000">to discard all the modifications you've made to any file in <I>directory</I> (or its subdirectories).</FONT><HR> <LI> <A NAME="individual_change"></A><B>How do I propagate an individual change made in one branch to another?</B></LI> <P>Let's say you have a main codeline, and a child codeline ("branch") called <I>methusalah</I>. <P>If you wanted to propogate change number 900 from the main codeline to <I>methusalah</I>, you'd type: <BR> <OL><TT><FONT COLOR="#990000">p4 integrate -b <I>methusalah</I> @900,@900</FONT></TT></OL> <P>Of course, if you wanted to propogate change number 902 from methusalah to the main codeline, you'd type: <BR> <OL><TT><FONT COLOR="#990000">p4 integrate -b <I>methusalah</I> -r @902,@902</FONT></TT><BR> <BR></OL> <FONT COLOR="#000000">The subsequent resolve/submit combination is left as an exercise.</FONT> <P><FONT COLOR="#000000">It's a good idea to include the original change number in the change description for the integration.</FONT> <BR> <HR> <LI> <A NAME="deletefile_weird"></A> <b>I created a file that begins with a dash, and want to 'p4 delete' it and cannot. What can I do?</b> <p> Let's say that the name of the file is <i>"-filename"</i>. <p> Run "<font COLOR="#990000">p4 delete dummy -filename</font>" to delete the file - ignore the comment about the dummy filename, its purpose is to stop the option/argument processing and let everything else on the command line be interpreted as filenames. <p> <i>Or, you could run "<font COLOR="#990000">p4 delete ./-filename</font>", which uses the Unix directory separator ('/') to construct a filename that refers to the same file, but doesn't begin with a dash. (NT uses might use '\'.)</i> </LI> <br> <hr> <LI> <A NAME="deleteclient"></A><B>How do I delete a client workspace?</B></LI> <BR> <BR><FONT COLOR="#000000">Use </FONT> <TT><FONT COLOR="#990000">p4 client -d <I>workspacename</I> </FONT></TT><FONT COLOR="#990000"> </FONT><FONT COLOR="#000000">to do this. The steps are:</FONT> <UL><li><FONT COLOR="#000000">Set $P4CLIENT to the name of the workspace, or make sure that every command you run for this task uses the syntax</FONT> <P><TT><FONT COLOR="#990000"> p4 -c <I>workspacename</I> cmd</FONT></TT> <BR> <LI> <FONT COLOR="#000000">Run </FONT> <FONT COLOR="#990000"><TT>p4 opened </TT> </FONT><FONT COLOR="#000000">to make sure that no files are opened for any operations in this workspace. If there are, use the command...</FONT></LI> <P><TT><FONT COLOR="#990000"> p4 revert <I>filelist</I></FONT></TT> <P><FONT COLOR="#000000">... to revert them.</FONT> <LI> <FONT COLOR="#000000">Remove the workspace entry on the Perforce server...</FONT></LI> <P><TT><FONT COLOR="#990000"> p4 client -d <I>workspacename</I></FONT></TT> <BR> <LI> <FONT COLOR="#000000">Remove the files and directories on the local disk that correspond to the client area.</FONT></LI> </UL> <HR> <LI> <A NAME="moveclient"></A><B>How do I move a client workspace?</B></LI> <P>It's easy, but requires a little planning. <BR> <OL> <LI> Figure out the new client "root". Let's say it's "/home/jojo/newroot".</LI> <LI> If you're using the Windows GUI program against this particular Perforce client, exit the GUI.</LI> <LI> Move the entire subtree from its old place to "/home/jojo/newroot".</LI> <BR>Run <TT><FONT COLOR="#990000">p4 client<I> </I></FONT></TT><FONT COLOR="#000000"> , which will dump you into the editor - you'll be changing the client specification. Change the "Root:" field to the name "/home/jojo/newroot" and save the file.</FONT> <BR> </OL> <hr> <LI> <A NAME="sync_fails"><b>I can't "p4 sync" a particular file. What might be going on?</b></li> <p> Let's say that you can retrieve all the files in the directory (using the depot name syntax) //bas/BIN/src/krn/rsec/ except the file //bas/BIN/src/krn/rsec/rsecstoc.c. <p> It could be several things: <ol> <li>The other files it gets are in the directory <tt>//bas/bin/src/krn/rsec/...</tt> If that's the case, you're up against upper-case/lower-case issues. (The NT version of the server ignores case; the Unix version of the server does not.) If this is the case, it'll be easiest to go to a Unix client and rename the file to be in the same directory as the files that are succeeding. ("p4 help rename" gives the steps for renaming a file.) <li>You might not have permissions on this file from this IP address for this user. Use "p4 protect -o" and "p4 where" to make sure that isn't the case. <li>The client spec might not be mapping that file as you expect. The command "<TT><FONT COLOR="#990000">p4 where //bas/BIN/src/krn/rsec/rsecstoc.c<I> </I></FONT></TT><FONT COLOR="#000000">" will process the argument filename through the client spec [processing] code to tell you where it would be mapped. <li>The top-most revision of that file might be a "delete" revision, so that there's nothing to get(!). ("<TT><FONT COLOR="#990000">p4 files //bas/BIN/src/krn/rsec/rsecstoc.c<I> </I></FONT></TT><FONT COLOR="#000000">" will tell you the type of the top-most revision of the file.) <li>There might be nothing to get, because it thinks you have the most recent revision. "p4 have //bas/BIN/src/krn/rsec/rsecstoc.c" will tell you if you already have a revision for that file, or at least whether the database thinks you do. ("<TT><FONT COLOR="#990000">p4 sync -f //bas/BIN/src/krn/rsec/rsecstoc.c<I> </I></FONT></TT><FONT COLOR="#000000">" will force getting a fresh revision.) </ol> </OL> <P><I>Last modified on 11 November 1998.</I> </BODY> </HTML>