Class: Capistrano::Deploy::SCM::Mercurial

### Home Classes Methods

### In Files

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

### Parent

Capistrano::Deploy::SCM::Base

### Methods

- #checkout
- #diff
- #export
- #handle_data
- #head
- #log
- #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::Mercurial

Implements the Capistrano SCM interface for the Mercurial revision control system (www.selenic.com/mercurial/). Latest updates at tackletechnology.org/oss/cap2-mercurial

### Public Instance Methods

checkout(changeset, destination) click to toggle source

Clone the repository and update to the specified changeset.

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 25
    def checkout(changeset, destination)
      clone(destination) + " && " + update(changeset, destination)
    end

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

Compute the difference between the two changesets `from` and `to` as a unified diff.

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 42
    def diff(from, to=nil)
      scm :diff,
          "--rev #{from}",
          (to ? "--rev #{to}" : nil)
    end

export(revision, destination) click to toggle source

One day we will have hg archive, although i think its not needed

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 35
    def export(revision, destination)
      raise NotImplementedError, "`diff' is not implemented by #{self.class.name}" +
      "use checkout strategy"
    end

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

Determine response for SCM prompts user/pass can come from ssh and http distribution methods yes/no is for when ssh asks you about fingerprints

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 69
    def handle_data(state, stream, text)
      host = state[:channel][:host]
      logger.info "[#{host} :: #{stream}] #{text}"
      case text
      when /^user:/i
        # support :scm_user for backwards compatibility of this module
        if user = variable(:scm_username) || variable(:scm_user)
          %("#{user}"\n)
        else
          raise "No variable :scm_username specified and Mercurial asked!\n" +
            "Prompt was: #{text}"
        end
      when /\bpassword:/i
        unless pass = scm_password_or_prompt
          # fall back on old behavior of erroring out with msg
          raise "No variable :scm_password specified and Mercurial asked!\n" +
            "Prompt was: #{text}"
        end
        %("#{pass}"\n)
      when /yes\/no/
        "yes\n"
      end
    end

head() click to toggle source

For mercurial HEAD == tip except that it bases this assumption on what tip is in the current repository (so push before you deploy)

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 20
    def head
      variable(:branch) || "tip"
    end

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

Return a log of all changes between the two specified changesets, `from` and `to`, inclusive or the log for `from` if `to` is omitted.

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 50
    def log(from, to=nil)
      scm :log,
          verbose,
          "--rev #{from}" +
          (to ? ":#{to}" : "")
    end

query_revision(changeset) click to toggle source

Translates a tag to a changeset if needed or just returns changeset.

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 58
    def query_revision(changeset)
      cmd = scm :log,
                verbose,
                "-r #{changeset}",
                '--template "{node|short}"'
                yield cmd
    end

sync(changeset, destination) click to toggle source

Pull from the repository and update to the specified changeset.

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 30
    def sync(changeset, destination)
      pull(destination) + " && " + update(changeset, destination)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.