Method: CodeCache::Repo::Git#checkout

Defined in:
lib/code_cache/repo/git.rb

#checkout(revision, destination, branch = nil) ⇒ Object

Checkout a particular revision from the repo into the destination Caches the checkout in the process



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/code_cache/repo/git.rb', line 26

def checkout( revision, destination , branch=nil)
  
  raise "Checking out anything other than the head of the default branch not supported" if revision != :head
  raise "Not checking out, as #{destination} directory has another git repository" if !Dir["#{destination}/.git"].empty?
  
  cache_destination = location_in_cache()
  
  # Try and copy into the cache first
  clone_or_update_repo_in_cache(cache_destination)
  
  puts "Cache: #{cache_destination}"
  puts "Destination: #{destination}"
  output = checkout_from_cache_to_destination(cache_destination, destination, revision, branch)

  true
end