Perforce Command Line Global Options

<!– .style1 { font-size: 24px; font-weight: bold; } –>

Perforce Command Line Global Options

Global options for Perforce commands; these options can be supplied on the command line before any Perforce command.

Syntax
p4 [-cclient -ddir -Hhost -pport -Ppass -uuser -xfile -Ccharset -Qcharset -Llanguage] [-G] [-s] [-z tag] cmd [args …]
p4 -V
p4 -h

 

Options
 
-c client
Overrides any P4CLIENT setting with the specified client name.
-d dir
Overrides any PWD setting (i.e. current working directory) and replaces it with the specified directory.
-G
Causes all output (and batch input for form commands with -i) to be formatted as marshalled Python dictionary objects. This is most often used when scripting.
-H host
Overrides any P4HOST setting and replaces it with the specified hostname.
-p port
Overrides any P4PORT setting with the specified port number.
-P pass
Overrides any P4PASSWD setting with the specified password.
-s
Prepends a descriptive field (for example, text:, info:, error:, exit:) to each line of output produced by a Perforce command. This is most often used when scripting.
-u user
Overrides any P4USER, USER, or USERNAME setting with the specified user name.
-x file
Instructs Perforce to read arguments, one per line, from the specified file. If file is a single hyphen (-), then standard input is read.
-C charset
Overrides any P4CHARSET setting with the specified character set.
-Q charset
Overrides any P4COMMANDCHARSET setting with the specified character set.
-L language
This feature is reserved for system integrators.
-z tag
Causes output of many reporting commands to be in the same tagged format as that generated by p4 fstat.
-V
Displays the version of the p4 client program and exits.
-h
Displays basic usage information and exits.

 

Usage Notes
Be aware that the global options must be specified on the command line before the Perforce command. Options specified after the Perforce command will not be interpreted as global options, but as options for the command being invoked. It is therefore possible to have the same command line option appearing twice in the same command, being interpreted differently each time.
For example, the command p4 -c anotherclient edit -c 140 file.c will open file file.c for edit in pending changelist 140 under client workspace anotherclient.
The -x option is useful for automating tedious tasks; a user adding several files at once could create a text file with the names of these files and invoke p4 -x textfile add to add them all at once.
The -x option can be extremely powerful – as powerful as whatever generates its input. For example, a UNIX developer wishing to edit any file referring to an included file.h file, for instance, could grep -l file.h *.c | cut -f1 -d: | p4 -x – edit.
In this example, the grep command lists occurrences of file.h in the *.c files, the -l option tells grep to list each file only once, and the cut command splits off the filename from grep’s output before passing it to the p4 -x command.
The -s option can be useful in automated scripts.
For example, a script could be written as part of an in-house build process which executes p4 -s commands, discards any output lines beginning with “info:”, and alerts the user if any output lines begin with “error:”.
Python developers will find the -G option extremely useful for scripting. For instance, to get a dictionary of all fields of a job whose ID is known, use the following:
job_dict = marshal.load(os.popen(‘p4 -G job -o ‘ + job_id, ‘rb’))
In some cases, it may not be intuitively obvious what keys are used by the client program. If you pipe the output of any p4 -G invocation to the following script, you will see every record printed out in key/value pairs:
Tagged : / / / / /

Perforce Command Line

Command

Description

p4 add
Open file(s) in a client workspace for addition to the depot.
p4 admin
Perform administrative operations on the server.
p4 branch
Create or edit a branch specification and its view.
p4 change
Create or edit a changelist specification.
p4 changelists
List submitted and pending changelists.
p4 changelist
Create or edit a changelist specification.
p4 client
Create or edit a client workspace specification and its view.
p4 clients
List all client workspaces currently known to the system.
p4 delete
Open file(s) in a client workspace for deletion from the depot.
p4 depot
Create or edit a depot specification.
p4 depots
Display a list of depots known to the Perforce server.
p4 describe
Provides information about changelists and the changelists’ files.
p4 groups
List groups of users.
p4 group
Add or delete users from a group, or set the maxresults, maxscanrows, and timeout limits for the members of a group.
p4 have
List files and revisions that have been synced to the client workspace
p4 info
Display information about the current client and server.
p4 integrate
Open files for branching or merging.
p4 integrated
Show integrations that have been submitted.
p4 job
Create or edit a defect, enhancement request, or other job specification.
p4 jobs
List jobs known to the Perforce server.
p4 label
Create or edit a label specification and its view.
p4 labels
Display list of defined labels.
p4 lock
Lock an opened file against changelist submission.
p4 login
Log in to a Perforce server by obtaining a ticket.
p4 logout
Log out of a Perforce server by removing or invalidating a ticket.
p4 passwd
Change a user’s Perforce password on the server.
p4 rename
Renaming files under Perforce.
p4 resolve
Resolve conflicts between file revisions.
p4 revert
Discard changes made to open files.
p4 set
Set Perforce variables in the Windows registry.
p4 submit
Send changes made to open files to the depot.
p4 sync
Copy files from the depot into the workspace.
p4 tag
Tag files with a label.
p4 triggers
Edit a list of scripts to be run conditionally whenever changelists are submitted, forms are updated, or when integrating Perforce with external authentication mechanisms.
p4 user
Create or edit Perforce user specifications and preferences.
p4 users
Print a list of all known users of the current server.
p4 verify
Verify that the server archives are intact.
p4 workspace
Create or edit a client workspace specification and its view.
Tagged : / / / / /

