gitx 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f363b92a7270ced1b7e223e2bed065c03a57fdd71c039345d582b87cca05ed05
4
- data.tar.gz: 6df469f9e3875c42ce1e6b9267fee73606cbc0ad17caa51a856dbbbe2b18847d
3
+ metadata.gz: 59f45788834b6e13ec3fd859fe45cde1d4f84f1205866f0b72dd6800d40b6e5d
4
+ data.tar.gz: a08cd9beca1c16bc02f5654ed056e7e93d89e21df5914cb7507c04d679b6f1ec
5
5
  SHA512:
6
- metadata.gz: 99b0b5cbdc523dc710533a84f921868e0db1067fab2500e9314030e0332a636f00ee8ca63f71fe8b147ea48ac3d43653590d7fdc906bb7aff21a9a9134d91d0a
7
- data.tar.gz: a7aacec3a63f9cbbab844663cd4ad5cab48ba6745278790bffb156ef87667b35c23889c250acf71bbe382140583025757a73fd501f04c6de0dedc421fc40b4da
6
+ metadata.gz: 8d464966f06a39cadd33a9830130c5f25edbed7eccba994ce96fee827a1f8e9cdaa75dd4c3553338774b15fb5de2ce5185882034e506c6057b6d1a12f92b67d9
7
+ data.tar.gz: ac922c59dae45ed1d87c5e86c719628e2dfc55d13daffb9b9891cc01ced3672573c2916dbb6b9290fe8ae6ef5fe846322d71e574bf7c092bf39c32f249c35a22
@@ -9,6 +9,7 @@ module Gitx
9
9
  class IntegrateCommand < BaseCommand
10
10
  include Gitx::Github
11
11
  desc 'integrate', 'integrate the current branch into one of the aggregate development branches (default = staging)'
12
+ method_option :'skip-pull-request', type: :boolean, desc: 'skip pull request reference in merge commit'
12
13
  method_option :resume, type: :string, aliases: '-r', desc: 'resume merging of feature-branch'
13
14
  def integrate(integration_branch = 'staging')
14
15
  assert_aggregate_branch!(integration_branch)
@@ -17,7 +18,7 @@ module Gitx
17
18
  print_message(branch, integration_branch)
18
19
 
19
20
  run_git_cmd 'update'
20
- pull_request = pull_request_for_branch(branch)
21
+ pull_request = pull_request_for_branch(branch) unless options[:'skip-pull-request']
21
22
  integrate_branch(branch, integration_branch, pull_request) unless options[:resume]
22
23
  checkout_branch branch
23
24
  end
@@ -20,11 +20,11 @@ module Gitx
20
20
  run_git_cmd 'update'
21
21
 
22
22
  pull_request = find_or_create_pull_request(branch)
23
- return unless confirm_branch_status?(branch)
24
23
 
25
24
  if (label = config.release_label)
26
25
  label_pull_request pull_request, label
27
26
  else
27
+ return unless confirm_branch_status?(branch)
28
28
  checkout_branch config.base_branch
29
29
  run_git_cmd 'pull', 'origin', config.base_branch
30
30
  run_git_cmd 'merge', '--no-ff', '--message', commit_message(branch, pull_request), branch
@@ -12,15 +12,24 @@ module Gitx
12
12
  say 'with latest changes from '
13
13
  say config.base_branch, :green
14
14
 
15
+ update_base_branch
15
16
  update_branch(current_branch.name) if remote_branch_exists?(current_branch.name)
16
- update_branch(config.base_branch)
17
+ update_branch(config.base_branch, repository: '.')
18
+
17
19
  run_git_cmd 'share'
18
20
  end
19
21
 
20
22
  private
21
23
 
22
- def update_branch(branch)
23
- run_git_cmd 'pull', 'origin', branch
24
+ def update_base_branch
25
+ branch_name = current_branch.name
26
+ checkout_branch(config.base_branch)
27
+ update_branch(config.base_branch)
28
+ checkout_branch(branch_name)
29
+ end
30
+
31
+ def update_branch(branch, repository: 'origin')
32
+ run_git_cmd 'pull', repository, branch
24
33
  rescue Gitx::Executor::ExecutionError
25
34
  raise MergeError, 'Merge conflict occurred. Please fix merge conflict and rerun the command'
26
35
  end
@@ -26,4 +26,4 @@ taggable_branches:
26
26
 
27
27
  # list of commands to execute after releasing feature branch
28
28
  after_release:
29
- - git integrate
29
+ - git integrate --skip-pull-request
data/lib/gitx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gitx
2
- VERSION = '4.0.0'.freeze
2
+ VERSION = '4.1.0'.freeze
3
3
  end
@@ -78,74 +78,6 @@ http_interactions:
78
78
  string: '[{"html_url":"https://path/to/html/pull/request","issue_url":"https://api/path/to/issue/url","number":10,"head":{"ref":"branch_name", "sha": "e12da4"}}]'
79
79
  http_version:
