Class: Vlad::MercurialQueue
- Inherits:
-
Object
- Object
- Vlad::MercurialQueue
- Defined in:
- lib/vlad/mercurial_queue.rb
Instance Method Summary collapse
-
#checkout(revision, destination) ⇒ Object
Returns the command that will check out
revisionfrom the repository into directorydestination. -
#export(revision, destination) ⇒ Object
Returns the command that will export
revisionfrom the repository into the directorydestination. -
#revision(revision) ⇒ Object
Returns a command that maps human-friendly revision identifier
revisioninto 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 25 26 27 28 29 30 31 |
# File 'lib/vlad/mercurial_queue.rb', line 18 def checkout(revision, destination) commands = [] commands << "if [ ! -d .hg ]; then #{hg_cmd} clone -r null #{repository} .; fi" commands << "if [ ! -d .hg/patches/.hg ]; then " + "#{hg_cmd} clone -r null #{queue_repo} .hg/patches; fi" commands << "#{hg_cmd} --config extensions.mq= qpop -a" commands << "#{hg_cmd} pull #{repository}" commands << "#{hg_cmd} pull -R .hg/patches #{queue_repo}" commands << "#{hg_cmd} update #{revision}" commands << "#{hg_cmd} update -R .hg/patches #{queue_revision}" commands << "#{hg_cmd} --config extensions.mq= qpush -a" commands.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
38 39 40 41 42 43 44 45 |
# File 'lib/vlad/mercurial_queue.rb', line 38 def export(revision, destination) case deploy_via.to_sym when :checkout, :clone "#{hg_cmd} --config extensions.mq= clone #{scm_path} -r qtip #{destination}" else # :archive, :export (or whatever) "#{hg_cmd} --config extensions.mq= archive#{' -S' if hg_subrepos} -r qtip #{destination}" end end |
#revision(revision) ⇒ Object
Returns a command that maps human-friendly revision identifier revision
into a mercurial changeset ID.
51 52 53 |
# File 'lib/vlad/mercurial_queue.rb', line 51 def revision(revision) "`#{hg_cmd} identify -r #{revision} | cut -f1 -d\\ `" end |