git-process 1.1.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/CHANGELOG.md +14 -1
  2. data/LICENSE +193 -22
  3. data/README.md +212 -71
  4. data/man/git-process.1 +371 -0
  5. metadata +52 -140
  6. data/Gemfile +0 -20
  7. data/Gemfile.lock +0 -53
  8. data/Rakefile +0 -16
  9. data/bin/git-new-fb +0 -58
  10. data/bin/git-pull-request +0 -107
  11. data/bin/git-sync +0 -73
  12. data/bin/git-to-master +0 -133
  13. data/git-process.gemspec +0 -25
  14. data/lib/git-process/abstract_error_builder.rb +0 -53
  15. data/lib/git-process/changed_file_helper.rb +0 -115
  16. data/lib/git-process/git_abstract_merge_error_builder.rb +0 -146
  17. data/lib/git-process/git_branch.rb +0 -105
  18. data/lib/git-process/git_branches.rb +0 -73
  19. data/lib/git-process/git_config.rb +0 -153
  20. data/lib/git-process/git_lib.rb +0 -512
  21. data/lib/git-process/git_logger.rb +0 -84
  22. data/lib/git-process/git_merge_error.rb +0 -28
  23. data/lib/git-process/git_process.rb +0 -172
  24. data/lib/git-process/git_process_error.rb +0 -18
  25. data/lib/git-process/git_process_options.rb +0 -99
  26. data/lib/git-process/git_rebase_error.rb +0 -30
  27. data/lib/git-process/git_remote.rb +0 -256
  28. data/lib/git-process/git_status.rb +0 -108
  29. data/lib/git-process/github_configuration.rb +0 -298
  30. data/lib/git-process/github_pull_request.rb +0 -151
  31. data/lib/git-process/new_fb.rb +0 -50
  32. data/lib/git-process/parked_changes_error.rb +0 -41
  33. data/lib/git-process/pull_request.rb +0 -134
  34. data/lib/git-process/pull_request_error.rb +0 -25
  35. data/lib/git-process/rebase_to_master.rb +0 -148
  36. data/lib/git-process/sync.rb +0 -136
  37. data/lib/git-process/uncommitted_changes_error.rb +0 -23
  38. data/lib/git-process/version.rb +0 -22
  39. data/spec/FileHelpers.rb +0 -19
  40. data/spec/GitRepoHelper.rb +0 -123
  41. data/spec/changed_file_helper_spec.rb +0 -127
  42. data/spec/git_abstract_merge_error_builder_spec.rb +0 -126
  43. data/spec/git_branch_spec.rb +0 -123
  44. data/spec/git_config_spec.rb +0 -45
  45. data/spec/git_lib_spec.rb +0 -176
  46. data/spec/git_logger_spec.rb +0 -66
  47. data/spec/git_process_spec.rb +0 -208
  48. data/spec/git_remote_spec.rb +0 -227
  49. data/spec/git_status_spec.rb +0 -122
  50. data/spec/github_configuration_spec.rb +0 -152
  51. data/spec/github_pull_request_spec.rb +0 -96
  52. data/spec/github_test_helper.rb +0 -49
  53. data/spec/new_fb_spec.rb +0 -130
  54. data/spec/pull_request_helper.rb +0 -94
  55. data/spec/pull_request_spec.rb +0 -128
  56. data/spec/rebase_to_master_spec.rb +0 -429
  57. data/spec/spec_helper.rb +0 -21
  58. data/spec/sync_spec.rb +0 -304
