Class: MercurialDownloadStrategy

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

Overview

Strategy for downloading a Mercurial repository.

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, #quiet?, #shutup!, #stage

Methods included from Context

current, current=, #debug?, #quiet?, #verbose?, #with_context

Constructor Details

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

Returns a new instance of MercurialDownloadStrategy.


1025
1026
1027
1028
# File 'Library/Homebrew/download_strategy.rb', line 1025

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

Instance Method Details

#last_commitObject


1039
1040
1041
1042
# File 'Library/Homebrew/download_strategy.rb', line 1039

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

#source_modified_timeObject

Returns the most recent modified time for all files in the current working directory after stage.


1031
1032
1033
1034
1035
1036
# File 'Library/Homebrew/download_strategy.rb', line 1031

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

  Time.parse(out)
end