I am used to with P4V or P4Win but from time to time, I need the "p4" from command line to pass the output to the script.
I found the following p4 commands are obligatory.
To view the current p4 setting, type:
>p4 info
To view it from windows environment:
>set
You can see P4CLIENT and other P4's setting parameters.
To remove p4 client :
>p4 client -d client_name
Otherwise try to create a new one or edit the default one with :
>p4 client
it will give you a temp file to be edited. You can then change to any new client's names
which map to your mapping directories. We usually simply change the "client" and "view" entries where the client can be new name while views are your mappings.
(mind you, take care not to put the new line ending at the end of your views entries otherwise you will get the error message)
Or set it with:
>set P4CLIENT=new_client_name
Now, check if the P4CLIENT is set properly
>echo %P4CLIENT%
Normally, we just need the setting to P4USER (default is automatic set from windows's login account), P4EDITOR (default is notepad for Windows) and P4PORT (it must be manually set). However under Linux, we might need to explicitly export the P4USER in .bashrc if it is not set.
This is my case, I simply added the following lines in my .bashrc:
export P4USER=pattreeya
export P4EDITOR=vim
export P4PORT=scm-srv:1666
To list all p4 environment variables used by Perforce:
>p4 help environment
To diff the local files and the ones in depot, type:
>p4 diff -du20 > diff.txt
The option -du is the unified different and contain 20 lines prior each difference.
To diff between two branches, try:
>p4 diff2 -dub20 -u //work/dev_01/... //work/dev_02/... > diffs.txt
To list the current workspace owned by a user:
>p4 clients -u username
For more detail of p4 commands, type "p4" or "p4 help simple" or "p4 help commands".