Class Perforce
In: lib/perforce.rb
Parent: Object

Perforce — class representing a connection to a perforce server.


Classes and Modules

Class Perforce::Changelist


use_pwd_symlinks  [RW]  Whether the current directory as reported to the perforce server can contain symlinks. Default is false.

Public Class methods

Connect to a perforce depot.

The argument spec is a hash of (method, value) pairs sent to the underlying P4 object.

The given values override the P4PORT, P4CLIENT, etc. environment variables.


  # This calls P4#user=, P4#password=, P4#client=, P4#port= with
  # these values, then calls P4#connect.
    :user => "iggy_fenton",
    :password => "<password or ticket number>",
    :client => "iggy_fenton_project",
    :port => "server_name:1666")

Public Instance methods

Change working directory (locally and remotely).

If a block is given, the original working directory is restored when the block exits. (Behavior is like Dir.chdir.)

Delete all empty changelists.

Edit and submit files in one step.


  perforce.edit_and_submit("remove trailing whitespace", files) {
    # Do stuff with the files.
    # ...
  # Changes are submitted when the block ends.

Create a Changelist with the given description (a string).

The underlying P4 object from the P4Ruby package.

Return the pending changelists (as Changelist objects).

Revert these files.

Client root directory.

Run a general p4 command.


  puts "Your server version is: "

Call P4#input(input) and then P4#run(*args)

Calls run("sync", *args)