forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbzr-rewrite.rb
59 lines (47 loc) · 1.64 KB
/
bzr-rewrite.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class BzrRewrite < Formula
desc "Bazaar plugin to support rewriting revisions and rebasing"
homepage "https://launchpad.net/bzr-rewrite"
url "https://launchpad.net/bzr-rewrite/trunk/0.6.3/+download/bzr-rewrite-0.6.3.tar.gz"
sha256 "f4d0032a41a549a0bc3ac4248cd4599da859174ea33e56befcb095dd2c930794"
bottle :unneeded
depends_on "bazaar"
def install
(share/"bazaar/plugins/rewrite").install Dir["*"]
end
test do
file_path1 = testpath/"foo/trunk/file1.txt"
file_path2 = testpath/"foo/b1/file2.txt"
system "bzr", "whoami", "Homebrew"
system "bzr", "init-repo", "foo"
cd "foo" do
system "bzr", "init", "trunk"
cd "trunk" do
file_path1.write "change"
system "bzr", "add"
system "bzr", "commit", "-m", "trunk 1"
end
system "bzr", "branch", "trunk", "b1"
cd "b1" do
file_path2.write "change"
system "bzr", "add"
system "bzr", "commit", "-m", "branch 1"
file_path2.append_lines "change"
system "bzr", "commit", "-m", "branch 2"
end
cd "trunk" do
file_path1.append_lines "change"
system "bzr", "commit", "-m", "trunk 2"
file_path1.append_lines "change"
system "bzr", "commit", "-m", "trunk 3"
end
cd "b1" do
system "bzr", "rebase", "../trunk"
assert_match(/branch 2/, shell_output("bzr log -r5"))
assert_match(/branch 1/, shell_output("bzr log -r4"))
assert_match(/trunk 3/, shell_output("bzr log -r3"))
assert_match(/trunk 2/, shell_output("bzr log -r2"))
assert_match(/trunk 1/, shell_output("bzr log -r1"))
end
end
end
end