Skip to content
Stefan von Dutch edited this page Apr 24, 2016 · 55 revisions

Welcome to p4twitter!

What is p4twitter?

p4twitter is a command-line utility that will publish the description of your Perforce commits to Twitter.

Because tweets are text-based posts of up to 140 bytes in length, Twitter is an excellent channel to publish your commits to your target audience.

Click here to download p4twitter (version 2.0 released on October 12, 2010)

What is Perforce?

Perforce is a version control system.

What operating systems do you support?

p4twitter is Windows-only.

How do I set this thing up?

Before p4twitter can "tweet" on your behalf, you need to authorize it (basically, you will need to allow p4twitter to access your Twitter account):

p4twitter /authorize

  1. a web browser will open automatically
  2. enter your Twitter username and password
  3. Twitter will "respond" with a PIN
  4. enter this PIN into the p4twitter console
  5. p4twitter will provide you with your OAuth Access Token (see below)

Note: p4twitter /authorize is a one-time procedure. If successful, it will provide you with your OAuth Access Token (see below) and you do not have to execute this again (unless you need to authorize another Twitter account).

What are the p4twitter command-line parameters?

p4twitter expects the following command-line parameters:

oauth_token        = your OAuth Access Token
oauth_token_secret = your OAuth Access Token Secret
p4user             = your Perforce username (probably Administrator)
p4passwd           = your Perforce password (probably the Administrator password)

In addition to the above, p4twitter expects a command-line parameter named changelist, but this is provided by the Perforce server itself via the %changelist% variable:

p4twitter changelist=%changelist%

How do I install p4twitter?

  1. Unzip p4twitter.zip to your Perforce server directory (probably C:\Program Files\Perforce)
  2. Authorize p4twitter (via the /authorize command-line argument) so that p4twitter can access your Twitter account and "tweet" on your behalf.
  3. Create a new Perforce trigger (click here for more info on Perforce triggers).

We're not going to repeat everything about Perforce triggers here, but you easily create a Perforce trigger via the p4 triggers command. Here's an example:

p4twitter change-commit //depot/... "p4twitter.exe oauth_token=*** oauth_token_secret=*** p4user=*** p4passwd=*** changelist=%changelist%"

This example above breaks down to this:

p4twitter

the name of the trigger.

change-commit

trigger type. change-commit is a trigger that will execute after your commit.

//depot/...

a file pattern in depot syntax. when a dev commits a change that contains any files that match this file pattern, this trigger is executed.

"p4twitter.exe oauth_token=*** oauth_token_secret=*** p4user=*** p4passwd=*** changelist=%changelist%"

the command for the Perforce server to run. must be quoted. please make sure to include all the command-line parameters and the %changelist% variable.

Note: p4twitter will ALWAYS return an exit status of 0 (zero), even if sending the description of your commit to Twitter fails for whatever reason. We're doing this because your commit should ALWAYS succeed.

Is p4twitter free?

Yes, p4twitter is freeware but unsupported. Use at your own risc.