From b96507cbf66643495fe5b042c90a58d16ab1b315 Mon Sep 17 00:00:00 2001 From: Lee Hambley Date: Mon, 2 Nov 2009 23:41:47 +0100 Subject: [PATCH] Merging out some changes we applied here, which were already merged into Net:SSH --- CHANGELOG.rdoc | 6 --- lib/capistrano/recipes/deploy/scm/darcs.rb | 13 +------ .../recipes/deploy/strategy/copy.rb | 7 +--- test/deploy/scm/darcs_test.rb | 37 ------------------- 4 files changed, 2 insertions(+), 61 deletions(-) delete mode 100644 test/deploy/scm/darcs_test.rb diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index cab61573..f4a17949 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -1,9 +1,3 @@ -== 2.5.10 / 25 October 2009 - -* Fixes Darcs remote repository problem when using the copy strategy [Alex `regularfry` Young] -* Allows the specification of :copy_via for use by the copy strategy [Emily `duien` Price] -* Documentation improvements for embedding Capistrano [Lee Hambley] - == 2.5.9 / 1 August 2009 * Adds support for customizing which `tar` command to use. [Jeremy Wells] diff --git a/lib/capistrano/recipes/deploy/scm/darcs.rb b/lib/capistrano/recipes/deploy/scm/darcs.rb index 5126f654..de194a36 100644 --- a/lib/capistrano/recipes/deploy/scm/darcs.rb +++ b/lib/capistrano/recipes/deploy/scm/darcs.rb @@ -18,22 +18,11 @@ module Capistrano :head end - def to_match(revision) - if revision.nil? || revision == self.head - nil - else - "--to-match='hash #{revision}'" - end - end - # Returns the command that will check out the given revision to the # given destination. The 'revision' parameter must be the 'hash' value # for the revision in question, as given by 'darcs changes --xml-output'. def checkout(revision, destination) - scm :get, *[verbose, - "--repo-name=#{destination}", - to_match(revision), - repository].compact + scm :get, verbose, "--repo-name=#{destination}", "--to-match='hash #{revision}'", repository end # Tries to update the destination repository in-place, to bring it up diff --git a/lib/capistrano/recipes/deploy/strategy/copy.rb b/lib/capistrano/recipes/deploy/strategy/copy.rb index 1f865367..b4e73528 100644 --- a/lib/capistrano/recipes/deploy/strategy/copy.rb +++ b/lib/capistrano/recipes/deploy/strategy/copy.rb @@ -38,10 +38,6 @@ module Capistrano # :copy_compression, which must be one of :gzip, :bz2, or # :zip, and which specifies how the source should be compressed for # transmission to each host. - # - # It also supports the variable :copy_via, which must be one of :sftp or - # :scp, and which specifies the method used to transfer the compressed - # code to the remote server. It defaults to :sftp. class Copy < Base # Obtains a copy of the source code locally (via the #command method), # compresses it to a single file, copies that file to all target @@ -100,8 +96,7 @@ module Capistrano logger.trace "compressing #{destination} to #{filename}" Dir.chdir(tmpdir) { system(compress(File.basename(destination), File.basename(filename)).join(" ")) } - upload(filename, remote_filename, {:via => configuration[:copy_via]}) - # FIXED Allow specifying transfer mode + upload(filename, remote_filename) run "cd #{configuration[:releases_path]} && #{decompress(remote_filename).join(" ")} && rm #{remote_filename}" ensure FileUtils.rm filename rescue nil diff --git a/test/deploy/scm/darcs_test.rb b/test/deploy/scm/darcs_test.rb deleted file mode 100644 index db4ac122..00000000 --- a/test/deploy/scm/darcs_test.rb +++ /dev/null @@ -1,37 +0,0 @@ -require "utils" -require 'capistrano/recipes/deploy/scm/darcs' - -class DeploySCMDarcsTest < Test::Unit::TestCase - class TestSCM < Capistrano::Deploy::SCM::Darcs - default_command "darcs" - end - def setup - @config = { :repository => "." } - # def @config.exists?(name); key?(name); end - - @source = TestSCM.new(@config) - end - - # We should be able to pick a specific hash. - def test_checkout_hash - hsh = "*version_hash*" - assert_match(%r{--to-match=.hash #{Regexp.quote(hsh)}}, - @source.checkout(hsh, "*foo_location*"), - "Specifying a revision hash got the --to-match option wrong.") - end - - # Picking the head revision should leave out the hash, because head is the - # default and we don't have a HEAD pseudotag - def test_checkout_head - hsh = @source.head - assert_no_match(%r{--to-match}, @source.checkout(hsh, "*foo_location*"), - "Selecting the head revision incorrectly produced a --to-match option.") - end - - # Leaving the revision as nil shouldn't break anything. - def test_checkout_nil - assert_no_match(%r{--to-match}, @source.checkout(nil, "*foo_location*"), - "Leaving the revision as nil incorrectly produced a --to-match option.") - end -end -