git-process-lib 2.0.4 → 3.0.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +16 -1
- data/Gemfile +15 -15
- data/Gemfile.lock +59 -44
- data/LICENSE +1 -1
- data/{README.md → README.adoc} +101 -93
- data/git-new-fb.gemspec +7 -7
- data/git-process-lib.gemspec +12 -15
- data/git-process.gemspec +10 -10
- data/git-pull-req.gemspec +7 -7
- data/git-sync.gemspec +7 -7
- data/git-to-master.gemspec +7 -7
- data/lib/git-process/git_branch.rb +41 -2
- data/lib/git-process/git_branches.rb +1 -1
- data/lib/git-process/git_config.rb +16 -6
- data/lib/git-process/git_lib.rb +305 -92
- data/lib/git-process/git_logger.rb +17 -22
- data/lib/git-process/git_process.rb +13 -6
- data/lib/git-process/git_remote.rb +34 -6
- data/lib/git-process/github_configuration.rb +156 -47
- data/lib/git-process/github_pull_request.rb +64 -10
- data/lib/git-process/pull_request.rb +5 -5
- data/lib/git-process/version.rb +2 -2
- data/local-build.rb +6 -2
- data/spec/changed_file_helper_spec.rb +1 -1
- data/spec/git_branch_spec.rb +35 -0
- data/spec/git_lib_spec.rb +32 -9
- data/spec/git_process_spec.rb +34 -26
- data/spec/git_remote_spec.rb +2 -2
- data/spec/github_configuration_spec.rb +67 -16
- data/spec/github_pull_request_spec.rb +18 -17
- data/spec/github_test_helper.rb +59 -5
- data/spec/new_fb_spec.rb +14 -14
- data/spec/pull_request_helper.rb +2 -2
- data/spec/pull_request_spec.rb +13 -11
- data/spec/rebase_to_master_spec.rb +10 -10
- data/spec/sync_spec.rb +20 -3
- metadata +114 -155
data/spec/pull_request_helper.rb
CHANGED
@@ -3,8 +3,8 @@ module PullRequestHelper
|
|
3
3
|
def create_pull_request(opts = {})
|
4
4
|
v = {
|
5
5
|
:head_remote => 'testrepo',
|
6
|
-
:head_repo => 'test_repo',
|
7
|
-
:base_repo => 'test_repo',
|
6
|
+
:head_repo => 'tester/test_repo',
|
7
|
+
:base_repo => 'tester/test_repo',
|
8
8
|
:head_branch => 'test_branch',
|
9
9
|
:base_branch => 'source_branch',
|
10
10
|
:api_url => 'https://api.github.com',
|
data/spec/pull_request_spec.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'git-process/pull_request'
|
2
|
-
#require 'git-process/github_configuration'
|
3
2
|
require 'github_test_helper'
|
4
3
|
require 'pull_request_helper'
|
5
4
|
require 'GitRepoHelper'
|
6
|
-
require '
|
5
|
+
require 'sawyer'
|
6
|
+
require 'octokit'
|
7
7
|
|
8
8
|
|
9
9
|
describe GitProc::PullRequest do
|
@@ -41,13 +41,15 @@ describe GitProc::PullRequest do
|
|
41
41
|
GitProc::PullRequest.stub(:create_pull_request_client).and_return(pr_client)
|
42
42
|
#PullRequest.stub(:create_pull_request_client).with(anything, 'origin', 'jdigger/git-process').and_return(pr_client)
|
43
43
|
gitlib.should_receive(:push)
|
44
|
-
|
44
|
+
agent = Sawyer::Agent.new(Octokit::Default::API_ENDPOINT, {})
|
45
|
+
sawyer_resource = Sawyer::Resource.new(agent, {:html_url => 'http://test'})
|
46
|
+
pr_client.should_receive(:create).with('develop', 'master', 'master', '').and_return(sawyer_resource)
|
45
47
|
|
46
48
|
gitprocess.runner
|
47
49
|
end
|
48
50
|
|
49
51
|
|
50
|
-
it
|
52
|
+
it 'should fail if the base and head branch are the same' do
|
51
53
|
gitlib.remote.add('origin', 'git@github.com:jdigger/git-process.git')
|
52
54
|
|
53
55
|
expect {
|
@@ -79,7 +81,7 @@ describe GitProc::PullRequest do
|
|
79
81
|
end
|
80
82
|
|
81
83
|
|
82
|
-
it
|
84
|
+
it 'should checkout the branch for the pull request' do
|
83
85
|
add_remote(:head)
|
84
86
|
stub_fetch(:head)
|
85
87
|
|
@@ -88,9 +90,9 @@ describe GitProc::PullRequest do
|
|
88
90
|
expect_checkout_pr_head()
|
89
91
|
expect_upstream_set()
|
90
92
|
|
91
|
-
gitlib.stub(:branch).with(nil, :no_color => true, :all => true).and_return(
|
92
|
-
gitlib.stub(:branch).with(nil, :no_color => true, :remote => true).and_return(
|
93
|
-
gitlib.should_receive(:rebase).with('test_repo/master', {})
|
93
|
+
gitlib.stub(:branch).with(nil, :no_color => true, :all => true).and_return('')
|
94
|
+
gitlib.stub(:branch).with(nil, :no_color => true, :remote => true).and_return('')
|
95
|
+
gitlib.should_receive(:rebase).with('tester/test_repo/master', {})
|
94
96
|
|
95
97
|
gitprocess.runner
|
96
98
|
end
|
@@ -98,7 +100,7 @@ describe GitProc::PullRequest do
|
|
98
100
|
end
|
99
101
|
|
100
102
|
|
101
|
-
describe
|
103
|
+
describe 'with repo name and PR #' do
|
102
104
|
|
103
105
|
def pull_request
|
104
106
|
@pr ||= create_pull_request(:base_remote => 'sourcerepo', :base_repo => 'source_repo')
|
@@ -111,7 +113,7 @@ describe GitProc::PullRequest do
|
|
111
113
|
end
|
112
114
|
|
113
115
|
|
114
|
-
it
|
116
|
+
it 'should checkout the branch for the pull request' do
|
115
117
|
add_remote(:head)
|
116
118
|
add_remote(:base)
|
117
119
|
stub_fetch(:head)
|
@@ -125,7 +127,7 @@ describe GitProc::PullRequest do
|
|
125
127
|
|
126
128
|
gitlib.stub(:branch).with(nil, :no_color => true, :all => true).and_return('')
|
127
129
|
gitlib.stub(:branch).with(nil, :no_color => true, :remote => true).and_return('')
|
128
|
-
gitlib.should_receive(:rebase).with('test_repo/master', {})
|
130
|
+
gitlib.should_receive(:rebase).with('tester/test_repo/master', {})
|
129
131
|
|
130
132
|
gitprocess.runner
|
131
133
|
end
|
@@ -106,7 +106,7 @@ describe RebaseToMaster do
|
|
106
106
|
gl.checkout('ab', :new_branch => 'origin/int-br')
|
107
107
|
|
108
108
|
my_branches = gl.branches
|
109
|
-
my_branches.include?('origin/master').should
|
109
|
+
my_branches.include?('origin/master').should be false
|
110
110
|
my_branches['ab'].sha.should == my_branches['origin/int-br'].sha
|
111
111
|
|
112
112
|
gl.stub(:repo_name).and_return('test_repo')
|
@@ -175,11 +175,11 @@ describe RebaseToMaster do
|
|
175
175
|
change_file_and_commit('a', '', gl)
|
176
176
|
gl.checkout('fb', :new_branch => 'origin/master')
|
177
177
|
|
178
|
-
gl.branches.include?('_parking_OLD_').should
|
178
|
+
gl.branches.include?('_parking_OLD_').should be false
|
179
179
|
|
180
180
|
create_process(gl).remove_feature_branch
|
181
181
|
|
182
|
-
gl.branches.include?('_parking_OLD_').should
|
182
|
+
gl.branches.include?('_parking_OLD_').should be true
|
183
183
|
gl.branches.current.name.should == '_parking_'
|
184
184
|
end
|
185
185
|
end
|
@@ -192,11 +192,11 @@ describe RebaseToMaster do
|
|
192
192
|
change_file_and_commit('a', '', gl)
|
193
193
|
|
194
194
|
gl.checkout('fb', :new_branch => 'origin/master')
|
195
|
-
gl.branches.include?('fb').should
|
195
|
+
gl.branches.include?('fb').should be true
|
196
196
|
|
197
197
|
create_process(gl).remove_feature_branch
|
198
198
|
|
199
|
-
gl.branches.include?('fb').should
|
199
|
+
gl.branches.include?('fb').should be false
|
200
200
|
gl.branches.current.name.should == '_parking_'
|
201
201
|
end
|
202
202
|
end
|
@@ -207,7 +207,7 @@ describe RebaseToMaster do
|
|
207
207
|
gl.checkout('fb', :new_branch => 'origin/master')
|
208
208
|
change_file_and_commit('a', '', gl)
|
209
209
|
|
210
|
-
gl.branches.include?('fb').should
|
210
|
+
gl.branches.include?('fb').should be true
|
211
211
|
|
212
212
|
expect { create_process(gl).remove_feature_branch }.to raise_error GitProcessError
|
213
213
|
end
|
@@ -220,10 +220,10 @@ describe RebaseToMaster do
|
|
220
220
|
gitlib.branch('fb', :base_branch => 'master')
|
221
221
|
|
222
222
|
clone_repo('fb') do |gl|
|
223
|
-
gl.branches.include?('origin/fb').should
|
223
|
+
gl.branches.include?('origin/fb').should be true
|
224
224
|
create_process(gl).remove_feature_branch
|
225
|
-
gl.branches.include?('origin/fb').should
|
226
|
-
gitlib.branches.include?('fb').should
|
225
|
+
gl.branches.include?('origin/fb').should be false
|
226
|
+
gitlib.branches.include?('fb').should be false
|
227
227
|
gl.branches.current.name.should == '_parking_'
|
228
228
|
end
|
229
229
|
end
|
@@ -292,7 +292,7 @@ describe RebaseToMaster do
|
|
292
292
|
stub_fetch(:base, gl)
|
293
293
|
|
294
294
|
stub_get("https://api.github.com/repos/#{head_repo_name}/pulls/#{pull_request_number}", :body => pull_request)
|
295
|
-
stub_patch("https://api.github.com/repos/#{head_repo_name}/pulls/#{pull_request_number}")
|
295
|
+
stub_patch("https://api.github.com/repos/#{head_repo_name}/pulls/#{pull_request_number}", :body => pull_request)
|
296
296
|
end
|
297
297
|
|
298
298
|
|
data/spec/sync_spec.rb
CHANGED
@@ -65,6 +65,23 @@ describe Sync do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
it 'should work when the branch name contains a slash' do
|
69
|
+
Given do
|
70
|
+
origin 'user/fb', :new_branch => 'master'
|
71
|
+
create_commit :b
|
72
|
+
local 'user/fb', :new_branch => 'origin/user/fb'
|
73
|
+
create_commit :c
|
74
|
+
end
|
75
|
+
|
76
|
+
@local.checkout('user/fb')
|
77
|
+
create_process(@local).runner
|
78
|
+
|
79
|
+
Then do
|
80
|
+
branch_tip(local_repo, 'user/fb').should == branch_tip(origin_repo, 'user/fb')
|
81
|
+
branch_tip(local_repo, 'user/fb').should == @local.sha('origin/user/fb')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
68
85
|
|
69
86
|
describe 'when forcing the push with a merge' do
|
70
87
|
|
@@ -1256,12 +1273,12 @@ describe Sync do
|
|
1256
1273
|
|
1257
1274
|
clone_repo('fb', 'a_remote') do |gl|
|
1258
1275
|
change_file_and_commit('a', 'hello', gl)
|
1259
|
-
gl.branches.include?('a_remote/fb').should
|
1276
|
+
gl.branches.include?('a_remote/fb').should be true
|
1260
1277
|
|
1261
1278
|
GitProc::Sync.new(gl, :rebase => false, :force => false, :log_level => log_level).runner
|
1262
1279
|
|
1263
|
-
gl.branches.include?('a_remote/fb').should
|
1264
|
-
gitlib.branches.include?('fb').should
|
1280
|
+
gl.branches.include?('a_remote/fb').should be true
|
1281
|
+
gitlib.branches.include?('fb').should be true
|
1265
1282
|
end
|
1266
1283
|
end
|
1267
1284
|
|
metadata
CHANGED
@@ -1,161 +1,131 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-process-lib
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 2.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Jim Moore
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2016-03-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: octokit
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 119
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 24
|
33
|
-
- 0
|
34
|
-
version: 1.24.0
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.3'
|
35
20
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: json
|
39
21
|
prerelease: false
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: netrc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.11'
|
50
34
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: multi_json
|
54
35
|
prerelease: false
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.11'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.8'
|
65
48
|
type: :runtime
|
66
|
-
version_requirements: *id003
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: trollop
|
69
49
|
prerelease: false
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: trollop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.1'
|
80
62
|
type: :runtime
|
81
|
-
version_requirements: *id004
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: highline
|
84
63
|
prerelease: false
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: highline
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.7'
|
96
76
|
type: :runtime
|
97
|
-
version_requirements: *id005
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: addressable
|
100
77
|
prerelease: false
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.7'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: addressable
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.3.5
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '2.4'
|
111
93
|
type: :runtime
|
112
|
-
version_requirements: *id006
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: gem-man
|
115
94
|
prerelease: false
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 2.3.5
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '2.4'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: gem-man
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.3'
|
126
110
|
type: :runtime
|
127
|
-
version_requirements: *id007
|
128
|
-
- !ruby/object:Gem::Dependency
|
129
|
-
name: faraday
|
130
111
|
prerelease: false
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
hash: 45
|
137
|
-
segments:
|
138
|
-
- 0
|
139
|
-
- 8
|
140
|
-
- 9
|
141
|
-
version: 0.8.9
|
142
|
-
type: :runtime
|
143
|
-
version_requirements: *id008
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0.3'
|
144
117
|
description: The libraries for the git-process suite of tools
|
145
|
-
email:
|
118
|
+
email:
|
146
119
|
- moore.jim@gmail.com
|
147
120
|
executables: []
|
148
|
-
|
149
121
|
extensions: []
|
150
|
-
|
151
122
|
extra_rdoc_files: []
|
152
|
-
|
153
|
-
files:
|
123
|
+
files:
|
154
124
|
- CHANGELOG.md
|
155
125
|
- Gemfile
|
156
126
|
- Gemfile.lock
|
157
127
|
- LICENSE
|
158
|
-
- README.
|
128
|
+
- README.adoc
|
159
129
|
- Rakefile
|
160
130
|
- bin/git-new-fb
|
161
131
|
- bin/git-pull-req
|
@@ -219,43 +189,31 @@ files:
|
|
219
189
|
- spec/rebase_to_master_spec.rb
|
220
190
|
- spec/spec_helper.rb
|
221
191
|
- spec/sync_spec.rb
|
222
|
-
has_rdoc: true
|
223
192
|
homepage: http://jdigger.github.com/git-process/
|
224
|
-
licenses:
|
225
|
-
-
|
193
|
+
licenses:
|
194
|
+
- Apache-2.0
|
195
|
+
metadata: {}
|
226
196
|
post_install_message:
|
227
197
|
rdoc_options: []
|
228
|
-
|
229
|
-
require_paths:
|
198
|
+
require_paths:
|
230
199
|
- lib
|
231
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
232
|
-
|
233
|
-
requirements:
|
200
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
234
202
|
- - ">="
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
- 8
|
240
|
-
- 7
|
241
|
-
version: 1.8.7
|
242
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
|
-
none: false
|
244
|
-
requirements:
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '2.0'
|
205
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
245
207
|
- - ">="
|
246
|
-
- !ruby/object:Gem::Version
|
247
|
-
|
248
|
-
segments:
|
249
|
-
- 0
|
250
|
-
version: "0"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0'
|
251
210
|
requirements: []
|
252
|
-
|
253
211
|
rubyforge_project:
|
254
|
-
rubygems_version:
|
212
|
+
rubygems_version: 2.5.1
|
255
213
|
signing_key:
|
256
|
-
specification_version:
|
214
|
+
specification_version: 4
|
257
215
|
summary: The libraries for the git-process suite of tools
|
258
|
-
test_files:
|
216
|
+
test_files:
|
259
217
|
- spec/FileHelpers.rb
|
260
218
|
- spec/GitRepoHelper.rb
|
261
219
|
- spec/changed_file_helper_spec.rb
|
@@ -276,3 +234,4 @@ test_files:
|
|
276
234
|
- spec/rebase_to_master_spec.rb
|
277
235
|
- spec/spec_helper.rb
|
278
236
|
- spec/sync_spec.rb
|
237
|
+
has_rdoc:
|