Class: Capistrano::Deploy::SCM::Subversion

### Home Classes Methods

### In Files

- lib/capistrano/recipes/deploy/scm/subversion.rb

### Parent

Capistrano::Deploy::SCM::Base

### Methods

- #checkout
- #diff
- #export
- #handle_data
- #head
- #log
- #next_revision
- #query_revision
- #sync

### Files

- help.txt

### Class/Module Index

Quicksearch

- Capistrano
- Capistrano::CLI
- Capistrano::CLI::Execute
- Capistrano::CLI::Execute::ClassMethods
- Capistrano::CLI::Help
- Capistrano::CLI::Options
- Capistrano::CLI::Options::ClassMethods
- Capistrano::CLI::UI
- Capistrano::CLI::UI::ClassMethods
- Capistrano::Callback
- Capistrano::Command
- Capistrano::Command::Tree
- Capistrano::Command::Tree::Branch
- Capistrano::Command::Tree::ConditionBranch
- Capistrano::Command::Tree::ConditionBranch::Evaluator
- Capistrano::Command::Tree::ElseBranch
- Capistrano::Configuration
- Capistrano::Configuration::Actions
- Capistrano::Configuration::Actions::FileTransfer
- Capistrano::Configuration::Actions::Inspect
- Capistrano::Configuration::Actions::Invocation
- Capistrano::Configuration::Actions::Invocation::ClassMethods
- Capistrano::Configuration::AliasTask
- Capistrano::Configuration::Callbacks
- Capistrano::Configuration::Connections
- Capistrano::Configuration::Execution
- Capistrano::Configuration::Loading
- Capistrano::Configuration::Loading::ClassMethods
- Capistrano::Configuration::LogFormatters
- Capistrano::Configuration::Namespaces
- Capistrano::Configuration::Namespaces::Namespace
- Capistrano::Configuration::Roles
- Capistrano::Configuration::Servers
- Capistrano::Configuration::Variables
- Capistrano::Deploy
- Capistrano::Deploy::Dependencies
- Capistrano::Deploy::LocalDependency
- Capistrano::Deploy::RemoteDependency
- Capistrano::Deploy::SCM
- Capistrano::Deploy::SCM::Accurev
- Capistrano::Deploy::SCM::Accurev::InternalRevision
- Capistrano::Deploy::SCM::Base
- Capistrano::Deploy::SCM::Base::LocalProxy
- Capistrano::Deploy::SCM::Bzr
- Capistrano::Deploy::SCM::Cvs
- Capistrano::Deploy::SCM::Darcs
- Capistrano::Deploy::SCM::Git
- Capistrano::Deploy::SCM::Mercurial
- Capistrano::Deploy::SCM::None
- Capistrano::Deploy::SCM::Perforce
- Capistrano::Deploy::SCM::Subversion
- Capistrano::Deploy::Strategy
- Capistrano::Deploy::Strategy::Base
- Capistrano::Deploy::Strategy::Checkout
- Capistrano::Deploy::Strategy::Copy
- Capistrano::Deploy::Strategy::Export
- Capistrano::Deploy::Strategy::Remote
- Capistrano::Deploy::Strategy::RemoteCache
- Capistrano::Deploy::Strategy::UnsharedRemoteCache
- Capistrano::ProcCallback
- Capistrano::Processable
- Capistrano::Processable::SessionAssociation
- Capistrano::RemoteError
- Capistrano::Role
- Capistrano::Role::DynamicServerList
- Capistrano::SSH
- Capistrano::ServerDefinition
- Capistrano::Shell
- Capistrano::TaskCallback
- Capistrano::TaskDefinition
- Capistrano::Transfer
- Capistrano::Transfer::SFTPTransferWrapper
- Capistrano::Version
- Kernel
- Object
- String

No matching classes.

# Capistrano::Deploy::SCM::Subversion

Implements the Capistrano SCM interface for the Subversion revision control system (subversion.tigris.org).

### Public Instance Methods

checkout(revision, destination) click to toggle source

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

diff(from, to=nil) click to toggle source

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

export(revision, destination) click to toggle source

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

handle_data(state, stream, text) click to toggle source

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

head() click to toggle source

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

log(from, to=nil) click to toggle source

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

next_revision(revision) click to toggle source

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

query_revision(revision) click to toggle source

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

sync(revision, destination) click to toggle source

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.