Class: MercurialDownloadStrategy

Inherits:
VCSDownloadStrategy show all
Defined in:
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 VCSDownloadStrategy

#cached_location

Attributes inherited from AbstractDownloadStrategy

#cache, #url

Instance Method Summary collapse

Methods inherited from VCSDownloadStrategy

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

Methods inherited from AbstractDownloadStrategy

#basename, #cached_location, #clear_cache, #fetch, #quiet!, #quiet?, #stage

Methods included from SystemCommand::Mixin

#system_command, #system_command!

Methods included from Context

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

Constructor Details

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

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:



1379
1380
1381
1382
# File 'download_strategy.rb', line 1379

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

Instance Method Details

#last_commitString

Return last commit's unique identifier for the repository.

Returns:



1396
1397
1398
# File 'download_strategy.rb', line 1396

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

#source_modified_timeTime

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

Returns:



1388
1389
1390
# File 'download_strategy.rb', line 1388

def source_modified_time
  Time.parse(silent_command("hg", args: ["tip", "--template", "{date|isodate}", "-R", cached_location]).stdout)
end