80
80
  recorded_at: Tue, 05 Aug 2014 16:36:03 GMT
81
- - request:
82
- method: get
83
- uri: https://api.github.com/repos/wireframe/gitx/commits/feature-branch/status
84
- body:
85
- encoding: US-ASCII
86
- string: ''
87
- headers:
88
- Accept:
89
- - application/vnd.github.v3+json
90
- User-Agent:
91
- - Octokit Ruby Gem 3.4.0
92
- Content-Type:
93
- - application/json
94
- Authorization:
95
- - token 123123
96
- Accept-Encoding:
97
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
98
- response:
99
- status:
100
- code: 200
101
- message: OK
102
- headers:
103
- Server:
104
- - GitHub.com
105
- Date:
106
- - Wed, 10 Dec 2014 19:01:27 GMT
107
- Content-Type:
108
- - application/json; charset=utf-8
109
- Transfer-Encoding:
110
- - chunked
111
- Status:
112
- - 200 OK
113
- X-Ratelimit-Limit:
114
- - '5000'
115
- X-Ratelimit-Remaining:
116
- - '4993'
117
- X-Ratelimit-Reset:
118
- - '1418241620'
119
- X-Oauth-Scopes:
120
- - repo
121
- X-Accepted-Oauth-Scopes:
122
- - repo, repo:status
123
- X-Github-Media-Type:
124
- - github.v3; format=json
125
- X-Xss-Protection:
126
- - 1; mode=block
127
- X-Frame-Options:
128
- - deny
129
- Content-Security-Policy:
130
- - default-src 'none'
131
- Access-Control-Allow-Credentials:
132
- - 'true'
133
- Access-Control-Expose-Headers:
134
- - ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
135
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
136
- Access-Control-Allow-Origin:
137
- - "*"
138
- X-Github-Request-Id:
139
- - C6CBAFAF:141D:2F27072:54889887
140
- Strict-Transport-Security:
141
- - max-age=31536000; includeSubdomains; preload
142
- X-Content-Type-Options:
143
- - nosniff
144
- body:
145
- encoding: UTF-8
146
- string: '{"state":"success"}'
147
- http_version:
148
- recorded_at: Tue, 05 Aug 2014 16:36:03 GMT
149
81
  - request:
150
82
  method: post
151
83
  uri: https://api.github.com/repos/wireframe/gitx/issues/10/labels
@@ -214,5 +214,29 @@ describe Gitx::Cli::IntegrateCommand do
214
214
  should meet_expectations
215
215
  end
216
216
  end
217
+ context 'with --skip-pull-request' do
218
+ let(:changelog) { '* made some fixes' }
219
+ let(:changelog) { '2013-01-01 did some stuff' }
220
+ let(:options) { { 'skip-pull-request': true } }
221
+ before do
222
+ allow(cli).to receive(:ask_editor).and_return('description')
223
+
224
+ expect(executor).to receive(:execute).with('git', 'update').ordered
225
+ expect(executor).to receive(:execute).with('git', 'fetch', 'origin').ordered
226
+ expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'staging').ordered
227
+ expect(executor).to receive(:execute).with('git', 'checkout', 'staging').ordered
228
+ expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Integrate feature-branch into staging', 'feature-branch').ordered
229
+ expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
230
+ expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
231
+
232
+ cli.integrate
233
+ end
234
+ it 'does not create pull request' do
235
+ expect(WebMock).to_not have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/pulls')
236
+ end
237
+ it 'runs expected commands' do
238
+ should meet_expectations
239
+ end
240
+ end
217
241
  end
218
242
  end
@@ -68,7 +68,7 @@ describe Gitx::Cli::ReleaseCommand do
68
68
  expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
69
69
  expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
70
70
  expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
71
- expect(executor).to receive(:execute).with('git integrate').ordered
71
+ expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
72
72
 
73
73
  VCR.use_cassette('pull_request_does_exist_with_success_status') do
74
74
  cli.release
@@ -121,7 +121,7 @@ describe Gitx::Cli::ReleaseCommand do
121
121
  expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
122
122
  expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
123
123
  expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
124
- expect(executor).to receive(:execute).with('git integrate').ordered
124
+ expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
125
125
 
126
126
  VCR.use_cassette('pull_request_does_exist_with_success_status') do
127
127
  cli.release 'feature-branch'
@@ -159,7 +159,7 @@ describe Gitx::Cli::ReleaseCommand do
159
159
  expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
160
160
  expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
161
161
  expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
162
- expect(executor).to receive(:execute).with('git integrate').ordered
162
+ expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
163
163
 
164
164
  stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(status: 201, body: new_pull_request.to_json, headers: { 'Content-Type' => 'application/json' })
165
165
  VCR.use_cassette('pull_request_does_not_exist') do
@@ -191,7 +191,7 @@ describe Gitx::Cli::ReleaseCommand do
191
191
  expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
192
192
  expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
193
193
  expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
