Files

Class/Module Index [+]

Quicksearch

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.