Permalink
Browse files

Merge pull request #80 from alextk/master

Provide separate arguments per `scm` command.
  • Loading branch information...
2 parents ea74ea4 + 7915bfc commit fa991439e5911a73451da65ddfc4ad05298f6844 @leehambley leehambley committed Sep 20, 2011
Showing with 12 additions and 8 deletions.
  1. +6 −2 lib/capistrano/recipes/deploy/scm/base.rb
  2. +6 −6 lib/capistrano/recipes/deploy/scm/subversion.rb
View
8 lib/capistrano/recipes/deploy/scm/base.rb
@@ -186,8 +186,12 @@ def repository
variable(:repository)
end
- def arguments
- variable(:scm_arguments)
+ def arguments(command = :all)
+ value = variable(:scm_arguments)
+ if value.is_a?(Hash)
+ value = value[command]
+ end
+ value
end
end
View
12 lib/capistrano/recipes/deploy/scm/subversion.rb
@@ -21,29 +21,29 @@ def head
# Returns the command that will check out the given revision to the
# given destination.
def checkout(revision, destination)
- scm :checkout, arguments, verbose, authentication, "-r#{revision}", repository, destination
+ scm :checkout, arguments, arguments(:checkout), 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.
def sync(revision, destination)
- scm :update, arguments, verbose, authentication, "-r#{revision}", destination
+ scm :update, arguments, arguments(:update), verbose, authentication, "-r#{revision}", destination
end
# Returns the command that will do an "svn export" of the given revision
# to the given destination.
def export(revision, destination)
- scm :export, arguments, verbose, authentication, "-r#{revision}", repository, destination
+ scm :export, arguments, arguments(:export), verbose, authentication, "-r#{revision}", repository, destination
end
# Returns the command that will do an "svn diff" for the two revisions.
def diff(from, to=nil)
- scm :diff, repository, authentication, "-r#{from}:#{to || head}"
+ scm :diff, repository, arguments(:diff), authentication, "-r#{from}:#{to || head}"
end
# Returns an "svn log" command for the two revisions.
def log(from, to=nil)
- scm :log, repository, authentication, "-r#{from}:#{to || head}"
+ scm :log, repository, arguments(:log), authentication, "-r#{from}:#{to || head}"
end
# Attempts to translate the given revision identifier to a "real"
@@ -52,7 +52,7 @@ def log(from, to=nil)
# executed (svn info), and will extract the revision from the response.
def query_revision(revision)
return revision if revision =~ /^\d+$/
- command = scm(:info, arguments, repository, authentication, "-r#{revision}")
+ command = scm(:info, arguments, arguments(:info), repository, authentication, "-r#{revision}")
result = yield(command)
yaml = YAML.load(result)
raise "tried to run `#{command}' and got unexpected result #{result.inspect}" unless Hash === yaml

0 comments on commit fa99143

Please sign in to comment.