git-process 1.0.11 → 1.1.0
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.
- data/CHANGELOG.md +37 -9
- data/Gemfile +2 -2
- data/Gemfile.lock +17 -17
- data/README.md +14 -7
- data/bin/git-new-fb +10 -2
- data/bin/git-pull-request +30 -6
- data/bin/git-sync +5 -2
- data/bin/git-to-master +62 -11
- data/git-process.gemspec +15 -15
- data/lib/git-process/abstract_error_builder.rb +0 -3
- data/lib/git-process/changed_file_helper.rb +30 -24
- data/lib/git-process/git_abstract_merge_error_builder.rb +31 -11
- data/lib/git-process/git_branch.rb +5 -0
- data/lib/git-process/git_config.rb +153 -0
- data/lib/git-process/git_lib.rb +212 -164
- data/lib/git-process/git_logger.rb +84 -0
- data/lib/git-process/git_merge_error.rb +3 -14
- data/lib/git-process/git_process.rb +44 -73
- data/lib/git-process/git_process_options.rb +6 -6
- data/lib/git-process/git_rebase_error.rb +4 -13
- data/lib/git-process/git_remote.rb +254 -0
- data/lib/git-process/github_configuration.rb +298 -0
- data/lib/git-process/github_pull_request.rb +65 -27
- data/lib/git-process/new_fb.rb +14 -4
- data/lib/git-process/parked_changes_error.rb +1 -1
- data/lib/git-process/pull_request.rb +100 -13
- data/lib/git-process/pull_request_error.rb +25 -0
- data/lib/git-process/rebase_to_master.rb +47 -27
- data/lib/git-process/sync.rb +48 -33
- data/lib/git-process/uncommitted_changes_error.rb +1 -1
- data/lib/git-process/version.rb +2 -2
- data/spec/GitRepoHelper.rb +48 -25
- data/spec/changed_file_helper_spec.rb +39 -58
- data/spec/git_abstract_merge_error_builder_spec.rb +42 -33
- data/spec/git_branch_spec.rb +30 -30
- data/spec/git_config_spec.rb +45 -0
- data/spec/git_lib_spec.rb +103 -122
- data/spec/git_logger_spec.rb +66 -0
- data/spec/git_process_spec.rb +81 -81
- data/spec/git_remote_spec.rb +188 -0
- data/spec/git_status_spec.rb +36 -36
- data/spec/github_configuration_spec.rb +152 -0
- data/spec/github_pull_request_spec.rb +39 -35
- data/spec/github_test_helper.rb +49 -0
- data/spec/new_fb_spec.rb +65 -24
- data/spec/pull_request_helper.rb +94 -0
- data/spec/pull_request_spec.rb +128 -0
- data/spec/rebase_to_master_spec.rb +241 -145
- data/spec/spec_helper.rb +20 -0
- data/spec/sync_spec.rb +115 -109
- metadata +34 -20
- data/lib/git-process/github_client.rb +0 -83
- data/lib/git-process/github_service.rb +0 -174
- data/spec/github_service_spec.rb +0 -211
@@ -1,10 +1,14 @@
|
|
1
1
|
require 'git-process/rebase_to_master'
|
2
2
|
require 'GitRepoHelper'
|
3
|
+
require 'github_test_helper'
|
4
|
+
require 'pull_request_helper'
|
3
5
|
require 'webmock/rspec'
|
4
6
|
require 'json'
|
7
|
+
include GitProc
|
5
8
|
|
6
|
-
describe
|
9
|
+
describe RebaseToMaster do
|
7
10
|
include GitRepoHelper
|
11
|
+
include GitHubTestHelper
|
8
12
|
|
9
13
|
|
10
14
|
def log_level
|
@@ -14,32 +18,32 @@ describe GitProc::RebaseToMaster do
|
|
14
18
|
|
15
19
|
before(:each) do
|
16
20
|
create_files(%w(.gitignore))
|
17
|
-
|
21
|
+
gitlib.commit('initial')
|
18
22
|
end
|
19
23
|
|
20
24
|
|
21
25
|
after(:each) do
|
22
|
-
rm_rf(
|
26
|
+
rm_rf(gitlib.workdir)
|
23
27
|
end
|
24
28
|
|
25
29
|
|
26
|
-
def create_process(
|
27
|
-
|
30
|
+
def create_process(base, opts = {})
|
31
|
+
RebaseToMaster.new(base, opts)
|
28
32
|
end
|
29
33
|
|
30
34
|
|
31
|
-
describe
|
35
|
+
describe 'rebase to master' do
|
32
36
|
|
33
37
|
it "should work easily for a simple rebase" do
|
34
|
-
|
38
|
+
gitlib.checkout('fb', :new_branch => 'master')
|
35
39
|
change_file_and_commit('a', '')
|
36
40
|
|
37
41
|
commit_count.should == 2
|
38
42
|
|
39
|
-
|
43
|
+
gitlib.checkout('master')
|
40
44
|
change_file_and_commit('b', '')
|
41
45
|
|
42
|
-
|
46
|
+
gitlib.checkout('fb')
|
43
47
|
|
44
48
|
gitprocess.run
|
45
49
|
|
@@ -47,110 +51,85 @@ describe GitProc::RebaseToMaster do
|
|
47
51
|
end
|
48
52
|
|
49
53
|
|
50
|
-
it
|
54
|
+
it 'should work for a rebase after a rerere merge' do
|
51
55
|
# Make sure rerere is enabled
|
52
|
-
|
53
|
-
|
56
|
+
config.rerere_enabled(true, false)
|
57
|
+
config.rerere_autoupdate(false, false)
|
54
58
|
|
55
59
|
# Create the file to conflict on
|
56
60
|
change_file_and_commit('a', '')
|
57
61
|
|
58
62
|
# In the new branch, give it a new value
|
59
|
-
|
63
|
+
gitlib.checkout('fb', :new_branch => 'master') do
|
60
64
|
change_file_and_commit('a', 'hello')
|
61
65
|
end
|
62
66
|
|
63
|
-
# Change the value as well in the
|
64
|
-
|
67
|
+
# Change the value as well in the original branch
|
68
|
+
gitlib.checkout('master') do
|
65
69
|
change_file_and_commit('a', 'goodbye')
|
66
70
|
end
|
67
71
|
|
68
72
|
# Merge in the new branch; don't error-out because will auto-fix.
|
69
|
-
|
70
|
-
|
73
|
+
gitlib.checkout('fb') do
|
74
|
+
gitlib.merge('master') rescue
|
71
75
|
change_file_and_commit('a', 'merged')
|
72
76
|
end
|
73
77
|
|
74
78
|
# Make another change on master
|
75
|
-
|
79
|
+
gitlib.checkout('master') do
|
76
80
|
change_file_and_commit('b', '')
|
77
81
|
end
|
78
82
|
|
79
83
|
# Go back to the branch and try to rebase
|
80
|
-
|
84
|
+
gitlib.checkout('fb')
|
81
85
|
|
82
86
|
begin
|
83
87
|
gitprocess.runner
|
84
88
|
raise "Should have raised RebaseError"
|
85
|
-
rescue
|
86
|
-
exp.
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
89
|
+
rescue RebaseError => exp
|
90
|
+
error_builder = exp.error_builder
|
91
|
+
error_builder.resolved_files.should == %w(a)
|
92
|
+
error_builder.unresolved_files.should == []
|
93
|
+
|
94
|
+
error_builder.commands.length.should == 3
|
95
|
+
error_builder.commands[0].should match /^# Verify/
|
96
|
+
error_builder.commands[1].should == 'git add a'
|
97
|
+
error_builder.commands[2].should == 'git rebase --continue'
|
93
98
|
end
|
94
99
|
end
|
95
100
|
|
96
101
|
|
97
102
|
describe "when used on _parking_" do
|
98
103
|
it 'should fail #rebase_to_master' do
|
99
|
-
|
104
|
+
gitlib.checkout('_parking_', :new_branch => 'master')
|
100
105
|
change_file_and_commit('a', '')
|
101
106
|
|
102
|
-
expect { gitprocess.verify_preconditions }.
|
107
|
+
expect { gitprocess.verify_preconditions }.to raise_error ParkedChangesError
|
103
108
|
end
|
104
109
|
end
|
105
110
|
|
106
111
|
|
107
112
|
describe "closing the pull request" do
|
113
|
+
include PullRequestHelper
|
108
114
|
|
109
|
-
it "should work for an existing pull request" do
|
110
|
-
stub_request(:get, /test_repo\/pulls\?access_token=/).
|
111
|
-
to_return(:status => 200, :body => JSON([{:number => 987, :state => 'open', :html_url => 'test_url', :head => {:ref => 'fb'}, :base => {:ref => 'master'}}]))
|
112
|
-
stub_request(:patch, /test_repo\/pulls\/987\?access_token=/).
|
113
|
-
with(:body => JSON({:state => 'closed'})).
|
114
|
-
to_return(:status => 200, :body => JSON([{:number => 987, :state => 'closed', :html_url => 'test_url', :head => {:ref => 'fb'}, :base => {:ref => 'master'}}]))
|
115
115
|
|
116
|
-
|
117
|
-
|
118
|
-
gp = clone('fb')
|
119
|
-
gp.config('gitProcess.github.authToken', 'test-token')
|
120
|
-
gp.config('remote.origin.url', 'git@github.com:test_repo.git')
|
121
|
-
gp.config('github.user', 'test_user')
|
122
|
-
|
123
|
-
rtm = GitProc::RebaseToMaster.new(gp.workdir, {:log_level => log_level})
|
124
|
-
rtm.stub(:fetch)
|
125
|
-
rtm.stub(:push)
|
126
|
-
rtm.runner
|
116
|
+
def pull_request
|
117
|
+
@pr ||= create_pull_request(:pr_number => '987', :head_branch => 'fb', :base_branch => 'master')
|
127
118
|
end
|
128
119
|
|
129
120
|
|
130
121
|
it "should not try when there is no auth token" do
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
it "should not try when there is a file:// origin url" do
|
145
|
-
gitprocess.branch('fb', :base_branch => 'master')
|
146
|
-
gp = clone('fb')
|
147
|
-
gp.config('gitProcess.github.authToken', 'test-token')
|
148
|
-
gp.config('github.user', 'test_user')
|
149
|
-
|
150
|
-
rtm = GitProc::RebaseToMaster.new(gp.workdir, {:log_level => log_level})
|
151
|
-
rtm.stub(:fetch)
|
152
|
-
rtm.stub(:push)
|
153
|
-
rtm.runner
|
122
|
+
gitlib.branch('fb', :base_branch => 'master')
|
123
|
+
clone_repo('fb') do |gl|
|
124
|
+
gl.config['gitProcess.github.authToken'] = ''
|
125
|
+
gl.config['remote.origin.url'] = 'git@github.com:test_repo.git'
|
126
|
+
gl.config['github.user'] = 'test_user'
|
127
|
+
|
128
|
+
rtm = RebaseToMaster.new(gl, :log_level => log_level)
|
129
|
+
rtm.gitlib.stub(:fetch)
|
130
|
+
rtm.gitlib.stub(:push)
|
131
|
+
rtm.runner
|
132
|
+
end
|
154
133
|
end
|
155
134
|
|
156
135
|
end
|
@@ -161,34 +140,35 @@ describe GitProc::RebaseToMaster do
|
|
161
140
|
describe "custom integration branch" do
|
162
141
|
|
163
142
|
it "should use the 'gitProcess.integrationBranch' configuration" do
|
164
|
-
|
143
|
+
gitlib.checkout('int-br', :new_branch => 'master')
|
165
144
|
change_file_and_commit('a', '')
|
166
145
|
|
167
|
-
|
146
|
+
gitlib.checkout('fb', :new_branch => 'master')
|
168
147
|
change_file_and_commit('b', '')
|
169
148
|
|
170
|
-
|
149
|
+
gitlib.branches['master'].delete!
|
171
150
|
|
172
|
-
|
173
|
-
|
151
|
+
clone_repo('int-br') do |gl|
|
152
|
+
gl.config['gitProcess.integrationBranch'] = 'int-br'
|
174
153
|
|
175
|
-
|
154
|
+
gl.checkout('ab', :new_branch => 'origin/int-br')
|
176
155
|
|
177
|
-
|
178
|
-
|
179
|
-
|
156
|
+
my_branches = gl.branches
|
157
|
+
my_branches.include?('origin/master').should be_false
|
158
|
+
my_branches['ab'].sha.should == my_branches['origin/int-br'].sha
|
180
159
|
|
181
|
-
|
160
|
+
gl.stub(:repo_name).and_return('test_repo')
|
182
161
|
|
183
|
-
|
162
|
+
change_file_and_commit('c', '', gl)
|
184
163
|
|
185
|
-
|
186
|
-
|
164
|
+
my_branches = gl.branches
|
165
|
+
my_branches['ab'].sha.should_not == my_branches['origin/int-br'].sha
|
187
166
|
|
188
|
-
|
167
|
+
RebaseToMaster.new(gl, :log_level => log_level).runner
|
189
168
|
|
190
|
-
|
191
|
-
|
169
|
+
my_branches = gl.branches
|
170
|
+
my_branches['HEAD'].sha.should == my_branches['origin/int-br'].sha
|
171
|
+
end
|
192
172
|
end
|
193
173
|
|
194
174
|
end
|
@@ -199,56 +179,56 @@ describe GitProc::RebaseToMaster do
|
|
199
179
|
describe "when handling the parking branch" do
|
200
180
|
|
201
181
|
it "should create it based on origin/master" do
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
182
|
+
gitlib.branch('fb', :base_branch => 'master')
|
183
|
+
clone_repo('fb') do |gl|
|
184
|
+
create_process(gl).remove_feature_branch
|
185
|
+
gl.branches.current.name.should == '_parking_'
|
206
186
|
end
|
207
187
|
end
|
208
188
|
|
209
189
|
|
210
190
|
it "should move it to the new origin/master if it already exists and is clean" do
|
211
|
-
|
212
|
-
|
213
|
-
change_file_and_commit('a', '',
|
191
|
+
clone_repo do |gl|
|
192
|
+
gl.branch('_parking_', :base_branch => 'origin/master')
|
193
|
+
change_file_and_commit('a', '', gl)
|
214
194
|
|
215
|
-
|
195
|
+
gl.checkout('fb', :new_branch => 'origin/master')
|
216
196
|
|
217
|
-
|
197
|
+
create_process(gl).remove_feature_branch
|
218
198
|
|
219
|
-
|
199
|
+
gl.branches.current.name.should == '_parking_'
|
220
200
|
end
|
221
201
|
end
|
222
202
|
|
223
203
|
|
224
204
|
it "should move it to the new origin/master if it already exists and changes are part of the current branch" do
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
change_file_and_commit('a', '',
|
205
|
+
gitlib.checkout('afb', :new_branch => 'master')
|
206
|
+
clone_repo do |gl|
|
207
|
+
gl.checkout('_parking_', :new_branch => 'origin/master') do
|
208
|
+
change_file_and_commit('a', '', gl)
|
229
209
|
end
|
230
210
|
|
231
|
-
|
232
|
-
|
211
|
+
gl.checkout('fb', :new_branch => '_parking_')
|
212
|
+
gl.push('origin', 'fb', 'master')
|
233
213
|
|
234
|
-
|
235
|
-
|
214
|
+
create_process(gl).remove_feature_branch
|
215
|
+
gl.branches.current.name.should == '_parking_'
|
236
216
|
end
|
237
217
|
end
|
238
218
|
|
239
219
|
|
240
220
|
it "should move it out of the way if it has unaccounted changes on it" do
|
241
|
-
|
242
|
-
|
243
|
-
change_file_and_commit('a', '',
|
244
|
-
|
221
|
+
clone_repo do |gl|
|
222
|
+
gl.checkout('_parking_', :new_branch => 'origin/master')
|
223
|
+
change_file_and_commit('a', '', gl)
|
224
|
+
gl.checkout('fb', :new_branch => 'origin/master')
|
245
225
|
|
246
|
-
|
226
|
+
gl.branches.include?('_parking_OLD_').should be_false
|
247
227
|
|
248
|
-
|
228
|
+
create_process(gl).remove_feature_branch
|
249
229
|
|
250
|
-
|
251
|
-
|
230
|
+
gl.branches.include?('_parking_OLD_').should be_true
|
231
|
+
gl.branches.current.name.should == '_parking_'
|
252
232
|
end
|
253
233
|
end
|
254
234
|
|
@@ -256,28 +236,28 @@ describe GitProc::RebaseToMaster do
|
|
256
236
|
|
257
237
|
|
258
238
|
it "should delete the old local branch when it has been merged into origin/master" do
|
259
|
-
|
260
|
-
change_file_and_commit('a', '',
|
239
|
+
clone_repo do |gl|
|
240
|
+
change_file_and_commit('a', '', gl)
|
261
241
|
|
262
|
-
|
263
|
-
|
242
|
+
gl.checkout('fb', :new_branch => 'origin/master')
|
243
|
+
gl.branches.include?('fb').should be_true
|
264
244
|
|
265
|
-
|
245
|
+
create_process(gl).remove_feature_branch
|
266
246
|
|
267
|
-
|
268
|
-
|
247
|
+
gl.branches.include?('fb').should be_false
|
248
|
+
gl.branches.current.name.should == '_parking_'
|
269
249
|
end
|
270
250
|
end
|
271
251
|
|
272
252
|
|
273
253
|
it "should raise an error when the local branch has not been merged into origin/master" do
|
274
|
-
|
275
|
-
|
276
|
-
change_file_and_commit('a', '',
|
254
|
+
clone_repo do |gl|
|
255
|
+
gl.checkout('fb', :new_branch => 'origin/master')
|
256
|
+
change_file_and_commit('a', '', gl)
|
277
257
|
|
278
|
-
|
258
|
+
gl.branches.include?('fb').should be_true
|
279
259
|
|
280
|
-
expect {
|
260
|
+
expect { create_process(gl).remove_feature_branch }.to raise_error GitProcessError
|
281
261
|
end
|
282
262
|
end
|
283
263
|
|
@@ -285,14 +265,14 @@ describe GitProc::RebaseToMaster do
|
|
285
265
|
it "should delete the old remote branch" do
|
286
266
|
change_file_and_commit('a', '')
|
287
267
|
|
288
|
-
|
268
|
+
gitlib.branch('fb', :base_branch => 'master')
|
289
269
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
270
|
+
clone_repo('fb') do |gl|
|
271
|
+
gl.branches.include?('origin/fb').should be_true
|
272
|
+
create_process(gl).remove_feature_branch
|
273
|
+
gl.branches.include?('origin/fb').should be_false
|
274
|
+
gitlib.branches.include?('fb').should be_false
|
275
|
+
gl.branches.current.name.should == '_parking_'
|
296
276
|
end
|
297
277
|
end
|
298
278
|
|
@@ -302,13 +282,15 @@ describe GitProc::RebaseToMaster do
|
|
302
282
|
describe ":keep option" do
|
303
283
|
|
304
284
|
it "should not try to close a pull request or remove remote branch" do
|
305
|
-
|
285
|
+
gitlib.branch('fb', :base_branch => 'master')
|
306
286
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
287
|
+
clone_repo('fb') do |gl|
|
288
|
+
rtm = GitProc::RebaseToMaster.new(gl, :log_level => log_level, :keep => true)
|
289
|
+
gl.should_receive(:fetch)
|
290
|
+
gl.should_receive(:push).with('origin', gl.branches.current.name, 'master')
|
291
|
+
gl.should_not_receive(:push).with('origin', nil, nil, :delete => 'fb')
|
292
|
+
rtm.runner
|
293
|
+
end
|
312
294
|
end
|
313
295
|
|
314
296
|
end
|
@@ -317,15 +299,129 @@ describe GitProc::RebaseToMaster do
|
|
317
299
|
describe ":interactive option" do
|
318
300
|
|
319
301
|
it "should try to do an interactive rebase" do
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
302
|
+
gitlib.branch('fb', :base_branch => 'master')
|
303
|
+
|
304
|
+
clone_repo('fb') do |gl|
|
305
|
+
rtm = GitProc::RebaseToMaster.new(gl, :log_level => log_level, :interactive => true)
|
306
|
+
gl.should_receive(:fetch)
|
307
|
+
gl.should_receive(:rebase).with('origin/master', {})
|
308
|
+
gl.should_receive(:rebase).with('origin/master', :interactive => true)
|
309
|
+
gl.should_receive(:push).with('origin', gl.branches.current.name, 'master')
|
310
|
+
gl.should_receive(:push).with('origin', nil, nil, :delete => 'fb')
|
311
|
+
rtm.runner
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
end
|
316
|
+
|
317
|
+
|
318
|
+
describe 'to-master pull request' do
|
319
|
+
include PullRequestHelper
|
320
|
+
|
321
|
+
|
322
|
+
def pull_request_number
|
323
|
+
pull_request[:number]
|
324
|
+
end
|
325
|
+
|
326
|
+
|
327
|
+
def head_repo_name
|
328
|
+
pull_request[:head][:repo][:name]
|
329
|
+
end
|
330
|
+
|
331
|
+
|
332
|
+
def base_repo_name
|
333
|
+
pull_request[:base][:repo][:name]
|
334
|
+
end
|
335
|
+
|
336
|
+
|
337
|
+
def base_branch_name
|
338
|
+
pull_request[:base][:ref]
|
339
|
+
end
|
340
|
+
|
341
|
+
|
342
|
+
def head_branch_name
|
343
|
+
pull_request[:head][:ref]
|
344
|
+
end
|
345
|
+
|
346
|
+
|
347
|
+
before(:each) do
|
348
|
+
gitlib.branch(head_branch_name, :base_branch => 'master')
|
349
|
+
end
|
350
|
+
|
351
|
+
|
352
|
+
def configure(gl)
|
353
|
+
gl.config['gitProcess.github.authToken'] = 'sdfsfsdf'
|
354
|
+
gl.config["remote.#{head_repo_name}.url"] = "git@github.com:#{head_repo_name}.git"
|
355
|
+
gl.config['github.user'] = 'jdigger'
|
356
|
+
gl.config['gitProcess.remoteName'] = head_repo_name
|
357
|
+
|
358
|
+
stub_fetch(:head, gl)
|
359
|
+
stub_fetch(:base, gl)
|
360
|
+
|
361
|
+
stub_get("https://api.github.com/repos/#{head_repo_name}/pulls/#{pull_request_number}", :body => pull_request)
|
362
|
+
stub_patch("https://api.github.com/repos/#{head_repo_name}/pulls/#{pull_request_number}")
|
363
|
+
end
|
364
|
+
|
365
|
+
|
366
|
+
describe "with PR #" do
|
367
|
+
|
368
|
+
def pull_request
|
369
|
+
@pr ||= create_pull_request({})
|
370
|
+
end
|
371
|
+
|
372
|
+
|
373
|
+
def create_process(dir, opts)
|
374
|
+
RebaseToMaster.new(dir, opts.merge({:prNumber => pull_request_number}))
|
375
|
+
end
|
376
|
+
|
377
|
+
|
378
|
+
it "should checkout the branch for the pull request" do
|
379
|
+
clone_repo('master', head_repo_name) do |gl|
|
380
|
+
gl.branch("#{base_repo_name}/#{base_branch_name}", :base_branch => "#{head_repo_name}/master")
|
381
|
+
|
382
|
+
configure(gl)
|
383
|
+
|
384
|
+
rtm = GitProc::RebaseToMaster.new(gl, :log_level => log_level, :prNumber => pull_request_number)
|
385
|
+
|
386
|
+
gl.should_receive(:push).with(head_repo_name, head_branch_name, 'master')
|
387
|
+
gl.should_receive(:push).with(head_repo_name, nil, nil, :delete => head_branch_name)
|
388
|
+
|
389
|
+
rtm.runner
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
end
|
394
|
+
|
395
|
+
|
396
|
+
describe "with repo name and PR #" do
|
397
|
+
|
398
|
+
def pull_request
|
399
|
+
@pr ||= create_pull_request(:base_remote => 'sourcerepo', :base_repo => 'source_repo')
|
400
|
+
end
|
401
|
+
|
402
|
+
|
403
|
+
def create_process(dir, opts = {})
|
404
|
+
RebaseToMaster.new(dir, opts.merge({:prNumber => var,
|
405
|
+
:server => pull_request[:head][:remote]}))
|
406
|
+
end
|
407
|
+
|
408
|
+
|
409
|
+
it "should checkout the branch for the pull request" do
|
410
|
+
clone_repo('master', head_repo_name) do |gl|
|
411
|
+
add_remote(:base, gl)
|
412
|
+
gl.branch("#{base_repo_name}/#{base_branch_name}", :base_branch => "#{head_repo_name}/master")
|
413
|
+
|
414
|
+
configure(gl)
|
415
|
+
|
416
|
+
rtm = GitProc::RebaseToMaster.new(gl, :log_level => log_level, :prNumber => pull_request_number)
|
417
|
+
|
418
|
+
gl.should_receive(:push).with(head_repo_name, head_branch_name, 'master')
|
419
|
+
gl.should_receive(:push).with(head_repo_name, nil, nil, :delete => head_branch_name)
|
420
|
+
|
421
|
+
rtm.runner
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
329
425
|
end
|
330
426
|
|
331
427
|
end
|