lib/dev_flow/commands/close.rb in dev_flow-0.2.4 vs lib/dev_flow/commands/close.rb in dev_flow-0.3.0
- old
+ new
@@ -7,10 +7,11 @@
error "Only leader (#{leader_name.bold}) can close a branch." unless i_am_leader?
# whether I am working on a proper task branch
current_task = self.task
error "Not on a known task branch. Can not continue." unless current_task
+ error "Can not close task offline" unless sync?
if current_task and (in_release? or current_task.branch_name =~ /^hotfix\_/)
error "Use command 'release' to close a release/hotfix branch." unless @config[:release]
else
error "Use command 'close' to close a non-release branch." if @config[:release]
@@ -19,24 +20,22 @@
if in_release? and @config[:release]
error "You should use release only on branches just completed." unless current_task and current_task.progress == 99
end
- self.ask_rebase true # force rebase
+ self.ask_rebase # force rebase
puts hr
# commit you current branch and push
progress = 100
message = ARGV[2] || "close the branch by set progress to 100."
message = "[close] " + message
info "commit progress"
`git commit -am '#{message}'`
- if @config["git_remote"]
- info "push your progress to remote server"
- `git push #{@config["git_remote"]} #{current_task.branch_name}`
- end
+ info "push your progress to remote server"
+ `git push #{@config["git_remote"]} #{current_task.branch_name}`
# goto develop branch and merge
`git checkout develop`
rslt = `git merge --no-ff #{current_task.branch_name}`
error "Not fast forward merge failed: #{rslt}" unless $?.success?
@@ -62,13 +61,11 @@
end
info "Delete closed branch #{current_task.branch_name}"
`git branch -d #{current_task.branch_name}`
- if @config["git_remote"]
- info "Delete closed branch remotely"
- `git push #{@config["git_remote"]} :#{current_task.branch_name}`
- end
+ info "Delete closed branch remotely"
+ `git push #{@config["git_remote"]} :#{current_task.branch_name}`
end
end # class
end