Class: Vlad::Mercurial
- Inherits:
-
Object
- Object
- Vlad::Mercurial
- Defined in:
- lib/vlad/mercurial.rb
Constant Summary collapse
- VERSION =
'2.2.4'.freeze
Instance Method Summary collapse
-
#checkout(revision, destination) ⇒ Object
Returns the command that will check out
revision
from the repository into directorydestination
. -
#export(revision, destination) ⇒ Object
Returns the command that will export
revision
from the repository into the directorydestination
. -
#revision(revision) ⇒ Object
Returns a command that maps human-friendly revision identifier
revision
into a mercurial changeset ID.
Instance Method Details
#checkout(revision, destination) ⇒ Object
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…)
18 19 20 21 22 23 24 |
# 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) ⇒ Object
Returns the command that will export revision
from the repository into the directory destination
. Expects to be run from scm_path
after Vlad::Mercurial#checkout
31 32 33 34 35 36 37 38 |
# 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) ⇒ Object
Returns a command that maps human-friendly revision identifier revision
into a mercurial changeset ID.
44 45 46 |
# File 'lib/vlad/mercurial.rb', line 44 def revision(revision) "`#{hg_cmd} identify -r #{revision} | cut -f1 -d\\ `" end |