class Vlad::Mercurial

Constants

VERSION

Public Instance Methods

checkout(revision, destination) click to toggle source

Returns the command that will check out revision from the repository into directory destination. revision can be any changeset ID or equivalent (e.g. branch, tag, etc…)

# File lib/vlad/mercurial.rb, line 18
def checkout(revision, destination)
  # These all get executed after a "cd #{scm_path}"
  [ "if [ ! -d .hg ]; then #{hg_cmd} clone -r null #{repository} .; fi",
    "#{hg_cmd} pull #{repository}",
    "#{hg_cmd} update #{revision}"
  ].join(' && ')
end
export(revision, destination) click to toggle source

Returns the command that will export revision from the repository into the directory destination. Expects to be run from scm_path after #checkout

# File lib/vlad/mercurial.rb, line 31
def export(revision, destination)
  case deploy_via.to_sym
  when :checkout, :clone
    "#{hg_cmd} clone #{scm_path} -r #{revision} #{destination}"
  else # :archive, :export (or whatever)
    "#{hg_cmd} archive#{' -S' if hg_subrepos} -r #{revision} #{destination}"
  end
end
revision(revision) click to toggle source

Returns a command that maps human-friendly revision identifier revision into a mercurial changeset ID.

# File lib/vlad/mercurial.rb, line 44
def revision(revision)
  "`#{hg_cmd} identify -r #{revision} | cut -f1 -d\\ `"
end