About this project
px is an extended command line client for Perforce. It's designed to be a drop-in replacement for p4, with extended features.
- Portable: Written in C++, it should run on Windows, Mac, and modern Unix variants.
- Extensible: new commands are fairly easy to add.
- Compatible with p4. Existing p4 commands should behave the same, and extended commands should follow similar syntax.
Extended Global Options
The -F <format> will run the command in tagged mode, and output custom formatted messages. Tagged variables will be substituted for each message. For example:
C:\ px -F "%depotFile%#%rev%" files @1234,@1234 //depot/path/foo#3 //depot/path/bar#4
In this case, the variables 'depotFile' and 'rev' (case sensitive) are substituted for each file in changelist 1234. This can be particularly useful for simple scripting and one-liners, as it can produce the exact output required as input into a 'p4 -x -' command.
The -X <file> global option works similarly to the -x option, but it runs the commands one at a time. This is useful for commands that do not allow multiple arguments. For example, to unfix all jobs on a changelist, you can run this one-liner:
c:\ px -F "%Job%" fixes -c 1234 | px -X - fix -d -c 1234
When P4COLORS is set (Windows only), output is color coded for Errors, Warnings, and Messages. You can set P4COLORS like any other Perforce environment variable, although there is no command line switch. P4COLORS must be exactly 3 characters, each 0 through F, signifying the following:
0 = Black 8 = Gray 1 = Blue 9 = Light Blue 2 = Green A = Light Green 3 = Aqua B = Light Aqua 4 = Red C = Light Red 5 = Purple D = Light Purple 6 = Yellow E = Light Yellow 7 = White F = Bright White
For example, with P4COLORS=FEC px will print informational messages in bright white, warnings in yellow, and errors in red... which is a reasonably attractive output with a black background.
Although set is part of the p4 command-line client, it is implemented only on the client, and therefore needed to be added to px. It behaves the same as the p4 set command.
Outputs files in changelists that are fixed by the specified job(s). Each revision of a file fixed by the job(s) will be output. The -s flag will limit the output to only the highest revision of a file fixed by a job.
Displays the md5 digest of a local file using the same logic as the server. On Windows, Perforce normalizes the line-endings for text files, so md5sum output will be inacurate. The md5 command uses Perforce's logic, so you can compare local digests to the ones computed on the server. Also, md5 will use Perforce's logic to interogate the type of the local file (although it will not honor the typemap config). The -t flag can be used to force the file as text or binary.
Recursively opens for add an entire local directory hierarchy. Local hierarchies must be formated with a '...' at the end and no other wildcards. Paths can be either relative or absolute, and a trailing slash (or backslash) must precede the '...'. Here are a few examples:
c:\clientroot\path\to\files\> px addr ... c:\> px addr c:\clientroot\path\to\files\... c:\clientroot\> px addr path\to\files\... ~/p4/path/to/files/ > px addr ... ~/ > px addr /home/user/p4/path/to/files/... ~/p4/ > px addr path/to/files/...
Rolls back a submitted changelist. (See the rollback project page.)
* px * Copyright (c) 2008 Shawn Hladky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Portions from p4u and p4dctl http://public.perforce.com:8080/guest/tony_smith/perforce/p4u/ http://public.perforce.com:8080/guest/tony_smith/perforce/p4dctl/ ------------------------------------------------------------------------------ Copyright (c) 2004-2008, Perforce Software, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------