git_reflow 0.6.6 → 0.6.7
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/Gemfile.lock +1 -1
- data/lib/git_reflow.rb +8 -8
- data/lib/git_reflow/git_helpers.rb +13 -3
- data/lib/git_reflow/version.rb +1 -1
- data/spec/git_reflow_spec.rb +2 -0
- data/spec/lib/git_reflow/git_helpers_spec.rb +15 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 412c28714e64f91f462fe9b108b3679a7d299f59
|
4
|
+
data.tar.gz: 0984ef9112a092cba604b95845b394aa986725ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3d16defd3d4924b6827a3e145c7115061a7b9d14a3572cf10ef8cbdd373b348739bbb3b61092ad33a758e3a439851c55b0e4b9cb2c3b709e39ea1dac45c2d8e
|
7
|
+
data.tar.gz: 8d4ef3aafabe9ad955982d0248cd7cc74d1decb6817b1c69c7c0d0ffd600ed21f287be9ce28cd008d824288181a6fb55d05ae40fdfdb327b7fac7e7d372577c9
|
data/Gemfile.lock
CHANGED
data/lib/git_reflow.rb
CHANGED
@@ -66,13 +66,13 @@ module GitReflow
|
|
66
66
|
|
67
67
|
def deliver(options = {})
|
68
68
|
feature_branch = current_branch
|
69
|
-
options['base']
|
70
|
-
fetch_destination options['base']
|
69
|
+
base_branch = options['base'] || 'master'
|
71
70
|
|
72
|
-
|
71
|
+
fetch_destination(base_branch)
|
72
|
+
update_destination(feature_branch)
|
73
73
|
|
74
74
|
begin
|
75
|
-
existing_pull_request = git_server.find_open_pull_request( :from => current_branch, :to =>
|
75
|
+
existing_pull_request = git_server.find_open_pull_request( :from => current_branch, :to => base_branch )
|
76
76
|
|
77
77
|
if existing_pull_request.nil?
|
78
78
|
say "No pull request exists for #{remote_user}:#{current_branch}\nPlease submit your branch for review first with \`git reflow review\`", :deliver_halted
|
@@ -90,9 +90,9 @@ module GitReflow
|
|
90
90
|
if options['skip_lgtm'] or ((status.nil? or status.state == "success") and (has_comments and open_comment_authors.empty?))
|
91
91
|
puts "Merging pull request ##{existing_pull_request.number}: '#{existing_pull_request.title}', from '#{existing_pull_request.feature_branch_name}' into '#{existing_pull_request.base_branch_name}'"
|
92
92
|
|
93
|
-
update_destination(
|
93
|
+
update_destination(base_branch)
|
94
94
|
merge_feature_branch(feature_branch,
|
95
|
-
:destination_branch =>
|
95
|
+
:destination_branch => base_branch,
|
96
96
|
:pull_request_number => existing_pull_request.number,
|
97
97
|
:lgtm_authors => git_server.approvals(existing_pull_request),
|
98
98
|
:message => commit_message)
|
@@ -106,13 +106,13 @@ module GitReflow
|
|
106
106
|
deploy_and_cleanup = always_deploy_and_cleanup || (ask "Would you like to push this branch to your remote repo and cleanup your feature branch? ") =~ /^y/i
|
107
107
|
|
108
108
|
if deploy_and_cleanup
|
109
|
-
run_command_with_label "git push origin #{
|
109
|
+
run_command_with_label "git push origin #{base_branch}"
|
110
110
|
run_command_with_label "git push origin :#{feature_branch}"
|
111
111
|
run_command_with_label "git branch -D #{feature_branch}"
|
112
112
|
puts "Nice job buddy."
|
113
113
|
else
|
114
114
|
puts "Cleanup halted. Local changes were not pushed to remote repo.".colorize(:red)
|
115
|
-
puts "To reset and go back to your branch run \`git reset --hard origin
|
115
|
+
puts "To reset and go back to your branch run \`git reset --hard origin/#{base_branch} && git checkout #{feature_branch}\`"
|
116
116
|
end
|
117
117
|
else
|
118
118
|
say "There were problems commiting your feature... please check the errors above and try again.", :error
|
@@ -62,10 +62,20 @@ module GitReflow
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def append_to_squashed_commit_message(message = '')
|
65
|
-
|
66
|
-
|
65
|
+
tmp_squash_message_path = "#{git_root_dir}/.git/tmp_squash_msg"
|
66
|
+
squash_message_path = "#{git_root_dir}/.git/SQUASH_MSG"
|
67
|
+
File.open(tmp_squash_message_path, "w") do |file_content|
|
68
|
+
file_content.puts message
|
69
|
+
if File.exists?(squash_message_path)
|
70
|
+
File.foreach(squash_message_path) do |line|
|
71
|
+
file_content.puts line
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
run "mv #{tmp_squash_message_path} #{squash_message_path}"
|
67
77
|
end
|
68
|
-
|
78
|
+
|
69
79
|
private
|
70
80
|
|
71
81
|
def extract_remote_user_and_repo_from_remote_url(remote_url)
|
data/lib/git_reflow/version.rb
CHANGED
data/spec/git_reflow_spec.rb
CHANGED
@@ -149,15 +149,24 @@ describe GitReflow::GitHelpers do
|
|
149
149
|
end
|
150
150
|
|
151
151
|
describe ".append_to_squashed_commit_message(message)" do
|
152
|
-
let(:
|
153
|
-
let(:
|
154
|
-
|
155
|
-
|
152
|
+
let(:original_squash_message) { "Oooooo, SQUASH IT" }
|
153
|
+
let(:message) { "do do the voodoo that you do" }
|
154
|
+
let(:root_dir) { '/home/gitreflow' }
|
155
|
+
let(:squash_path) { "#{root_dir}/.git/SQUASH_MSG" }
|
156
|
+
let(:tmp_squash_path) { "#{root_dir}/.git/tmp_squash_msg" }
|
157
|
+
before { allow(Gitacular).to receive(:git_root_dir).and_return(root_dir) }
|
158
|
+
subject { Gitacular.append_to_squashed_commit_message(message) }
|
156
159
|
|
157
160
|
it "appends the message to git's SQUASH_MSG temp file" do
|
161
|
+
tmp_file = double('file')
|
162
|
+
allow(File).to receive(:open).with(tmp_squash_path, "w").and_yield(tmp_file)
|
163
|
+
allow(File).to receive(:exists?).with(squash_path).and_return(true)
|
164
|
+
allow(File).to receive(:foreach).with(squash_path).and_yield(original_squash_message)
|
165
|
+
expect(tmp_file).to receive(:puts).with(message)
|
166
|
+
expect(tmp_file).to receive(:puts).with(original_squash_message)
|
167
|
+
|
158
168
|
expect { subject }.to have_run_commands_in_order [
|
159
|
-
"
|
160
|
-
"mv #{root_dir}/tmp_squash_msg #{root_dir}/.git/SQUASH_MSG"
|
169
|
+
"mv #{tmp_squash_path} #{squash_path}"
|
161
170
|
]
|
162
171
|
end
|
163
172
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_reflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentino Stoll
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-09-
|
13
|
+
date: 2015-09-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: appraisal
|