Class: Capistrano::Deploy::SCM::Perforce

Class | Capistrano::Deploy::SCM::Perforce
In: | lib/capistrano/recipes/deploy/scm/perforce.rb lib/capistrano/recipes/deploy/scm/perforce.rb
Parent: | Base

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

### Methods

checkout checkout diff diff export export handle_data handle_data head head log log query_revision query_revision sync sync

### Public Instance methods

checkout(revision, destination)

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.

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 27
    27:         def checkout(revision, destination)
    28:           p4_sync(revision, destination, p4sync_flags)
    29:         end

checkout(revision, destination)

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.

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 27
    27:         def checkout(revision, destination)
    28:           p4_sync(revision, destination, p4sync_flags)
    29:         end

diff(from, to=head)

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

[Source]

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

diff(from, to=head)

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

[Source]

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

export(revision, destination)

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.

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 41
    41:         def export(revision, destination)
    42:           p4_sync(revision, destination, p4sync_flags)
    43:         end

export(revision, destination)

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.

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 41
    41:         def export(revision, destination)
    42:           p4_sync(revision, destination, p4sync_flags)
    43:         end

handle_data(state, stream, text)

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

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 64
    64:         def handle_data(state, stream, text)
    65:           case text
    66:           when /\(P4PASSWD\) invalid or unset\./i
    67:                   raise Capistrano::Error, "scm_password (or p4passwd) is incorrect or unset"
    68:           when /Can.t create a new user.*/i
    69:                   raise Capistrano::Error, "scm_username (or p4user) is incorrect or unset"
    70:           when /Perforce client error\:/i
    71:                   raise Capistrano::Error, "p4port is incorrect or unset"
    72:           when /Client \'[\w\-\_\.]+\' unknown.*/i
    73:                   raise Capistrano::Error, "p4client is incorrect or unset"
    74:           end
    75:         end

handle_data(state, stream, text)

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

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 64
    64:         def handle_data(state, stream, text)
    65:           case text
    66:           when /\(P4PASSWD\) invalid or unset\./i
    67:                   raise Capistrano::Error, "scm_password (or p4passwd) is incorrect or unset"
    68:           when /Can.t create a new user.*/i
    69:                   raise Capistrano::Error, "scm_username (or p4user) is incorrect or unset"
    70:           when /Perforce client error\:/i
    71:                   raise Capistrano::Error, "p4port is incorrect or unset"
    72:           when /Client \'[\w\-\_\.]+\' unknown.*/i
    73:                   raise Capistrano::Error, "p4client is incorrect or unset"
    74:           end
    75:         end

head()

Perforce understands ‘head’ to refer to the latest revision in the depot.

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 20
    20:         def head
    21:           'head'
    22:         end

head()

Perforce understands ‘head’ to refer to the latest revision in the depot.

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 20
    20:         def head
    21:           'head'
    22:         end

log(from=1, to=head)

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

[Source]

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

log(from=1, to=head)

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

[Source]

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

query_revision(revision) {|command| ...}

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 55
    55:         def query_revision(revision)
    56:           return revision if revision.to_s =~ /^\d+$/
    57:           command = scm(authentication, :changes, "-s submitted", "-m 1", "//#{p4client}/...#{rev_no(revision)}")
    58:           yield(command)[/Change (\d+) on/, 1]
    59:         end

query_revision(revision) {|command| ...}

[Source]

        # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 55
    55:         def query_revision(revision)
    56:           return revision if revision.to_s =~ /^\d+$/
    57:           command = scm(authentication, :changes, "-s submitted", "-m 1", "//#{p4client}/...#{rev_no(revision)}")
    58:           yield(command)[/Change (\d+) on/, 1]
    59:         end

sync(revision, destination)

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.

[Source]

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

sync(revision, destination)

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.

[Source]

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

[Validate]