Class: Vlad::Mercurial
- Inherits:
-
Object
- Object
- Vlad::Mercurial
- Defined in:
- lib/vlad/mercurial.rb
Instance Method Summary collapse
-
#checkout(revision, destination) ⇒ Object
Returns the command that will check out
revision
from the repository into directorydestination
. -
#export(revision_or_source, 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 subversion revision specification.
Instance Method Details
#checkout(revision, destination) ⇒ Object
Returns the command that will check out revision
from the repository into directory destination
9 10 11 12 |
# File 'lib/vlad/mercurial.rb', line 9 def checkout(revision, destination) revision = 'tip' if revision =~ /^head$/i "hg pull -r #{revision} -R #{destination} #{repository}" end |
#export(revision_or_source, destination) ⇒ Object
Returns the command that will export revision
from the repository into the directory destination
.
18 19 20 21 22 23 24 25 |
# File 'lib/vlad/mercurial.rb', line 18 def export(revision_or_source, destination) revision_or_source = 'tip' if revision_or_source =~ /^head$/i if revision_or_source =~ /^(\d+|tip)$/i then "hg archive -r #{revision_or_source} -R #{repository} #{destination}" else "hg archive -R #{revision_or_source} #{destination}" end end |
#revision(revision) ⇒ Object
Returns a command that maps human-friendly revision identifier revision
into a subversion revision specification.
31 32 33 |
# File 'lib/vlad/mercurial.rb', line 31 def revision(revision) "`hg identify -R #{repository} | cut -f1 -d\\ `" end |