Class: Heal::Cli::Git
Instance Method Summary collapse
- #cherry_pick_pr(commit_message_identifier, repo, source_branch, target_branch, throwaway_branch) ⇒ Object
- #create_pr(repository_name, source_branch, target_branch) ⇒ Object
- #find_commits(commit_message_identifier) ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from Heal::Cli::Base
Instance Method Details
#cherry_pick_pr(commit_message_identifier, repo, source_branch, target_branch, throwaway_branch) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/heal/cli/git.rb', line 5 def cherry_pick_pr(, repo, source_branch, target_branch, throwaway_branch) prepare repo do checkout_and_pull source_branch commits = invoke "heal:cli:git:find-commits", [] checkout_and_pull target_branch checkout_new_branch throwaway_branch cherry_pick_commits(commits) git :push, :origin, throwaway_branch invoke "heal:cli:git:create-pr", [repo_name, throwaway_branch, target_branch] end end |
#create_pr(repository_name, source_branch, target_branch) ⇒ Object
31 32 33 |
# File 'lib/heal/cli/git.rb', line 31 def create_pr(repository_name, source_branch, target_branch) `open #{format(@config["git"]["pr_link"], repository_name, source_branch, target_branch)}` end |
#find_commits(commit_message_identifier) ⇒ Object
20 21 22 |
# File 'lib/heal/cli/git.rb', line 20 def find_commits() p `#{git :log, :"--oneline", :"--grep", , execute: false}`.lines.map { |line| line.split.first }.reverse end |