homebrew-core/Formula/mercurial.rb
2017-11-02 07:55:57 -07:00

62 lines
2.1 KiB
Ruby

# No head build supported; if you need head builds of Mercurial, do so outside
# of Homebrew.
class Mercurial < Formula
desc "Scalable distributed version control system"
homepage "https://mercurial-scm.org/"
url "https://mercurial-scm.org/release/mercurial-4.4.tar.gz"
sha256 "234af4a67565c85923b0a1910c704ab44bcf12f69b85532687208776563d87de"
bottle do
sha256 "775b2a408dc1445d6de11a86c46d666b2b792098e6467adc34e8c76030a842da" => :high_sierra
sha256 "85cb0107700f12b41982fa0b54e2fec3fa02a85629b101b690d92270828c5f10" => :sierra
sha256 "9a2506c12e15d0ed2ea9963a3580005e59752c0f986409b4407e0bd36a8647a7" => :el_capitan
end
option "with-custom-python", "Install against the python in PATH instead of Homebrew's python"
depends_on :python
def install
system "make", "PREFIX=#{prefix}", "install-bin"
# Install chg (see https://www.mercurial-scm.org/wiki/CHg)
cd "contrib/chg" do
system "make", "PREFIX=#{prefix}", "HGPATH=#{bin}/hg", \
"HG=#{bin}/hg"
bin.install "chg"
end
# Configure a nicer default pager
(buildpath/"hgrc").write <<~EOS
[pager]
pager = less -FRX
EOS
(etc/"mercurial").install "hgrc"
# Install man pages, which come pre-built in source releases
man1.install "doc/hg.1"
man5.install "doc/hgignore.5", "doc/hgrc.5"
# install the completion scripts
bash_completion.install "contrib/bash_completion" => "hg-completion.bash"
zsh_completion.install "contrib/zsh_completion" => "_hg"
end
def caveats
return unless (opt_bin/"hg").exist?
cacerts_configured = `#{opt_bin}/hg config web.cacerts`.strip
return if cacerts_configured.empty?
<<~EOS
Homebrew has detected that Mercurial is configured to use a certificate
bundle file as its trust store for TLS connections instead of using the
default OpenSSL store. If you have trouble connecting to remote
repositories, consider unsetting the `web.cacerts` property. You can
determine where the property is being set by running:
hg config --debug web.cacerts
EOS
end
test do
system "#{bin}/hg", "init"
end
end