Most User P4 Command Line – P4 Commands Reference

p4-command-line

p4 add

Open file(s) in a client workspace for addition to the depot.

Assigns a specific file type to a new file, overriding any settings in the typemap table

p4 add -t binary file.pdf

Opens all the files within the user’s current directory for add, and links these files to changelist 13.

p4 add -c 13 *

Opens all *.c files in the user’s ~/src directory for add; also opens the README file in the user’s current working

directory for add. These files are linked to the default changelist.

p4 add README ~/src/*.c

Opens a file named *.c for add.

p4 add -f *.c

p4 admin

Perform administrative operations on the server.

Stop the Perforce server

p4 admin stop

p4 change

Create or edit a changelist specification.

Create a new changelist.

p4 change

Edit previously submitted changelist 25. Administrator or superuser access is required.

p4 change -f 25

p4 changelists

List submitted and pending changelists.

p4 delete

Open file(s) in a client workspace for deletion from the depot.

Opens the file called README in the depot’s top level directory for deletion. The corresponding file within the client workspace is immediately deleted, but the file is not deleted from the depot until the default changelist is submitted.

p4 delete //depot/README

Opens file in the current client workspace for deletion. The file is immediately removed from the client orkspace, but won’t be deleted from the depot until changelist 40 is sent to the server with p4 submit.

p4 delete -c 40 file

p4 edit

Opens file(s) in a client workspace for edit.

Opens all files ending in .txt within the current directory’s doc subdirectory for edit. These files are linked to the default changelist; these files are stored as type text with keyword expansion.

p4 edit -t text+k doc/*.txt

p4 have

List files and revisions that have been synced to the client workspace

p4 info

Display information about the current client and server.

p4 integrate

Open files for branching or merging.

Branch or merge all files in //depot/dev/… to the corresponding files in

//depot/rel2/… If there is no corresponding file in //depot/rel2/…, this creates it.

p4 integ //depot/dev/… //depot/rel2/…

p4 job

Create or edit a defect, enhancement request, or other job specification.

p4 login

Log in to a Perforce server by obtaining a ticket.

p4 passwd

Change a user’s Perforce password on the server.

p4 resolve

Resolve conflicts between file revisions.

p4 revert

Discard changes made to open files.

Revert all open files to their pre-opened state.

p4 revert //depot/…

p4 submit

Send changes made to open files to the depot.

Submit the default changelist. The user’s revisions of the files in this changelist are stored in the depot.

p4 submit

Submit changelist 41.

p4 submit -c 41

p4 sync

Copy files from the depot into the workspace.

p4 sync

p4 sync file.c#4

p4 sync //depot/proj1/…@21

p4 user

Create or edit Perforce user specifications and preferences.

View the user specification of Perforce user joe.

p4 user joe

Edit the user specification for the current Perforce user.

p4 user

Delete the user specification for the Perforce user sammy.

p4 user -d sammy

P4CONFIG

Tagged : / / / / / / / / / / / /

Command Line to find a Change list properties in perforce server

command-line-to-find-a-change-list-properties-in-perforce-server

Command Line to find a Change list properties and associated path of the file in perforce server view:

Examples of the command you want:
p4 describe 1231928
p4 describe -s 1231928
p4 files @=1231928

Where 1231928 is the change list number.

Tagged : / / / / / / / / / / / / /