Class: Vlad::Mercurial

Inherits:
Object
  • Object
show all
Defined in:
lib/vlad/mercurial.rb

Instance Method Summary collapse

Instance Method Details

#checkout(revision, destination) ⇒ Object

Returns the command that will check out revision from the code repo 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} #{code_repo}"
end

#export(revision_or_source, destination) ⇒ Object

Returns the command that will export revision from the code repo 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 #{code_repo} #{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 #{code_repo} | cut -f1 -d\\ `"
end