Base
Implements the Capistrano SCM interface for the Perforce revision control system (www.perforce.com).
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
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
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
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
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
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
# 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
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
Generated with the Darkfish Rdoc Generator 2.