Parent

Files

Class/Module Index [+]

Quicksearch

Capistrano::Deploy::SCM::Perforce

Implements the Capistrano SCM interface for the Perforce revision control system (www.perforce.com).

Public Instance Methods

checkout(revision, destination) click to toggle source

Returns the command that will sync the given revision to the given destination directory. The perforce client has a fixed destination so the files must be copied from there to their intended resting place.

# File lib/capistrano/recipes/deploy/scm/perforce.rb, line 27
def checkout(revision, destination)
  p4_sync(revision, destination, p4sync_flags)
end
diff(from, to=head) click to toggle source

Returns the command that will do an "p4 diff2" for the two revisions.

# File lib/capistrano/recipes/deploy/scm/perforce.rb, line 46
def diff(from, to=head)
  scm authentication, :diff2, "-u -db", "//#{p4client}/...#{rev_no(from)}", "//#{p4client}/...#{rev_no(to)}"
end
export(revision, destination) click to toggle source

Returns the command that will sync the given revision to the given destination directory. The perforce client has a fixed destination so the files must be copied from there to their intended resting place.

# File lib/capistrano/recipes/deploy/scm/perforce.rb, line 41
def export(revision, destination)
  p4_sync(revision, destination, p4sync_flags)
end
handle_data(state, stream, text) click to toggle source

Determines what the response should be for a particular bit of text from the SCM. Password prompts, connection requests, passphrases, etc. are handled here.

# File lib/capistrano/recipes/deploy/scm/perforce.rb, line 69
def handle_data(state, stream, text)
  case text
  when /\(P4PASSWD\) invalid or unset\./
          raise Capistrano::Error, "scm_password (or p4passwd) is incorrect or unset"
  when /Can.t create a new user.*/
          raise Capistrano::Error, "scm_username (or p4user) is incorrect or unset"
  when /Perforce client error\:/
          raise Capistrano::Error, "p4port is incorrect or unset"
  when /Client \'[\w\-\_\.]+\' unknown.*/
          raise Capistrano::Error, "p4client is incorrect or unset"
  end
end
head() click to toggle source

Perforce understands 'head' to refer to the latest revision in the depot.

# File lib/capistrano/recipes/deploy/scm/perforce.rb, line 20
def head
  'head'
end
log(from=1, to=head) click to toggle source

Returns a "p4 changes" command for the two revisions.

# File lib/capistrano/recipes/deploy/scm/perforce.rb, line 51
def log(from=1, to=head)
  scm authentication, :changes, "-s submitted", "//#{p4client}/...#{rev_no(from)},#{rev_no(to)}"
end
next_revision(revision) click to toggle source

Increments the given revision number and returns it.

# File lib/capistrano/recipes/deploy/scm/perforce.rb, line 62
def next_revision(revision)
  revision.to_i + 1
end
query_revision(revision) click to toggle source
# File lib/capistrano/recipes/deploy/scm/perforce.rb, line 55
def query_revision(revision)
  return revision if revision.to_s =~ /^\d+$/
  command = scm(authentication, :changes, "-s submitted", "-m 1", "//#{p4client}/...#{rev_no(revision)}")
  yield(command)[/Change (\d+) on/, 1]
end
sync(revision, destination) click to toggle source

Returns the command that will sync the given revision to the given destination directory. The perforce client has a fixed destination so the files must be copied from there to their intended resting place.

# File lib/capistrano/recipes/deploy/scm/perforce.rb, line 34
def sync(revision, destination)
  p4_sync(revision, destination, p4sync_flags)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.