data/spec/sync_spec.rb DELETED
@@ -1,304 +0,0 @@
1
- require 'git-process/sync'
2
- require 'GitRepoHelper'
3
-
4
- describe Sync do
5
- include GitRepoHelper
6
-
7
- before(:each) do
8
- create_files(%w(.gitignore))
9
- gitlib.commit('initial')
10
- end
11
-
12
-
13
- after(:each) do
14
- rm_rf(gitlib.workdir)
15
- end
16
-
17
-
18
- def log_level
19
- Logger::ERROR
20
- end
21
-
22
-
23
- def create_process(base = gitlib, opts = {})
24
- GitProc::Sync.new(base, opts.merge({:rebase => false, :force => false}))
25
- end
26
-
27
-
28
- it 'should work when pushing with fast-forward' do
29
- change_file_and_commit('a', '')
30
-
31
- gitlib.branch('fb', :base_branch => 'master')
32
-
33
- clone_repo('fb') do |gl|
34
- change_file_and_commit('a', 'hello', gl)
35
- gl.branches.include?('origin/fb').should be_true
36
- GitProc::Sync.new(gl, :rebase => false, :force => false, :log_level => log_level).runner
37
- gl.branches.include?('origin/fb').should be_true
38
- gitlib.branches.include?('fb').should be_true
39
- end
40
- end
41
-
42
-
43
- it "should work with a different remote server name" do
44
- change_file_and_commit('a', '')
45
-
46
- gitlib.branch('fb', :base_branch => 'master')
47
-
48
- clone_repo('fb', 'a_remote') do |gl|
49
- change_file_and_commit('a', 'hello', gl)
50
- gl.branches.include?('a_remote/fb').should be_true
51
- GitProc::Sync.new(gl, :rebase => false, :force => false, :log_level => log_level).runner
52
- gl.branches.include?('a_remote/fb').should be_true
53
- gitlib.branches.include?('fb').should be_true
54
- end
55
- end
56
-
57
-
58
- describe 'when forcing the push' do
59
-
60
- def create_process(gitlib, opts)
61
- GitProc::Sync.new(gitlib, opts.merge({:rebase => false, :force => true}))
62
- end
63
-
64
-
65
- it "should work when pushing with non-fast-forward" do
66
- change_file_and_commit('a', '')
67
-
68
- gitlib.branch('fb', :base_branch => 'master')
69
-
70
- clone_repo('fb') do |gl|
71
- gitlib.checkout('fb') do
72
- change_file_and_commit('a', 'hello', gitlib)
73
- end
74
-
75
- expect {
76
- GitProc::Sync.new(gl, :rebase => false, :force => true, :log_level => log_level).runner
77
- }.to_not raise_error GitExecuteError
78
- end
79
- end
80
-
81
- end
82
-
83
-
84
- describe "when changes are made upstream" do
85
-
86
- def create_process(base, opts = {})
87
- GitProc::Sync.new(base, opts.merge({:rebase => false, :force => false}))
88
- end
89
-
90
-
91
- it "should work when pushing with non-fast-forward by merging" do
92
- change_file_and_commit('a', '')
93
-
94
- gitlib.branch('fb', :base_branch => 'master')
95
-
96
- clone_repo('fb') do |gl|
97
- gitlib.checkout('fb') do
98
- change_file_and_commit('a', 'hello', gitlib)
99
- end
100
-
101
- expect {
102
- create_process(gl).runner
103
- }.to_not raise_error GitExecuteError
104
- end
105
- end
106
-
107
- end
108
-
109
-
110
- describe "when rebasing" do
111
-
112
- def create_process(gitlib, opts = {})
113
- GitProc::Sync.new(gitlib, opts.merge({:rebase => true, :force => false}))
114
- end
115
-
116
-
117
- it "should work when pushing (non-fast-forward)" do
118
- change_file_and_commit('a', '')
119
-
120
- clone_repo do |gl|
121
- gl.checkout('fb', :new_branch => 'master')
122
-
123
- expect { create_process(gl).runner }.to_not raise_error GitExecuteError
124
-
125
- change_file_and_commit('a', 'hello', gitlib)
126
-
127
- expect { create_process(gl).runner }.to_not raise_error GitExecuteError
128
- end
129
- end
130
-
131
-
132
- it "should merge and then rebase if remote feature branch changed" do
133
- change_file_and_commit('a', '')
134
-
135
- gitlib.checkout('fb', :new_branch => 'master')
136
-
137
- clone_repo do |gl|
138
- gl.checkout('fb', :new_branch => 'origin/master')
139
-
140
- change_file_and_commit('b', 'hello', gl)
141
- change_file_and_commit('a', 'hello', gitlib)
142
- change_file_and_commit('b', 'goodbye', gl)
143
- change_file_and_commit('a', 'goodbye', gitlib)
144
- gitlib.checkout('master')
145
-
146
- expect { create_process(gl).runner }.to_not raise_error GitExecuteError
147
- end
148
- end
149
-
150
- end
151
-
152
-
153
- describe "when forcing local-only" do
154
-
155
- def create_process(dir, opts)
156
- GitProc::Sync.new(dir, opts.merge({:rebase => true, :force => false, :local => true}))
157
- end
158
-
159
-
160
- it "should not try to push" do
161
- change_file_and_commit('a', '')
162
-
163
- gitlib.branch('fb', :base_branch => 'master')
164
-
165
- clone_repo('fb') do |gl|
166
- gitlib.checkout('fb')
167
- change_file_and_commit('a', 'hello', gitlib)
168
-
169
- sp = GitProc::Sync.new(gl, :rebase => true, :force => false, :local => true, :log_level => log_level)
170
- gl.should_receive(:fetch) # want to get remote changes
171
- gl.should_not_receive(:push) # ...but not push any
172
-
173
- sp.runner
174
- end
175
- end
176
-
177
- end
178
-
179
-
180
- describe "when there is no remote" do
181
-
182
- def create_process(base, opts)
183
- GitProc::Sync.new(base, opts.merge({:rebase => true, :force => false, :local => false}))
184
- end
185
-
186
-
187
- it "should not try to fetch or push" do
188
- change_file_and_commit('a', '')
189
-
190
- gitlib.branch('fb', :base_branch => 'master')
191
-
192
- sp = GitProc::Sync.new(gitlib, :rebase => true, :force => false, :local => true, :log_level => log_level)
193
- gitlib.should_not_receive(:fetch)
194
- gitlib.should_not_receive(:push)
195
-
196
- sp.runner
197
- end
198
-
199
- end
200
-
201
-
202
- describe "when default rebase flag is used" do
203
-
204
- def create_process(base = gitlib, opts = {})
205
- GitProc::Sync.new(base, opts.merge({:rebase => false, :force => false, :local => false}))
206
- end
207
-
208
-
209
- it "should try to rebase by flag" do
210
- change_file_and_commit('a', '', gitlib)
211
-
212
- gitlib.branch('fb', :base_branch => 'master')
213
-
214
- sp = GitProc::Sync.new(gitlib, :rebase => true, :force => false, :local => true, :log_level => log_level)
215
- gitlib.should_receive(:rebase)
216
- gitlib.should_not_receive(:merge)
217
-
218
- sp.runner
219
- end
220
-
221
-
222
- it "should try to rebase by config" do
223
- change_file_and_commit('a', '', gitlib)
224
-
225
- gitlib.branch('fb', :base_branch => 'master')
226
- gitlib.config['gitProcess.defaultRebaseSync'] = 'true'
227
-
228
- sp = GitProc::Sync.new(gitlib, :rebase => false, :force => false, :local => true, :log_level => log_level)
229
- gitlib.should_receive(:rebase)
230
- gitlib.should_not_receive(:merge)
231
-
232
- sp.runner
233
- end
234
-
235
-
236
- it "should not try to rebase by false config" do
237
- change_file_and_commit('a', '', gitlib)
238
-
239
- gitlib.branch('fb', :base_branch => 'master')
240
- gitlib.config['gitProcess.defaultRebaseSync'] = 'false'
241
-
242
- sp = GitProc::Sync.new(gitlib, :rebase => false, :force => false, :local => true, :log_level => log_level)
243
- gitlib.should_not_receive(:rebase)
244
- gitlib.should_receive(:merge)
245
-
246
- sp.runner
247
- end
248
-
249
-
250
- it "should not try to rebase by false config" do
251
- change_file_and_commit('a', '', gitlib)
252
-
253
- gitlib.branch('fb', :base_branch => 'master')
254
- gitlib.config['gitProcess.defaultRebaseSync'] = 'false'
255
-
256
- sp = GitProc::Sync.new(gitlib, :rebase => false, :force => false, :local => true, :log_level => log_level)
257
- gitlib.should_not_receive(:rebase)
258
- gitlib.should_receive(:merge)
259
-
260
- sp.runner
261
- end
262
-
263
-
264
- it "should try to rebase by true config" do
265
- change_file_and_commit('a', '', gitlib)
266
-
267
- gitlib.branch('fb', :base_branch => 'master')
268
- gitlib.config['gitProcess.defaultRebaseSync'] = 'true'
269
-
270
- sp = GitProc::Sync.new(gitlib, :rebase => false, :force => false, :local => true, :log_level => log_level)
271
- gitlib.should_receive(:rebase)
272
- gitlib.should_not_receive(:merge)
273
-
274
- sp.runner
275
- end
276
-
277
- end
278
-
279
-
280
- it "should work with a different remote server name than 'origin'" do
281
- change_file_and_commit('a', '')
282
-
283
- gitlib.branch('fb', :base_branch => 'master')
284
-
285
- clone_repo('fb', 'a_remote') do |gl|
286
- change_file_and_commit('a', 'hello', gl)
287
- gl.branches.include?('a_remote/fb').should be_true
288
-
289
- GitProc::Sync.new(gl, :rebase => false, :force => false, :log_level => log_level).runner
290
-
291
- gl.branches.include?('a_remote/fb').should be_true
292
- gitlib.branches.include?('fb').should be_true
293
- end
294
- end
295
-
296
-
297
- it 'should fail when removing current feature while on _parking_' do
298
- gitlib.checkout('_parking_', :new_branch => 'master')
299
- change_file_and_commit('a', '')
300
-
301
- expect { gitprocess.verify_preconditions }.to raise_error ParkedChangesError
302
- end
303
-
304
- end