194
- expect(executor).to receive(:execute).with('git integrate').ordered
194
+ expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
195
195
  expect(executor).to receive(:execute).with('git cleanup').ordered
196
196
 
197
197
  VCR.use_cassette('pull_request_does_exist_with_success_status') do
@@ -202,7 +202,7 @@ describe Gitx::Cli::ReleaseCommand do
202
202
  should meet_expectations
203
203
  end
204
204
  end
205
- context 'when user confirms release and pull request exists with success status with release_label config' do
205
+ context 'when user confirms release with release_label config' do
206
206
  let(:gitx_config) do
207
207
  {
208
208
  'release_label' => 'release-me'
@@ -225,9 +225,9 @@ describe Gitx::Cli::ReleaseCommand do
225
225
 
226
226
  expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
227
227
  expect(executor).to receive(:execute).with('git', 'update').ordered
228
- expect(executor).to receive(:execute).with('git integrate').ordered
228
+ expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
229
229
 
230
- VCR.use_cassette('pull_request_does_exist_with_success_status_and_then_add_label') do
230
+ VCR.use_cassette('pull_request_does_exist_and_then_add_label') do
231
231
  cli.release
232
232
  end
233
233
  end
@@ -27,8 +27,11 @@ describe Gitx::Cli::UpdateCommand do
27
27
  before do
28
28
  allow(cli).to receive(:say)
29
29
 
30
- expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'feature-branch').ordered
30
+ expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
31
31
  expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
32
+ expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
33
+ expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'feature-branch').ordered
34
+ expect(executor).to receive(:execute).with('git', 'pull', '.', 'main').ordered
32
35
  expect(executor).to receive(:execute).with('git', 'share').ordered
33
36
 
34
37
  cli.update
@@ -41,6 +44,9 @@ describe Gitx::Cli::UpdateCommand do
41
44
  before do
42
45
  allow(cli).to receive(:say)
43
46
 
47
+ expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
48
+ expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
49
+ expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
44
50
  expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'feature-branch').and_raise(Gitx::Executor::ExecutionError).ordered
45
51
 
46
52
  expect { cli.update }.to raise_error(Gitx::Cli::BaseCommand::MergeError, 'Merge conflict occurred. Please fix merge conflict and rerun the command')
@@ -53,8 +59,11 @@ describe Gitx::Cli::UpdateCommand do
53
59
  before do
54
60
  allow(cli).to receive(:say)
55
61
 
62
+ expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
63
+ expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
64
+ expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
56
65
  expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'feature-branch').ordered
57
- expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').and_raise(Gitx::Executor::ExecutionError).ordered
66
+ expect(executor).to receive(:execute).with('git', 'pull', '.', 'main').and_raise(Gitx::Executor::ExecutionError).ordered
58
67
 
59
68
  expect { cli.update }.to raise_error(Gitx::Cli::BaseCommand::MergeError, 'Merge conflict occurred. Please fix merge conflict and rerun the command')
60
69
  end
@@ -68,7 +77,11 @@ describe Gitx::Cli::UpdateCommand do
68
77
  allow(cli).to receive(:say)
69
78
 
70
79
  expect(executor).not_to receive(:execute).with('git', 'pull', 'origin', 'feature-branch')
80
+ expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
71
81
  expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
82
+ expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
83
+ expect(executor).to receive(:execute).with('git', 'pull', '.', 'main').ordered
84
+ expect(executor).to receive(:execute).with('git', 'share').ordered
72
85
 
73
86
  cli.update
74
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitx
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-12 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -238,9 +238,9 @@ files:
238
238
  - lib/gitx/extensions/thor.rb
239
239
  - lib/gitx/github.rb
240
240
  - lib/gitx/version.rb
241
+ - spec/fixtures/vcr_cassettes/pull_request_does_exist_and_then_add_label.yml
241
242
  - spec/fixtures/vcr_cassettes/pull_request_does_exist_with_failure_status.yml
242
243
  - spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status.yml
243
- - spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status_and_then_add_label.yml
244
244
  - spec/fixtures/vcr_cassettes/pull_request_does_not_exist.yml
245
245
  - spec/gitx/cli/base_command_spec.rb
246
246
  - spec/gitx/cli/buildtag_command_spec.rb
@@ -287,9 +287,9 @@ signing_key:
287
287
  specification_version: 4
288
288
  summary: Utility scripts for Git to increase productivity for common operations
289
289
  test_files:
290
+ - spec/fixtures/vcr_cassettes/pull_request_does_exist_and_then_add_label.yml
290
291
  - spec/fixtures/vcr_cassettes/pull_request_does_exist_with_failure_status.yml
291
292
  - spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status.yml
292
- - spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status_and_then_add_label.yml
293
293
  - spec/fixtures/vcr_cassettes/pull_request_does_not_exist.yml
294
294
  - spec/gitx/cli/base_command_spec.rb
295
295
  - spec/gitx/cli/buildtag_command_spec.rb