p4History

Introduction

Perforce has commands that give the history of changes to a file, and other commands that give information on labels. However, there is no single command that gives an "integrated" history, showing all of a file's changes and which labels match up with those changes.

Having an integrated history is essential for understanding the changes that occurred between labels (that is, the changes between builds, releases, or other milestones that are labeled).

The p4History.py script displays the revision history of a file in reverse chronological order (like p4 changes or p4 filelog), but it also interleaves the labels (if any) applied to this file. Normally you would have to invoke the p4 labels and p4 files commands separately to get all of this information.

Environment Requirements

  1. This script invokes the Perforce p4 command-line interface to get the needed information from Perforce. The p4 command must be available on your PATH, and you must have configured your environment so that the p4 command is able to access the Perforce server.
  2. You must have Python installed. This script has been tested using Python 2.2.

Command Line Syntax

  p4History.py filename

Example

Sample invocation:
  p4History.py build.sh
Sample output:
  Label ducati-label-5: niranjan: 07/03/03 16:34: Created by niranjan.
  Label suzuki-label-3: niranjan: 07/02/03 22:19: Created by niranjan.
  Change 3913: mstuart: 07/01/03 16:03: Split StringMapper utility class into its own file
  Change 3903: mstuart: 06/30/03 15:59: Implement migration from condenser.xml into database
  Change 3890: krishna: 06/30/03 11:10: fixed a security bug w/ jboss
  Change 3886: mstuart: 06/27/03 18:35: Compile JPull and JConsole with the same javac command, because they depend on each other.
  Change 3863: krishna: 06/26/03 16:39: Added node type detection via node manager
  Label suzuki-label-2: niranjan: 06/25/03 17:50: Created by niranjan.
  Change 3851: krishna: 06/25/03 16:49: Build error with cp
  Change 3823: krishna: 06/24/03 16:19: Product Separation project : another batch of changes
  Change 3780: mstuart: 06/20/03 19:56: Add MBean meta info class
  . . .
From the above output we can see that Change 3851 is included in suzuki-label-2, but Change 3863 is not. This type of view helps to answer questions about which features and bug fixes appear in which releases.