homebrew-core/Formula/git-imerge.rb

74 lines
2.5 KiB
Ruby

class GitImerge < Formula
include Language::Python::Virtualenv
desc "Incremental merge for git"
homepage "https://github.com/mhagger/git-imerge"
url "https://files.pythonhosted.org/packages/be/f6/ea97fb920d7c3469e4817cfbf9202db98b4a4cdf71d8740e274af57d728c/git-imerge-1.2.0.tar.gz"
sha256 "df5818f40164b916eb089a004a47e5b8febae2b4471a827e3aaa4ebec3831a3f"
license "GPL-2.0-or-later"
head "https://github.com/mhagger/git-imerge.git"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "7ec4eb38347a00e2d2bcb20684dc0344ada62ad23ea5849ae2fcefbe39a7d98f"
sha256 cellar: :any_skip_relocation, big_sur: "7bc1515b735b68bc1e78e3fb97e7066cb68cba2736d26e4f473a6f79740e834b"
sha256 cellar: :any_skip_relocation, catalina: "da8daf9290c7b730c197112a095d02a22a74b0b0bc3ec191092c11033f85bd89"
sha256 cellar: :any_skip_relocation, mojave: "af808a99347117a8e6b90ab28874a5c27cfb010b1d8bda0c50fe3cce8b340159"
end
depends_on "python@3.9"
# PR ref, https://github.com/mhagger/git-imerge/pull/176
# remove in next release
patch :DATA
def install
virtualenv_install_with_resources
end
test do
system "git", "init"
system "git", "config", "user.name", "BrewTestBot"
system "git", "config", "user.email", "BrewTestBot@test.com"
(testpath/"test").write "foo"
system "git", "add", "test"
system "git", "commit", "-m", "Initial commit"
system "git", "checkout", "-b", "test"
(testpath/"test").append_lines "bar"
system "git", "commit", "-m", "Second commit", "test"
assert_equal "Already up-to-date.", shell_output("#{bin}/git-imerge merge master").strip
system "git", "checkout", "master"
(testpath/"bar").write "bar"
system "git", "add", "bar"
system "git", "commit", "-m", "commit bar"
system "git", "checkout", "test"
expected_output = <<~EOS
Attempting automerge of 1-1...success.
Autofilling 1-1...success.
Recording autofilled block MergeState('master', tip1='test', tip2='master', goal='merge')[0:2,0:2].
Merge is complete!
EOS
assert_match expected_output, shell_output("#{bin}/git-imerge merge master 2>&1")
end
end
__END__
$ git diff
diff --git a/setup.py b/setup.py
index 3ee0551..27a03a6 100644
--- a/setup.py
+++ b/setup.py
@@ -14,6 +14,9 @@ try:
except OSError as e:
if e.errno != errno.ENOENT:
raise
+except subprocess.CalledProcessError:
+ # `bash-completion` is probably not installed. Just skip it.
+ pass
else:
completionsdir = completionsdir.strip().decode('utf-8')
if completionsdir: