Implements the Capistrano SCM interface for the Subversion revision control system (subversion.tigris.org).
Returns the command that will check out the given revision to the given destination.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 23 def checkout(revision, destination) scm :checkout, arguments, arguments(:checkout), verbose, authentication, "-r#{revision}", repository, destination end
Returns the command that will do an "svn diff" for the two revisions.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 40 def diff(from, to=nil) scm :diff, repository, arguments(:diff), authentication, "-r#{from}:#{to || head}" end
Returns the command that will do an "svn export" of the given revision to the given destination.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 35 def export(revision, destination) scm :export, arguments, arguments(:export), verbose, authentication, "-r#{revision}", repository, destination 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/subversion.rb, line 70 def handle_data(state, stream, text) host = state[:channel][:host] logger.info "[#{host} :: #{stream}] #{text}" case text when /\bpassword.*:/ # subversion is prompting for a password "#{scm_password_prompt}\n" when %{\(yes/no\)} # subversion is asking whether or not to connect "yes\n" when /passphrase/ # subversion is asking for the passphrase for the user's key "#{variable(:scm_passphrase)}\n" when /The entry \'(.+?)\' is no longer a directory/ raise Capistrano::Error, "subversion can't update because directory '#{$1}' was replaced. Please add it to svn:ignore." when /accept \(t\)emporarily/ # subversion is asking whether to accept the certificate "t\n" end end
Subversion understands 'HEAD' to refer to the latest revision in the repository.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 17 def head "HEAD" end
Returns an "svn log" command for the two revisions.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 45 def log(from, to=nil) scm :log, repository, arguments(:log), authentication, "-r#{from}:#{to || head}" end
Increments the given revision number and returns it.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 63 def next_revision(revision) revision.to_i + 1 end
Attempts to translate the given revision identifier to a "real" revision. If the identifier is an integer, it will simply be returned. Otherwise, this will yield a string of the commands it needs to be executed (svn info), and will extract the revision from the response.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 53 def query_revision(revision) return revision if revision =~ /^\d+$/ 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 [ (yaml['Last Changed Rev'] || 0).to_i, (yaml['Revision'] || 0).to_i ].max end
Returns the command that will do an "svn update" to the given revision, for the working copy at the given destination.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 29 def sync(revision, destination) scm :switch, arguments, verbose, authentication, "-r#{revision}", repository, destination end
Generated with the Darkfish Rdoc Generator 2.