You can add commands and folders to the Tools menu. The tools can then be accessed from the Tools menu in P4V and optionally from context menus. You can export your custom tool definitions to a file from which other P4V users can import them.
P4V launches the specified custom tool in an external process. Perforce settings are exported to the external process as follows: the P4PORT, P4USER, P4CLIENT and P4CHARSET settings in effect for the P4V connection are exported to the external process, plus any other Perforce settings present in the environment in which P4V is running, including command-line arguments specified when P4V was launched and global settings (on Windows machines, settings configured using the p4 set -s command).
If the P4CONFIG environment variable is set, the tool recognizes any P4CONFIG files present in the file hierarchy on which it is operating. Settings in P4CONFIG files override settings in the environment. To ensure that P4CONFIG settings do not override environment settings, check Ignore P4CONFIG files. (For details about config files, refer to the P4 User's Guide.) If you are passing arguments to a custom tool, check Ignore P4CONFIG files to ensure that the server settings used by the custom tool correspond to the values that are passed.
On a Mac, custom tools are not launched from a shell by default. For tools that must recognize P4CONFIG settings, create a script that launches a shell before invoking the tool, or define P4CONFIG globally (for example, in /etc/profile,/etc/profile.local, or /etc/csh.login). To spawn a shell using Bourne shell, issue the #!/bin/sh command. For the C shell, issue the #!/bin/tcsh command.
If you need to keep a tool running or launch another application, run it in the background and exit the shell or process that was launched by the custom tool. This approach ensures that you do not block another tool and that the application will remain open when you exit P4V.
To add custom tools to P4V:
Important: To define tools that issue p4 commands, specify "p4" in the Application field and the command and desired arguments (for example, "fix -c %c job000001") in the Arguments field. In general, be sure to specify the application and arguments separately in the fields provided.
|%C, %c||Selected changelists|
|%D, %d||Selected files or folders (depot syntax used for depot files)|
|%F, %f||Selected files (workspace syntax used for depot files)|
|%i||Selected workspace specifications|
|%J, %j||Selected jobs|
|%O, %o||Depends on which pane has focus:|
|When left pane has focus, selected checked out files.|
|When right pane has focus, all checked out files.|
|%P, %p||Selected pending changelists|
|%S, %s||Selected submitted changelists|
|$c||Current workspace specification|
|$r||Current client workspace root|
|$D||Arguments from prompt dialog|
|$%||Literal '%' character|
|$$||Literal '$' character|
Notes about arguments:
For example: "
mycommand %F" runs "
arg2 arg3" and "
mycommand %f" runs "
arg1; mycommand arg2; mycommand arg3".
/tmp), or specify %f, which uses the directory of the selected file.(Note: If you specify %f, omit any other values. For example,
You can export the tools you've defined to an XML file that other P4V users can import. Likewise, you can import tools that other P4V users have created.
To import tools:
To export tools:
Note: On Windows, if a tool does not run, verify that the files that it opens have their extensions mapped to the required application.