Class: MercurialDownloadStrategy

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

Constant Summary

Constants inherited from VCSDownloadStrategy

VCSDownloadStrategy::REF_TYPES

Instance Attribute Summary

Attributes inherited from AbstractDownloadStrategy

#cache, #cached_location, #url

Instance Method Summary collapse

Methods inherited from VCSDownloadStrategy

#commit_outdated?, #fetch, #fetch_last_commit, #head?

Methods inherited from AbstractDownloadStrategy

#basename, #clear_cache, #fetch, #ohai, #puts, #shutup!, #stage

Constructor Details

#initialize(url, name, version, **meta) ⇒ MercurialDownloadStrategy

Returns a new instance of MercurialDownloadStrategy



924
925
926
927
# File 'brew/Library/Homebrew/download_strategy.rb', line 924

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

Instance Method Details

#last_commitObject



936
937
938
939
# File 'brew/Library/Homebrew/download_strategy.rb', line 936

def last_commit
  out, = system_command("hg", args: ["parent", "--template", "{node|short}", "-R", cached_location])
  out.chomp
end

#source_modified_timeObject



929
930
931
932
933
934
# File 'brew/Library/Homebrew/download_strategy.rb', line 929

def source_modified_time
  out, = system_command("hg",
                        args: ["tip", "--template", "{date|isodate}", "-R", cached_location])

  Time.parse(out)
end