Created
July 23, 2011 09:24
-
-
Save iGEL/1101225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e8c5bc23295e6a5ead501a74e73ac4cca507d3d8 Mon Sep 17 00:00:00 2001 | |
From: Johannes Barre <igel@igels.net> | |
Date: Sat, 23 Jul 2011 11:03:23 +0200 | |
Subject: [PATCH] Use svn switch instead of svn update | |
--- | |
lib/capistrano/recipes/deploy/scm/subversion.rb | 8 +++++--- | |
test/deploy/scm/subversion_test.rb | 7 +++++++ | |
2 files changed, 12 insertions(+), 3 deletions(-) | |
diff --git a/lib/capistrano/recipes/deploy/scm/subversion.rb b/lib/capistrano/recipes/deploy/scm/subversion.rb | |
index c92a135..ef06efb 100644 | |
--- a/lib/capistrano/recipes/deploy/scm/subversion.rb | |
+++ b/lib/capistrano/recipes/deploy/scm/subversion.rb | |
@@ -24,10 +24,12 @@ module Capistrano | |
scm :checkout, arguments, verbose, authentication, "-r#{revision}", repository, destination | |
end | |
- # Returns the command that will do an "svn update" to the given | |
- # revision, for the working copy at the given destination. | |
+ # Returns the command that will do an "svn switch" to the given | |
+ # revision, for the working copy at the given destination. "svn switch" | |
+ # has the same effect as "svn update", but can change the path inside of | |
+ # a repository (e.g. trunk, branches). That's important for cached_copies. | |
def sync(revision, destination) | |
- scm :update, arguments, verbose, authentication, "-r#{revision}", destination | |
+ scm :switch, arguments, verbose, authentication, "-r#{revision}", repository, destination | |
end | |
# Returns the command that will do an "svn export" of the given revision | |
diff --git a/test/deploy/scm/subversion_test.rb b/test/deploy/scm/subversion_test.rb | |
index 26d1047..f4f1c5c 100644 | |
--- a/test/deploy/scm/subversion_test.rb | |
+++ b/test/deploy/scm/subversion_test.rb | |
@@ -29,4 +29,11 @@ Last Changed Date: 2009-03-11 11:04:25 -0700 (Wed, 11 Mar 2009) | |
end | |
assert_equal 2095, revision | |
end | |
+ | |
+ def test_sync | |
+ @config[:repository] = "http://svn.github.com/capistrano/capistrano.git" | |
+ rev = '602' | |
+ dest = "/var/www" | |
+ assert_equal "svn switch -q -r602 http://svn.github.com/capistrano/capistrano.git /var/www", @source.sync(rev, dest) | |
+ end | |
end | |
-- | |
1.7.4.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment