gitx 4.1.1 → 4.3.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: 3794617867e08f0a15468dd3291883d22bed44fa9dfde0350cf120e5c5c8890c
4
- data.tar.gz: 827802ca75c6a1f4243fa628a12dc3cc1e9b11afef91d587fc9fe4ae4a9b2b6e
3
+ metadata.gz: ba914d70cddc88a7a718f8c05ea238822c79b2a58c09f30576835473ff008a0e
4
+ data.tar.gz: c1079014ac0699cf9eea62857061a5932e8b083620241f401a13113761c8f6f2
5
5
  SHA512:
6
- metadata.gz: ae00b7739d6b3488d0ae4ae588d776c1a004eeb36167587699d2c0dae2ec49902dfc78d122f1edcab7e9ce47a3cecfd36efe59491bce0d663562058e08975f57
7
- data.tar.gz: 8727bf623a20f50a6de72088a0e1106e26ccd1ba974d66471e2ed0f8643ffe3c04ec299b6d4343df3816f8c881af3588497e7a2fd9806627c418d461933d24dc
6
+ metadata.gz: 334ef2afbffbe44668f8b97aa8f85f142292dfb5811fd7c37ff7233ed40ae85e6890b08928fa4006b814933e8e68df93d9b9f0017596829a4d6af96184f06a5c
7
+ data.tar.gz: eead42c4bb02d2d8738a057962f9f7c2e5bc2f2318003833b0e7a472ea592197b3f3948d9c06a063a69e58470d641bf77808d1aa266ec8f0f8fffbcd6128cff3
data/README.md CHANGED
@@ -50,7 +50,7 @@ This setting is cleared when a reviewer approves or rejects the pull request.
50
50
  release the feature branch to the base branch (by default, main). This operation will perform the following:
51
51
 
52
52
  * pull latest code from remote feature branch
53
- * pull latest code from the base branch
53
+ * pull latest code from the base branch (unless `update_from_base_on_release` config is set to `false`)
54
54
  * prompt user to confirm they actually want to perform the release
55
55
  * check if pull request commit status is currently successful
56
56
  * merge current branch into the base branch (or add release label if configured)
@@ -17,19 +17,9 @@ module Gitx
17
17
 
18
18
  assert_not_protected_branch!(branch, 'release')
19
19
  checkout_branch(branch)
20
- run_git_cmd 'update'
20
+ run_git_cmd 'update' if config.update_from_base_on_release?
21
21
 
22
- pull_request = find_or_create_pull_request(branch)
23
-
24
- if (label = config.release_label)
25
- label_pull_request pull_request, label
26
- else
27
- return unless confirm_branch_status?(branch)
28
- checkout_branch config.base_branch
29
- run_git_cmd 'pull', 'origin', config.base_branch
30
- run_git_cmd 'merge', '--no-ff', '--message', commit_message(branch, pull_request), branch
31
- run_git_cmd 'push', 'origin', 'HEAD'
32
- end
22
+ perform_release(branch)
33
23
 
34
24
  after_release
35
25
  end
@@ -51,6 +41,21 @@ module Gitx
51
41
  end
52
42
  end
53
43
 
44
+ def perform_release(branch)
45
+ pull_request = find_or_create_pull_request(branch)
46
+
47
+ if (label = config.release_label)
48
+ label_pull_request pull_request, label
49
+ else
50
+ return unless confirm_branch_status?(branch)
51
+
52
+ checkout_branch config.base_branch
53
+ run_git_cmd 'pull', 'origin', config.base_branch
54
+ run_git_cmd 'merge', '--no-ff', '--message', commit_message(branch, pull_request), branch
55
+ run_git_cmd 'push', 'origin', 'HEAD'
56
+ end
57
+ end
58
+
54
59
  def after_release
55
60
  after_release_scripts = config.after_release_scripts.dup
56
61
  after_release_scripts << 'git cleanup' if options[:cleanup]
@@ -45,6 +45,10 @@ module Gitx
45
45
  taggable_branches.include?(branch)
46
46
  end
47
47
 
48
+ def update_from_base_on_release?
49
+ config.fetch(:update_from_base_on_release, true)
50
+ end
51
+
48
52
  def after_release_scripts
49
53
  config[:after_release]
50
54
  end
data/lib/gitx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gitx
2
- VERSION = '4.1.1'.freeze
2
+ VERSION = '4.3.0'.freeze
3
3
  end
@@ -235,5 +235,37 @@ describe Gitx::Cli::ReleaseCommand do
235
235
  should meet_expectations
236
236
  end
237
237
  end
238
+ context 'when user confirms release with update_from_base_on_release config set to false' do
239
+ let(:gitx_config) do
240
+ {
241
+ 'update_from_base_on_release' => false
242
+ }
243
+ end
244
+ before do
245
+ expect(repo).to receive(:workdir).and_return(temp_dir)
246
+ File.open(File.join(temp_dir, '.gitx.yml'), 'w') do |f|
247
+ f.puts gitx_config.to_yaml
248
+ end
249
+
250
+ expect(cli).to receive(:yes?).and_return(true)
251
+ expect(cli).to_not receive(:label_pull_request)
252
+ expect(executor).to_not receive(:execute).with('git', 'update')
253
+ allow(cli).to receive(:authorization_token).and_return(authorization_token)
254
+
255
+ expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
256
+ expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
257
+ expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
258
+ expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
259
+ expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
260
+ expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
261
+
262
+ VCR.use_cassette('pull_request_does_exist_with_success_status') do
263
+ cli.release
264
+ end
265
+ end
266
+ it 'runs expected commands' do
267
+ should meet_expectations
268
+ end
269
+ end
238
270
  end
239
271
  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.1.1
4
+ version: 4.3.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-08-06 00:00:00.000000000 Z
11
+ date: 2022-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit