Class: Capistrano::Deploy::SCM::Darcs

### Home Classes Methods

### In Files

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

### Parent

Capistrano::Deploy::SCM::Base

### Methods

- #checkout
- #diff
- #export
- #head
- #log
- #query_revision
- #sync
- #to_match

### 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::Darcs

Implements the Capistrano SCM interface for the darcs revision control system (www.abridgegame.org/darcs/).

### Public Instance Methods

checkout(revision, destination) click to toggle source

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'.

    # File lib/capistrano/recipes/deploy/scm/darcs.rb, line 32
    def checkout(revision, destination)
      scm :get, *[verbose,
                  "--repo-name=#{destination}",
                  to_match(revision),
                  repository].compact
    end

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

Returns the command that will do a "darcs diff" for the two revisions. Each revision must be the 'hash' identifier of a darcs revision.

    # File lib/capistrano/recipes/deploy/scm/darcs.rb, line 57
    def diff(from, to=nil)
      scm :diff, "--from-match 'hash #{from}'", to && "--to-match 'hash #{to}'"
    end

export(revision, destination) click to toggle source

Darcs does not have a real 'export' option; there is 'darcs dist', but that presupposes a utility that can untar and ungzip the dist file. We'll cheat and just do a get, followed by a deletion of the _darcs metadata directory.

    # File lib/capistrano/recipes/deploy/scm/darcs.rb, line 51
    def export(revision, destination)
      [checkout(revision, destination), "rm -rf #{destination}/_darcs"].join(" && ")
    end

head() click to toggle source

Because darcs does not have any support for pseudo-ids, we'll just return something here that we can use in the helpers below for determining whether we need to look up the latest revision.

    # File lib/capistrano/recipes/deploy/scm/darcs.rb, line 17
    def head
      :head
    end

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

Returns the log of changes between the two revisions. Each revision must be the 'hash' identifier of a darcs revision.

    # File lib/capistrano/recipes/deploy/scm/darcs.rb, line 63
    def log(from, to=nil)
      scm :changes, "--from-match 'hash #{from}'", to && "--to-match 'hash #{to}'", "--repo=#{repository}"
    end

query_revision(revision) click to toggle source

Attempts to translate the given revision identifier to a "real" revision. If the identifier is a symbol, it is assumed to be a pseudo-id. Otherwise, it will be immediately returned. If it is a pseudo-id, a set of commands to execute will be yielded, and the result of executing those commands must be returned by the block. This method will then extract the actual revision hash from the returned data.

    # File lib/capistrano/recipes/deploy/scm/darcs.rb, line 74
    def query_revision(revision)
      case revision
      when :head
        xml = yield(scm(:changes, "--last 1", "--xml-output", "--repo=#{repository}"))
        return xml[/hash='(.*?)'/, 1]
      else return revision
      end
    end

sync(revision, destination) click to toggle source

Tries to update the destination repository in-place, to bring it up to the given revision. Note that because darcs' "pull" operation does not support a "to-match" argument (or similar), this basically nukes the destination directory and re-gets it.

    # File lib/capistrano/recipes/deploy/scm/darcs.rb, line 43
    def sync(revision, destination)
      ["rm -rf #{destination}", checkout(revision, destination)].join(" && ")
    end

to_match(revision) click to toggle source

    # File lib/capistrano/recipes/deploy/scm/darcs.rb, line 21
    def to_match(revision)
      if revision.nil? || revision == self.head
        nil
      else
        "--to-match='hash #{revision}'"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.