homebrew-core/Formula/mercurial.rb
2018-05-15 07:33:49 -07:00

63 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.6.tar.gz"
sha256 "56ae3b10201adae37ad97fbd759cf3cea4ebe64c57641c059978c7a706ee6b49"
bottle do
sha256 "6b68e483623baa387be5392b5b002f6502692ab88ee50ad4d6196e4cd0f8ca1c" => :high_sierra
sha256 "8bb05d716ba5785eb22e0334433f9833f293edb3902255d45e6c6143640e5c8e" => :sierra
sha256 "f97343bd9269d0da22ebf22dbadacff52ac6b673183f3cdaf725c746654ab4f4" => :el_capitan
end
depends_on "python@2"
def install
ENV.prepend_path "PATH", Formula["python@2"].opt_libexec/"bin"
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