Executing Perforce commands from TextPad

Instructional HowTos, posted by users. No questions here please.

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
paulchernoch
Posts: 1
Joined: Wed Aug 25, 2004 4:57 pm
Location: Burlington, MA

Executing Perforce commands from TextPad

Post by paulchernoch »

How to configure TextPad to work with Perforce (Version Control System)

1) Configure the command line version of Perforce, P4.EXE. This means setting the environment variables P4CLIENT, P4PORT, P4USER and P4PASSWD.
2) You may need to perform the Perforce menu command Settings > Use Current as Default. This seems to set the configuration and connection settings that will be used by the command line tool as well as the Windows Explorer interface for Perforce.
3) In TextPad, choose the menu item Configure > Preferences.
4) Click on “Tools�.
5) Click the Add button in the upper right corner. From the drop down that appears, choose “Program…�
6) Browse to the location of your Perforce installation and find the P4.EXE command line processor. Most likely, it is something like “C:\Program Files\Perforce\p4.exe�.
7) In the Preferences dialog you will see “P4� appear. Click on it once, then pause, and then click a second time. Edit the command name to be something meaningful.
8) Click the “Apply� button and the new tool should appear in the left part of the panel.
9) Click on the new tool name in the left part of the panel and the right part should show the tools properties. Edit the properties to reflect the action you want to occur.
10) Leave the ‘Command’ alone (e.g. C:\Program Files\Perforce\p4.exe)
11) Change the ‘Parameters’ to reflect the P4 command syntax. TextPad supports numerous macros that are useful. $File is the filename and is useful in several commands.
12) Leave ‘Initial Folder’ as $FileDir.
13) Leave the ‘Capture output’ box checked.
14) Click on Apply and the tool is ready for use, bound to one of the pickaxes on the Tools toolbar, as well as appearing in the Tools menu.
15) Some useful examples I have created:
A. Adding a new file
* Command Name: Perforce – Add file
* Parameters: add $File
B. Checking out a file to Edit
* Command Name: Perforce – Edit file
* Parameters: edit $File
C. Comparing the checked out file with the head version
* Command Name: Perforce - Diff file
* Parameters: diff $File
D. Listing all checked files checked out (opened) by me
* Command Name: Perforce – Opened files
* Parameters: opened
E. Listing all files that I have checked out and changed
* Command Name: Perforce – Changed files
* Parameters: diff -sa

Notice how I do not use $File in some examples, since they do not take a filename as an argument.
To use the Add file and Edit file commands, all I have to do is select the appropriate file in my TextPad workspace as the current file, then click on the appropriate tool icon or Tool menu item. The results show up in the Command Results buffer.

There are many other useful Perforce commands one might make tools for. I prefer to do my check-ins using Perforce's Windows GUI (P4Win) so I can enter a good reason into the Changelist,
so I have not created a tool for that.


- Paul A. Chernoch
Software Engineer
Charles River Development
Burlington, MA, USA
danglund
Posts: 7
Joined: Mon Jul 14, 2003 9:39 am

Revert

Post by danglund »

To see open and open-and-changed files was useful. A tool for reverting files is covered in my previous post:

http://www.textpad.com/forum/viewtopic.php?t=4058

Can anyone get Textpad to refresh after opening a file for edit? After opening file for edit, textpad locks the file as read only until Textpad is refreshed (e.g. by unfocus/focus Textpad window)..

Dan
--
Post Reply