-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new functionality for review #99
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
be491dc
[version] bumps from 0.5.2 to 0.6.0 per major.minor.bugfix methodology
meesterdude ea9b522
[lib] updates review.rb to open editor and adds -e option to edit t…
meesterdude 48c60ea
[lib] fixes missing end
meesterdude 970c73c
[lib] updates review command
meesterdude 727594b
[doc] updatyes README with new workflow info
meesterdude 3c11bdd
[lib] expands on review functionality and adds ability to exit
meesterdude f9882df
[cmd] updates code per PR
meesterdude 0fa557f
updates to use whatever the user has defined as
meesterdude d7ef891
changes prompt question to only show what enter will do; clearer be…
meesterdude 92ef82c
updates readme to remove -e documentation, no longer valid
meesterdude 4fa4e75
updates review command logic, and updates to use git root directory
meesterdude d834a77
Merge pull request #7 from reenhanced/master
meesterdude b02e02f
Merge branch 'master' of github.com:meesterdude/gitreflow
meesterdude 2738e12
Merge branch 'master' into rj_test
meesterdude c5d7be7
bumps version to 0.6.0
meesterdude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,26 +108,35 @@ We assume you know what you're doing, so if you need something different, do it | |
|
||
After making commits to your branch, run +review+. Didn't push it up? We don't care, we'll do it for you. | ||
|
||
$ git reflow review | ||
If you do not pass the title or message options to the review command, you will be given an editor to write your PR request in, similar to `git commit`. The first line is the title, the rest is the body. | ||
|
||
From github.com:reenhanced/gitreflow | ||
$ git reflow review | ||
|
||
Review your PR: | ||
-------- | ||
Title: | ||
rj_209_test | ||
|
||
Body: | ||
[lib] updates review command to address issues | ||
-------- | ||
Submit pull request? (Y): <enter> | ||
git fetch origin master | ||
From github.com:meesterdude/gitreflow | ||
* branch master -> FETCH_HEAD | ||
Counting objects: 5, done. | ||
Delta compression using up to 16 threads. | ||
Compressing objects: 100% (3/3), done. | ||
Writing objects: 100% (3/3), 1.68 KiB, done. | ||
Total 3 (delta 1), reused 0 (delta 0) | ||
To [email protected]:reenhanced/gitreflow.git | ||
c2ec1b1..1103006 nh-readme-update -> nh-readme-update | ||
|
||
Successfully created pull request #35: Bootstrapping the readme. This is so I can show how review works | ||
Pull Request URL: https://github.com/reenhanced/gitreflow/pull/35 | ||
git push origin rj_test | ||
Everything up-to-date | ||
|
||
Successfully created pull request #6: rj_test | ||
Pull Request URL: https://github.com/meesterdude/gitreflow/pull/6 | ||
Would you like to open it in your browser? y | ||
|
||
|
||
[OSX/Ubuntu only] You can automatically open your default web browser to the pull request. | ||
This lets you edit the pull request with all of the detailed information you'll need before submitting it to your team. | ||
|
||
We output the pull request URL so you can distribute it to your team without leaving the terminal. But don't be a jerk, update the title and description before you send your work around. | ||
We output the pull request URL so you can distribute it to your team without leaving the terminal. | ||
|
||
==== How it works | ||
Behind the scenes, this is how +review+ works: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,34 @@ | |
c.flag [:t, :title], default_value: 'last commit message' | ||
c.flag [:m, :message], default_value: 'title' | ||
c.action do |global_options,options,args| | ||
review_options = { | ||
'base' => args[0], | ||
'title' => global_options[:title], | ||
'body' => global_options[:message] | ||
} | ||
git_root_dir = run('git rev-parse --show-toplevel').strip | ||
pull_request_msg_file = "#{git_root_dir}/.git/GIT_REFLOW_PR_MSG" | ||
|
||
review_options['title'] ||= GitReflow.get_first_commit_message | ||
review_options['body'] ||= review_options['title'] | ||
if global_options[:title] || global_options[:message] | ||
review_options = { | ||
'base' => args[0], | ||
'title' => (global_options[:title] || GitReflow.current_branch), | ||
'body' => global_options[:message] | ||
} | ||
else | ||
File.open(pull_request_msg_file, 'w') do |file| | ||
file.write(GitReflow.current_branch) | ||
end | ||
GitReflow.run("$EDITOR #{pull_request_msg_file}", with_system: true) | ||
pr_msg = File.open(pull_request_msg_file).each_line.map(&:strip).to_a | ||
File.delete(pull_request_msg_file) | ||
title = pr_msg.shift | ||
unless pr_msg.empty? | ||
pr_msg.shift if pr_msg.first.empty? | ||
end | ||
review_options = {'base' => args[0],'title' => title,'body' => pr_msg.join("\n")} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's remove surrounding blank lines from the |
||
end | ||
|
||
GitReflow.review review_options | ||
puts "\nReview your PR:\n" | ||
puts "--------\n" | ||
puts "Title:\n#{review_options['title']}\n\n" | ||
puts "Body:\n#{review_options['body']}\n" | ||
puts "--------\n" | ||
GitReflow.review(review_options) unless ask("Submit pull request? (Y)") =~ /n/i | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module GitReflow | ||
VERSION = "0.5.3" | ||
VERSION = "0.6.0" | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since
(global_options[:title] || global_options[:message]) == (editor = false)
, let's just assign this above into a variable:use_editor = ("#{(global_options[:title] || global_options[:message])}".length == 0)
, then this becomesunless use_editor
and we can eliminate the other assignments ofeditor
below