Permalink
Browse files

Delete the remote review branch after it is merged

Signed-off-by: Ryan Burrows <rhburrows@gmail.com>
  • Loading branch information...
1 parent 22b9cc7 commit 75618612413e860b854eb0e8442f809a55ad1030 @rhburrows committed Apr 28, 2010
@@ -30,3 +30,9 @@ Feature: Code Reviewer accepts changes
And I am on branch "master"
When I run "reviewr accept review_12345678"
Then reviewr should push "master" to origin
+
+ Scenario: Reviewr deletes the code review branch
+ Given remote branch "review_12345678" will apply cleanly
+ And I am on branch "master"
+ When I run "reviewr accept review_12345678"
+ Then reviewr should delete origin branch "review_12345678"
@@ -27,6 +27,10 @@
git_executed?("git cherry-pick #{commit}").should be_true
end
+Then /^reviewr should delete origin branch "([^\"]*)"$/ do |branch|
+ git_executed?("git push origin :#{branch}").should be_true
+end
+
def git_executed?(cmd)
Reviewr::Git.instance.commands.include?(cmd)
end
@@ -16,6 +16,7 @@ def execute
project.change_branch(merge_branch)
project.merge_commits
project.push_branch(merge_branch)
+ project.delete_remote_review_branch
end
end
end
View
@@ -64,5 +64,9 @@ def merge_commits
git.cherry_pick(line.split(/\s/)[1])
end
end
+
+ def delete_remote_review_branch
+ git.push_branch(":#{review_branch}")
+ end
end
end
@@ -66,6 +66,11 @@ module CLI
project.should_receive(:push_branch).with("current")
accept.call
end
+
+ it "deletes the reviewed branch from the remote" do
+ project.should_receive(:delete_remote_review_branch)
+ accept.call
+ end
end
end
end
@@ -111,5 +111,13 @@ module Reviewr
project.merge_commits
end
end
+
+ describe "#delete_remote_review_branch" do
+ it "pushes nothing over the remote review branch" do
+ git.should_receive(:push_branch).with(':branch_name')
+ project.stub(:review_branch).and_return('branch_name')
+ project.delete_remote_review_branch
+ end
+ end
end
end

0 comments on commit 7561861

Please sign in to comment.