|
|
Command Reference
p4 sync ...
This is a quick way to check out latest from the repository for the current directory and below. Between this and the P4 plug-in for my IDE, I rarely need to use the full P4 client. Tips and Tricks
Set P4CLIENT Environment Variable
If not present, P4 commands will look for a client (workspace) definition having your machine name. If you want to run multiple clients, it's handy to set the system environment variable. Use Alternate Roots to Enable Access from DOS and Cygwin
You can use P4 commands to access a workspace from within DOS or Unix (like Cygwin). To enable this, specify an alternate root in your workspace definition. For example, you can configure
Root: c:\p4workspace
AltRoots: /cygdrive/c/p4workspace
Now you can run commands like p4sync from within DOS or Cygwin. If your workspace name is not your machine name, you may also need to set the P4CLIENT environment variable. For a Windows / Cygwin machine, set a Windows env variable using Windows + Break that will get picked up both in DOS and Cygwin.
You can also use an alternate root to specify a path on a different machine. This is helpful when accessing files remotely via Samba, for example. Configure both machines to use the same workspace definition (P4CLIENT env var), and specify an alternate root for the local path to the remote file system. Exclude Large Files from Your Workspace
Suppose your SCM guy checks in the entire maven repository to various places in the Perforce depot. Every time you do a sync on a remote connection, you waste time sucking down large files you don't really need. You can exclude these from the view. In the P4 client, edit the workspace, go to the View tab, right-click on an offending directory, and select Exclude from Tree. Alternatively, you can put wildcard expressions in your workspace configuration to exclude a range of directories. To do this, right-click anywhere in the View tab and select "Exclude Special..." Then select "Expression" and enter the depot and local path you wish to exclude, like:
-//depot/.../maven/... //dchandler/.../maven/...
These expressions will exclude everything under a folder named maven. Gotchas
Be Careful with "Remove From Workspace" and "Force" Options
It will remove the physical file from your filesystem as well as your workspace on the P4 server. If you're just trying to get the latest copies of a tree, use the "Force" option with Get Revision... in the P4 client. Of course, this will override any newer versions you haven't checked in yet, so you might want to save a copy first. Integration with Eclipse
Getting Started
P4 integration with Eclipse is very slick. You can check files in and out from your existing P4 workspace by right-clicking and selecting the Team menu in Eclipse. You can download the Perforce plug-in from within Eclipse from http://www.perforce.com/downloads/http/p4-wsad/install/.
To show version info next to your files in Package Explorer, go to Window | Preferences | Appearance | Label Decorations and check the Perforce box. Troubleshooting
If the P4 menus in Eclipse are acting weird, close the project, then reopen it. That usually clears it up. If not, try restarting Eclipse. |