git_reflow 0.8.10 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/multi-ruby-tests.yml +33 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -1
- data/Appraisals +1 -6
- data/CHANGELOG.md +466 -348
- data/Gemfile.lock +100 -70
- data/LICENSE +20 -20
- data/README.md +36 -12
- data/Rakefile +15 -8
- data/Workflow +3 -0
- data/bin/console +7 -7
- data/bin/setup +6 -6
- data/exe/git-reflow +14 -30
- data/git_reflow.gemspec +25 -24
- data/lib/git_reflow.rb +3 -14
- data/lib/git_reflow/config.rb +52 -17
- data/lib/git_reflow/git_helpers.rb +69 -22
- data/lib/git_reflow/git_server/base.rb +68 -68
- data/lib/git_reflow/git_server/git_hub.rb +53 -40
- data/lib/git_reflow/git_server/git_hub/pull_request.rb +25 -17
- data/lib/git_reflow/git_server/pull_request.rb +19 -3
- data/lib/git_reflow/merge_error.rb +9 -9
- data/lib/git_reflow/rspec.rb +1 -0
- data/lib/git_reflow/rspec/command_line_helpers.rb +23 -6
- data/lib/git_reflow/rspec/stub_helpers.rb +13 -13
- data/lib/git_reflow/rspec/workflow_helpers.rb +18 -0
- data/lib/git_reflow/sandbox.rb +16 -6
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow/workflow.rb +305 -10
- data/lib/git_reflow/workflows/FlatMergeWorkflow +38 -0
- data/lib/git_reflow/workflows/core.rb +208 -79
- data/spec/fixtures/authentication_failure.json +3 -0
- data/spec/fixtures/awesome_workflow.rb +2 -6
- data/spec/fixtures/git/git_config +7 -7
- data/spec/fixtures/issues/comment.json.erb +27 -27
- data/spec/fixtures/issues/comments.json +29 -29
- data/spec/fixtures/issues/comments.json.erb +15 -15
- data/spec/fixtures/pull_requests/comment.json.erb +45 -45
- data/spec/fixtures/pull_requests/comments.json +47 -47
- data/spec/fixtures/pull_requests/comments.json.erb +15 -15
- data/spec/fixtures/pull_requests/commits.json +29 -29
- data/spec/fixtures/pull_requests/external_pull_request.json +145 -145
- data/spec/fixtures/pull_requests/pull_request.json +142 -142
- data/spec/fixtures/pull_requests/pull_request.json.erb +142 -142
- data/spec/fixtures/pull_requests/pull_request_branch_nonexistent_error.json +32 -0
- data/spec/fixtures/pull_requests/pull_request_exists_error.json +32 -32
- data/spec/fixtures/pull_requests/pull_requests.json +136 -136
- data/spec/fixtures/repositories/commit.json +53 -53
- data/spec/fixtures/repositories/commit.json.erb +53 -53
- data/spec/fixtures/repositories/commits.json.erb +13 -13
- data/spec/fixtures/repositories/statuses.json +31 -31
- data/spec/fixtures/users/user.json +32 -0
- data/spec/lib/git_reflow/git_helpers_spec.rb +115 -12
- data/spec/lib/git_reflow/git_server/git_hub/pull_request_spec.rb +6 -6
- data/spec/lib/git_reflow/git_server/git_hub_spec.rb +77 -3
- data/spec/lib/git_reflow/git_server/pull_request_spec.rb +41 -7
- data/spec/lib/git_reflow/workflow_spec.rb +259 -14
- data/spec/lib/git_reflow/workflows/core_spec.rb +224 -65
- data/spec/lib/git_reflow/workflows/flat_merge_spec.rb +17 -6
- data/spec/lib/git_reflow_spec.rb +2 -25
- data/spec/spec_helper.rb +3 -0
- data/spec/support/github_helpers.rb +1 -1
- data/spec/support/mock_pull_request.rb +17 -17
- data/spec/support/web_mocks.rb +39 -39
- metadata +52 -53
- data/circle.yml +0 -26
- data/lib/git_reflow/commands/deliver.rb +0 -10
- data/lib/git_reflow/commands/refresh.rb +0 -20
- data/lib/git_reflow/commands/review.rb +0 -13
- data/lib/git_reflow/commands/setup.rb +0 -11
- data/lib/git_reflow/commands/stage.rb +0 -9
- data/lib/git_reflow/commands/start.rb +0 -18
- data/lib/git_reflow/commands/status.rb +0 -7
- data/lib/git_reflow/workflows/flat_merge.rb +0 -10
- data/spec/fixtures/workflow_with_super.rb +0 -8
@@ -0,0 +1,38 @@
|
|
1
|
+
command(:deliver, arguments: { base: "master" }, flags: { merge_method: "merge" }, switches: { force: false, skip_lgtm: false }) do |**params|
|
2
|
+
params[:force] = params[:force] || params[:skip_lgtm]
|
3
|
+
begin
|
4
|
+
existing_pull_request = git_server.find_open_pull_request( from: current_branch, to: params[:base] )
|
5
|
+
|
6
|
+
if existing_pull_request.nil?
|
7
|
+
say "No pull request exists for #{remote_user}:#{current_branch}\nPlease submit your branch for review first with \`git reflow review\`", :deliver_halted
|
8
|
+
else
|
9
|
+
|
10
|
+
if existing_pull_request.good_to_merge?(force: params[:force])
|
11
|
+
# displays current status and prompts user for confirmation
|
12
|
+
self.status destination_branch: params[:base]
|
13
|
+
existing_pull_request.merge!(params)
|
14
|
+
else
|
15
|
+
say existing_pull_request.rejection_message, :deliver_halted
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
rescue Github::Error::UnprocessableEntity => e
|
21
|
+
say "Github Error: #{e.inspect}", :error
|
22
|
+
end
|
23
|
+
end
|
24
|
+
command_help(
|
25
|
+
:deliver,
|
26
|
+
summary: "deliver your feature branch",
|
27
|
+
arguments: {
|
28
|
+
base: "the branch to merge this feature into"
|
29
|
+
},
|
30
|
+
flags: {
|
31
|
+
merge_method: "how you want your feature branch merged ('merge', 'squash', 'rebase')"
|
32
|
+
},
|
33
|
+
switches: {
|
34
|
+
force: "skip the lgtm checks and deliver your feature branch",
|
35
|
+
skip_lgtm: "skip the lgtm checks and deliver your feature branch"
|
36
|
+
},
|
37
|
+
description: "merge your feature branch down to your base branch, and cleanup your feature branch"
|
38
|
+
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH << File.expand_path(File.realpath(__dir__) + '/../..')
|
2
2
|
require 'git_reflow/workflow'
|
3
3
|
|
4
4
|
module GitReflow
|
@@ -6,86 +6,134 @@ module GitReflow
|
|
6
6
|
# This class contains the core workflow for git-reflow. Going forward, this
|
7
7
|
# will act as the base class for customizing and extending git-reflow.
|
8
8
|
class Core
|
9
|
-
include GitReflow::Workflow
|
9
|
+
include ::GitReflow::Workflow
|
10
|
+
|
11
|
+
# Reads and evaluates the provided file in the context of this class
|
12
|
+
#
|
13
|
+
# @param workflow_path [String] the path of the Workflow file to eval
|
14
|
+
def self.load_workflow(workflow_path)
|
15
|
+
return unless workflow_path.length > 0 and File.exists?(workflow_path)
|
16
|
+
::GitReflow.logger.debug "Using workflow: #{workflow_path}"
|
17
|
+
self.load_raw_workflow(File.read(workflow_path))
|
18
|
+
end
|
19
|
+
|
20
|
+
# Evaluates the provided string in the context of this class
|
21
|
+
#
|
22
|
+
# @param workflow_string [String] the contents of a Workflow file to eval
|
23
|
+
def self.load_raw_workflow(workflow_string)
|
24
|
+
return if workflow_string.strip.empty?
|
25
|
+
::GitReflow.logger.debug "Evaluating workflow..."
|
26
|
+
binding.eval(workflow_string)
|
27
|
+
end
|
10
28
|
|
11
29
|
# Sets up the required git configurations that git-reflow depends on.
|
12
30
|
#
|
13
|
-
# @param
|
14
|
-
# @
|
15
|
-
|
31
|
+
# @param [Hash] options the options to run setup with
|
32
|
+
# @option options [Boolean] :local (false) whether to configure git-reflow specific to the current project
|
33
|
+
# @option options [Boolean] :enterprise (false) whether to configure git-reflow for use with Github Enterprise
|
34
|
+
command(:setup, switches: { local: false, enterprise: false}) do |**params|
|
16
35
|
reflow_options = { project_only: params[:local], enterprise: params[:enterprise] }
|
17
|
-
existing_git_include_paths =
|
18
|
-
|
19
|
-
unless File.exist?(
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
36
|
+
existing_git_include_paths = git_config.get('include.path', all: true).split("\n")
|
37
|
+
|
38
|
+
unless File.exist?(git_config::CONFIG_FILE_PATH) or existing_git_include_paths.include?(git_config::CONFIG_FILE_PATH)
|
39
|
+
say "We'll walk you through setting up git-reflow's defaults for all your projects.", :notice
|
40
|
+
say "In the future, you can run \`git-reflow setup --local\` from the root of any project you want to setup differently.", :notice
|
41
|
+
run "touch #{git_config::CONFIG_FILE_PATH}"
|
42
|
+
say "Created #{git_config::CONFIG_FILE_PATH} for git-reflow specific configurations.", :notice
|
43
|
+
git_config.add "include.path", git_config::CONFIG_FILE_PATH, global: true
|
44
|
+
say "Added #{git_config::CONFIG_FILE_PATH} to include.path in $HOME/.gitconfig.", :notice
|
26
45
|
end
|
27
46
|
|
28
47
|
choose do |menu|
|
29
48
|
menu.header = "Available remote Git Server services"
|
30
49
|
menu.prompt = "Which service would you like to use for this project? "
|
31
50
|
|
32
|
-
menu.choice('GitHub') { GitReflow::GitServer.connect reflow_options.merge({ provider: 'GitHub', silent: false }) }
|
33
|
-
menu.choice('BitBucket (team-owned repos only)') { GitReflow::GitServer.connect reflow_options.merge({ provider: 'BitBucket', silent: false }) }
|
51
|
+
menu.choice('GitHub') { ::GitReflow::GitServer.connect reflow_options.merge({ provider: 'GitHub', silent: false }) }
|
52
|
+
menu.choice('BitBucket (team-owned repos only)') { ::GitReflow::GitServer.connect reflow_options.merge({ provider: 'BitBucket', silent: false }) }
|
34
53
|
end
|
35
54
|
|
36
|
-
|
37
|
-
|
55
|
+
git_config.set "constants.minimumApprovals", ask("Set the minimum number of approvals (leaving blank will require approval from all commenters): "), local: reflow_options[:project_only]
|
56
|
+
git_config.set "constants.approvalRegex", ::GitReflow::GitServer::PullRequest::DEFAULT_APPROVAL_REGEX, local: reflow_options[:project_only]
|
38
57
|
|
39
|
-
if
|
40
|
-
|
41
|
-
|
58
|
+
if git_config.get('core.editor').length <= 0
|
59
|
+
git_config.set('core.editor', default_editor, local: reflow_options[:project_only])
|
60
|
+
say "Updated git's editor (via git config key 'core.editor') to: #{default_editor}.", :notice
|
42
61
|
end
|
43
62
|
end
|
63
|
+
command_help(
|
64
|
+
:setup,
|
65
|
+
summary: "Connect your GitServer (e.g. GitHub) account to git-reflow",
|
66
|
+
switches: {
|
67
|
+
local: "setup GitReflow for the current project only",
|
68
|
+
enterprise: "setup GitReflow with a Github Enterprise account",
|
69
|
+
}
|
70
|
+
)
|
44
71
|
|
45
72
|
# Start a new feature branch
|
46
73
|
#
|
47
|
-
# @param
|
48
|
-
# @option
|
49
|
-
|
50
|
-
|
74
|
+
# @param [Hash] options the options to run start with
|
75
|
+
# @option options [String] :base ("master") the name of the base branch you want to checkout your feature from
|
76
|
+
# @option options [String] :feature_branch the name of the base branch you want to checkout your feature from
|
77
|
+
command(:start, arguments: { feature_branch: nil }, flags: { base: nil }) do |**params|
|
78
|
+
base_branch = params[:base] || default_base_branch
|
51
79
|
feature_branch = params[:feature_branch]
|
52
80
|
|
53
81
|
if feature_branch.nil? or feature_branch.length <= 0
|
54
|
-
|
82
|
+
say "usage: git-reflow start [new-branch-name]", :error
|
55
83
|
else
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
84
|
+
run_command_with_label "git checkout #{base_branch}"
|
85
|
+
run_command_with_label "git pull origin #{base_branch}"
|
86
|
+
run_command_with_label "git push origin #{base_branch}:refs/heads/#{feature_branch}"
|
87
|
+
run_command_with_label "git checkout --track -b #{feature_branch} origin/#{feature_branch}"
|
60
88
|
end
|
61
89
|
end
|
90
|
+
command_help(
|
91
|
+
:start,
|
92
|
+
summary: "This will create a new feature branch and setup remote tracking",
|
93
|
+
arguments: { new_feature_branch: "name of the new feature branch" },
|
94
|
+
flags: { base: "name of a branch you want to branch off of" },
|
95
|
+
description: <<LONGTIME
|
96
|
+
Performs the following:\n
|
97
|
+
\t$ git checkout <base_branch>\n
|
98
|
+
\t$ git pull origin <base_branch>\n
|
99
|
+
\t$ git push origin <base_branch>:refs/heads/[new_feature_branch]\n
|
100
|
+
\t$ git checkout --track -b [new_feature_branch] origin/[new_feature_branch]\n
|
101
|
+
LONGTIME
|
102
|
+
)
|
62
103
|
|
63
104
|
# Submit a feature branch for review
|
64
105
|
#
|
65
|
-
# @
|
66
|
-
# @option
|
67
|
-
# @option
|
68
|
-
|
69
|
-
|
106
|
+
# @param [Hash] options the options to run review with
|
107
|
+
# @option options [String] :base (GitReflow::Config.get('reflow.base-branch') or "master") the name of the base branch you want to merge your feature into
|
108
|
+
# @option options [String] :title (<current-branch-name>) the title of your pull request
|
109
|
+
# @option options [String] :message ("") the body of your pull request
|
110
|
+
command(:review, arguments: { base: nil }, flags: { title: nil, message: nil }) do |**params|
|
111
|
+
base_branch = params[:base] || default_base_branch
|
70
112
|
create_pull_request = true
|
71
113
|
|
72
|
-
|
114
|
+
fetch_destination base_branch
|
73
115
|
begin
|
74
|
-
|
116
|
+
push_current_branch
|
75
117
|
|
76
|
-
existing_pull_request =
|
118
|
+
existing_pull_request = git_server.find_open_pull_request( from: current_branch, to: base_branch )
|
77
119
|
if existing_pull_request
|
78
120
|
say "A pull request already exists for these branches:", :notice
|
79
121
|
existing_pull_request.display_pull_request_summary
|
80
122
|
else
|
81
|
-
unless params[:title] || params[:
|
82
|
-
pull_request_msg_file = "#{
|
123
|
+
unless params[:title] || params[:message]
|
124
|
+
pull_request_msg_file = "#{git_root_dir}/.git/GIT_REFLOW_PR_MSG"
|
83
125
|
|
84
126
|
File.open(pull_request_msg_file, 'w') do |file|
|
85
|
-
|
127
|
+
begin
|
128
|
+
pr_message = params[:title] || pull_request_template || current_branch
|
129
|
+
file.write(pr_message)
|
130
|
+
rescue StandardError => e
|
131
|
+
logger.error "Unable to parse PR template (#{pull_request_msg_file}): #{e.inspect}"
|
132
|
+
file.write(params[:title] || current_branch)
|
133
|
+
end
|
86
134
|
end
|
87
135
|
|
88
|
-
|
136
|
+
run("#{git_editor_command} #{pull_request_msg_file}", with_system: true)
|
89
137
|
|
90
138
|
pr_msg = File.read(pull_request_msg_file).split(/[\r\n]|\r\n/).map(&:strip)
|
91
139
|
title = pr_msg.shift
|
@@ -97,22 +145,30 @@ module GitReflow
|
|
97
145
|
end
|
98
146
|
|
99
147
|
params[:title] = title
|
100
|
-
params[:
|
148
|
+
params[:message] = "#{pr_msg.join("\n")}\n"
|
101
149
|
|
102
150
|
say "\nReview your PR:\n"
|
103
151
|
say "--------\n"
|
104
152
|
say "Title:\n#{params[:title]}\n\n"
|
105
|
-
say "Body:\n#{params[:
|
153
|
+
say "Body:\n#{params[:message]}\n"
|
106
154
|
say "--------\n"
|
107
155
|
|
108
156
|
create_pull_request = ask("Submit pull request? (Y)") =~ /y/i
|
109
157
|
end
|
110
158
|
|
111
159
|
if create_pull_request
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
160
|
+
begin
|
161
|
+
retries ||= 0
|
162
|
+
pull_request = git_server.create_pull_request(
|
163
|
+
title: params[:title] || params[:message],
|
164
|
+
body: params[:message],
|
165
|
+
head: "#{remote_user}:#{current_branch}",
|
166
|
+
base: base_branch
|
167
|
+
)
|
168
|
+
rescue Github::Error::UnprocessableEntity
|
169
|
+
retry if (retries += 1) < 3
|
170
|
+
raise
|
171
|
+
end
|
116
172
|
|
117
173
|
say "Successfully created pull request ##{pull_request.number}: #{pull_request.title}\nPull Request URL: #{pull_request.html_url}\n", :success
|
118
174
|
else
|
@@ -125,25 +181,49 @@ module GitReflow
|
|
125
181
|
say "\nError: #{e.inspect}", :error
|
126
182
|
end
|
127
183
|
end
|
184
|
+
command_help(
|
185
|
+
:review,
|
186
|
+
summary: "Pushes your latest feature branch changes to your remote repo and creates a pull request",
|
187
|
+
arguments: {
|
188
|
+
base: "the branch you want to merge your feature branch into"
|
189
|
+
},
|
190
|
+
flags: {
|
191
|
+
title: "the title of the Pull Request we'll create",
|
192
|
+
message: "the body of the Pull Request we'll create"
|
193
|
+
}
|
194
|
+
)
|
128
195
|
|
129
196
|
# Checks the status of an existing pull request
|
130
197
|
#
|
131
|
-
# @
|
132
|
-
|
133
|
-
|
198
|
+
# @param [Hash] options the options to run review with
|
199
|
+
# @option options [String] :destination_branch ("master") the branch you're merging your feature into
|
200
|
+
command(:status, arguments: { destination_branch: nil }) do |**params|
|
201
|
+
base_branch = params[:destination_branch] || default_base_branch
|
202
|
+
pull_request = git_server.find_open_pull_request( :from => current_branch, :to => base_branch )
|
134
203
|
|
135
204
|
if pull_request.nil?
|
136
|
-
say "No pull request exists for #{
|
137
|
-
say "Run 'git reflow review #{
|
205
|
+
say "No pull request exists for #{current_branch} -> #{base_branch}", :notice
|
206
|
+
say "Run 'git reflow review #{base_branch}' to start the review process", :notice
|
138
207
|
else
|
139
208
|
say "Here's the status of your review:"
|
140
209
|
pull_request.display_pull_request_summary
|
141
210
|
end
|
142
211
|
end
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
212
|
+
command_help(
|
213
|
+
:status,
|
214
|
+
summary: "Display information about the status of your feature in the review process",
|
215
|
+
arguments: {
|
216
|
+
destination_branch: "the branch to merge your feature into"
|
217
|
+
}
|
218
|
+
)
|
219
|
+
|
220
|
+
# Deploys the current branch to a specified server
|
221
|
+
#
|
222
|
+
# @param [Hash] options the options to run review with
|
223
|
+
# @option options [String] :destination_server ("default") the environment server to deploy to (pulled from `git config "reflow.deploy-to-#{destination_server}-command")
|
224
|
+
command(:deploy, arguments: { destination_server: "default" }) do |**params|
|
225
|
+
destination_server = params[:destination_server] || "default"
|
226
|
+
deploy_command = git_config.get("reflow.deploy-to-#{destination_server}-command", local: true)
|
147
227
|
|
148
228
|
# first check is to allow for automated setup
|
149
229
|
if deploy_command.empty?
|
@@ -155,50 +235,65 @@ module GitReflow
|
|
155
235
|
say "Skipping deployment..."
|
156
236
|
false
|
157
237
|
else
|
158
|
-
|
238
|
+
git_config.set("reflow.deploy-to-#{destination_server}-command", deploy_command, local: true)
|
159
239
|
run_command_with_label(deploy_command, with_system: true)
|
160
240
|
end
|
161
241
|
end
|
242
|
+
command_help(
|
243
|
+
:deploy,
|
244
|
+
summary: "Deploys the current branch to a specified server",
|
245
|
+
arguments: {
|
246
|
+
destination_server: 'the environment to deploy to (from: `git config "reflow.deploy-to-#{destination_server}-command"`)'
|
247
|
+
}
|
248
|
+
)
|
162
249
|
|
163
250
|
# Merge and deploy a feature branch to a staging branch
|
164
251
|
command(:stage) do |**params|
|
165
|
-
feature_branch_name =
|
166
|
-
staging_branch_name =
|
252
|
+
feature_branch_name = current_branch
|
253
|
+
staging_branch_name = git_config.get('reflow.staging-branch', local: true)
|
167
254
|
|
168
255
|
if staging_branch_name.empty?
|
169
|
-
staging_branch_name =
|
256
|
+
staging_branch_name = ask("What's the name of your staging branch? (default: 'staging') ")
|
170
257
|
staging_branch_name = 'staging' if staging_branch_name.strip == ''
|
171
|
-
|
258
|
+
git_config.set('reflow.staging-branch', staging_branch_name, local: true)
|
172
259
|
end
|
173
260
|
|
174
|
-
|
175
|
-
|
261
|
+
run_command_with_label "git checkout #{staging_branch_name}"
|
262
|
+
run_command_with_label "git pull origin #{staging_branch_name}"
|
176
263
|
|
177
|
-
if
|
178
|
-
|
264
|
+
if run_command_with_label "git merge #{feature_branch_name}", with_system: true
|
265
|
+
run_command_with_label "git push origin #{staging_branch_name}"
|
179
266
|
|
180
267
|
staged = self.deploy(destination_server: :staging)
|
181
268
|
|
182
269
|
if staged
|
183
|
-
|
270
|
+
say "Deployed to Staging.", :success
|
184
271
|
else
|
185
|
-
|
272
|
+
say "There were issues deploying to staging.", :error
|
186
273
|
end
|
187
274
|
else
|
188
|
-
|
275
|
+
say "There were issues merging your feature branch to staging.", :error
|
189
276
|
end
|
190
277
|
end
|
278
|
+
command_help(
|
279
|
+
:stage,
|
280
|
+
summary: "Merge and deploy a feature branch to a staging branch"
|
281
|
+
)
|
191
282
|
|
192
283
|
# Deliver a feature branch to a base branch
|
193
284
|
#
|
194
|
-
# @
|
195
|
-
# @option
|
196
|
-
|
285
|
+
# @param [Hash] options the options to run review with
|
286
|
+
# @option options [String] :base ("master") the base branch to merge your feature branch into
|
287
|
+
# @option options [String] :force (false) whether to force-deliver the feature branch, ignoring any QA checks
|
288
|
+
command(:deliver, arguments: { base: nil }, flags: { merge_method: "squash" }, switches: { force: false, skip_lgtm: false }) do |**params|
|
289
|
+
params[:force] = params[:force] || params[:skip_lgtm]
|
290
|
+
params[:base] ||= default_base_branch
|
291
|
+
|
197
292
|
begin
|
198
|
-
existing_pull_request =
|
293
|
+
existing_pull_request = git_server.find_open_pull_request( from: current_branch, to: params[:base] )
|
199
294
|
|
200
295
|
if existing_pull_request.nil?
|
201
|
-
say "No pull request exists for #{
|
296
|
+
say "No pull request exists for #{remote_user}:#{current_branch}\nPlease submit your branch for review first with \`git reflow review\`", :deliver_halted
|
202
297
|
else
|
203
298
|
|
204
299
|
if existing_pull_request.good_to_merge?(force: params[:force])
|
@@ -215,21 +310,55 @@ module GitReflow
|
|
215
310
|
say "Github Error: #{e.inspect}", :error
|
216
311
|
end
|
217
312
|
end
|
313
|
+
command_help(
|
314
|
+
:deliver,
|
315
|
+
summary: "deliver your feature branch",
|
316
|
+
arguments: {
|
317
|
+
base: "the branch to merge this feature into"
|
318
|
+
},
|
319
|
+
flags: {
|
320
|
+
merge_method: "how you want your feature branch merged ('squash', 'merge', 'rebase')"
|
321
|
+
},
|
322
|
+
switches: {
|
323
|
+
force: "skip the lgtm checks and deliver your feature branch",
|
324
|
+
skip_lgtm: "skip the lgtm checks and deliver your feature branch"
|
325
|
+
},
|
326
|
+
description: "merge your feature branch down to your base branch, and cleanup your feature branch"
|
327
|
+
)
|
218
328
|
|
219
329
|
|
220
330
|
# Updates and synchronizes your base branch and feature branch.
|
221
|
-
#
|
331
|
+
#
|
222
332
|
# Performs the following:
|
223
333
|
# $ git checkout <base_branch>
|
224
334
|
# $ git pull <remote_location> <base_branch>
|
225
335
|
# $ git checkout <current_branch>
|
226
336
|
# $ git pull origin <current_branch>
|
227
337
|
# $ git merge <base_branch>
|
228
|
-
#
|
229
|
-
# @param
|
230
|
-
|
231
|
-
|
338
|
+
#
|
339
|
+
# @param [Hash] options the options to run review with
|
340
|
+
# @option options [String] :remote ("origin") the name of the remote repository to fetch updates from
|
341
|
+
# @option options [String] :base ("master") the branch that you want to fetch updates from
|
342
|
+
command(:refresh, flags: { remote: 'origin', base: nil}) do |**params|
|
343
|
+
params[:base] ||= default_base_branch
|
344
|
+
update_feature_branch(params)
|
232
345
|
end
|
346
|
+
command_help(
|
347
|
+
:refresh,
|
348
|
+
summary: "Updates and synchronizes your base branch and feature branch.",
|
349
|
+
flags: {
|
350
|
+
base: "branch to merge into",
|
351
|
+
remote: "remote repository name to fetch updates from",
|
352
|
+
},
|
353
|
+
description: <<LONGTIME
|
354
|
+
Performs the following:\n
|
355
|
+
\t$ git checkout <base_branch>\n
|
356
|
+
\t$ git pull <remote_location> <base_branch>\n
|
357
|
+
\t$ git checkout <current_branch>\n
|
358
|
+
\t$ git pull origin <current_branch>\n
|
359
|
+
\t$ git merge <base_branch>\n
|
360
|
+
LONGTIME
|
361
|
+
)
|
233
362
|
end
|
234
363
|
end
|
235
364
|
end
|