# 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://www.mercurial-scm.org/release/mercurial-5.5.tar.gz" sha256 "c1ed28e1534304a7a4981ed59905286d1c56acd5b75755eedd184171a4a782b4" license "GPL-2.0" livecheck do url "https://www.mercurial-scm.org/release/" regex(/href=.*?mercurial[._-]v?(\d+(?:\.\d+)+)\.t/i) end bottle do sha256 "99cd39e3f4bd9bbfc94b191d4c73276da4e174f0bd4043de96737c2b91c1bfe8" => :catalina sha256 "a0e0763833b37b8731e2555c99c7a96825df7ab2c978f912b4bb17b87d0f8bcd" => :mojave sha256 "5477a3357f4e2345d626cb5dfe5f090f3765d24100aec70af9c958c5fd6338c0" => :high_sierra end depends_on "python@3.8" def install ENV["HGPYTHON3"] = "1" system "make", "PREFIX=#{prefix}", "PYTHON=python3", "install-bin" # Install chg (see https://www.mercurial-scm.org/wiki/CHg) cd "contrib/chg" do system "make", "PREFIX=#{prefix}", "PYTHON=python3", "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