From afe59d8076baa16749f2c07930f0718e2af4f15e Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Wed, 30 Jan 2008 05:39:59 +0000 Subject: [PATCH] Support p4sync_flags and p4client_root variables for Perforce SCM (closes #10384) git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@8751 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- CHANGELOG | 7 +++++++ lib/capistrano/recipes/deploy/scm/perforce.rb | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 103ed490..18ff94df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +*SVN* + +* Support p4sync_flags and p4client_root variables for Perforce [gseidman] + +* Prepare for Net::SSH v2 by making sure Capistrano only tries to load Net::SSH versions less than 1.99.0 [Jamis Buck] + + *2.1.0* October 14, 2007 * Default to 0664 instead of 0660 on upload [Jamis Buck] diff --git a/lib/capistrano/recipes/deploy/scm/perforce.rb b/lib/capistrano/recipes/deploy/scm/perforce.rb index 7112ca39..eb3fa11a 100644 --- a/lib/capistrano/recipes/deploy/scm/perforce.rb +++ b/lib/capistrano/recipes/deploy/scm/perforce.rb @@ -25,21 +25,21 @@ module Capistrano # destination directory. The perforce client has a fixed destination so # the files must be copied from there to their intended resting place. def checkout(revision, destination) - p4_sync(revision, destination, "-f") + p4_sync(revision, destination, p4sync_flags) 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. def sync(revision, destination) - p4_sync(revision, destination, "-f") + p4_sync(revision, destination, p4sync_flags) 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. def export(revision, destination) - p4_sync(revision, destination, "-f") + p4_sync(revision, destination, p4sync_flags) end # Returns the command that will do an "p4 diff2" for the two revisions. @@ -89,7 +89,6 @@ module Capistrano # a fixed destination so the files must be copied from there to their # intended resting place. def p4_sync(revision, destination, options="") - p4client_root = "`#{command} #{authentication} client -o | grep ^Root | cut -f2`" scm authentication, :sync, options, "#{rev_no(revision)}", "&& cp -rf #{p4client_root} #{destination}" end @@ -108,6 +107,14 @@ module Capistrano def p4passwd variable(:p4passwd) || variable(:scm_password) end + + def p4sync_flags + variable(:p4sync_flags) || "-f" + end + + def p4client_root + variable(:p4client_root) || "`#{command} #{authentication} client -o | grep ^Root | cut -f2`" + end def rev_no(revision) case revision.to_s