Skip to content
Browse files

Add feature convert

  • Loading branch information...
1 parent 3b5b294 commit b0deaca4d90b978a747f68cfd7d3bb6ff6f13e1a @xiongchiamiov xiongchiamiov committed Aug 10, 2012
Showing with 20 additions and 0 deletions.
  1. +19 −0 feature.rb
  2. +1 −0 helpers.rb
View
19 feature.rb
@@ -87,6 +87,25 @@
puts "Successfully created pull-request ##{response[:number]}"
puts " " + response[:html_url]
+when 'convert'
+ feature = ARGV[1] || Git::current_branch
+
+ # Checkout the branch first to make sure we have it locally.
+ Git::run_safe("git checkout \"#{feature}\"")
+
+ # Make a hotfix branch.
+ system "hotfix start #{feature}"
+
+ # Pull our commits over.
+ # The docs indicate that this should do what we want. But for some very
+ # strange reason, it instead rebases commits that are in stable but not on
+ # the hotfix branch onto the feature branch. But, of course, the -i dialog
+ # only indicates the commits from this branch. Sigh.
+ #Git::run_safe("git rebase -i --onto 'hotfix-#{feature}' '#{Git::development_branch}' '#{feature}'")
+ # So this does what we want, except for where it puts 'noop' in the -i
+ # dialog instead of the commits. It's not supposed to do that.
+ Git::run_safe("git rebase -i --onto '#{feature}' '#{Git::development_branch}' 'hotfix-#{feature}'")
+
when 'merge'
fail_on_local_changes
View
1 helpers.rb
@@ -17,6 +17,7 @@ def display_feature_help(command = nil, message = nil)
:switch => "feature switch name-of-feature",
:finish => "feature finish name-of-feature",
:pull => "feature pull",
+ :convert => "feature convert [name-of-feature]",
:status => "feature status",
:stashes => "feature stashes [-v]",
:'github-test' => "feature github-test"

0 comments on commit b0deaca

Please sign in to comment.
Something went wrong with that request. Please try again.