Class: MercurialDownloadStrategy

Inherits:
VCSDownloadStrategy show all
Defined in:
Library/Homebrew/download_strategy.rb

Constant Summary

Constants inherited from VCSDownloadStrategy

VCSDownloadStrategy::REF_TYPES

Instance Attribute Summary

Attributes inherited from AbstractDownloadStrategy

#cached_location, #meta, #name, #resource, #shutup, #version

Instance Method Summary collapse

Methods inherited from VCSDownloadStrategy

#cached_location, #commit_outdated?, #fetch, #fetch_last_commit

Methods inherited from AbstractDownloadStrategy

#clear_cache, #expand_safe_system_args, #fetch, #ohai, #puts, #quiet_safe_system, #safe_system, #shutup!

Methods included from FileUtils

#make, mkdir, mktemp, #old_mkdir, #old_ruby, #ruby, #scons, #xcodebuild

Constructor Details

#initialize(name, resource) ⇒ MercurialDownloadStrategy

Returns a new instance of MercurialDownloadStrategy



988
989
990
991
# File 'Library/Homebrew/download_strategy.rb', line 988

def initialize(name, resource)
  super
  @url = @url.sub(%r{^hg://}, "")
end

Instance Method Details

#last_commitObject



1011
1012
1013
# File 'Library/Homebrew/download_strategy.rb', line 1011

def last_commit
  Utils.popen_read(hgpath, "parent", "--template", "{node|short}", "-R", cached_location.to_s)
end

#source_modified_timeObject



1007
1008
1009
# File 'Library/Homebrew/download_strategy.rb', line 1007

def source_modified_time
  Time.parse Utils.popen_read(hgpath, "tip", "--template", "{date|isodate}", "-R", cached_location.to_s)
end

#stageObject



993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
# File 'Library/Homebrew/download_strategy.rb', line 993

def stage
  super

  dst = Dir.getwd
  cached_location.cd do
    if @ref_type && @ref
      ohai "Checking out #{@ref_type} #{@ref}" if @ref_type && @ref
      safe_system hgpath, "archive", "--subrepos", "-y", "-r", @ref, "-t", "files", dst
    else
      safe_system hgpath, "archive", "--subrepos", "-y", "-t", "files", dst
    end
  end
end