geet 0.19.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/geet.gemspec +1 -1
- data/lib/geet/commandline/configuration.rb +1 -0
- data/lib/geet/github/pr.rb +3 -2
- data/lib/geet/services/merge_pr.rb +13 -8
- data/lib/geet/utils/git_client.rb +4 -4
- data/lib/geet/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51d12d8a213d135faaf048ab5591329373217d1159ef4796e70f8fcfd4504a64
|
4
|
+
data.tar.gz: 259d6c5267db6d9f8522e33690a6c1cb7455716e43c96cac4ffbee0c22d8fcaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb69f8b3a197a6ef6646fdea3cfc83510aa0b0a89c739011bc250f136ff4247a9bc33459769499d887cd358a7d3dac75883e08592420ee49884848fea1c77f35
|
7
|
+
data.tar.gz: 7a327f36d1711c6960dcfe32eac43881b5356f9ba1ba96e8f81fe96647b479e1499391c648b0ad7d1cc330e50ccfb9ca0c08eab0ac353e54e5fb6f4afa7621cb
|
data/Gemfile
CHANGED
data/geet.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.required_ruby_version = '>= 2.7.0'
|
12
12
|
s.authors = ['Saverio Miroddi']
|
13
|
-
s.date = '
|
13
|
+
s.date = '2024-08-26'
|
14
14
|
s.email = ['saverio.pub2@gmail.com']
|
15
15
|
s.homepage = 'https://github.com/saveriomiroddi/geet'
|
16
16
|
s.summary = 'Commandline interface for performing SCM host operations, eg. create a PR on GitHub'
|
@@ -93,6 +93,7 @@ module Geet
|
|
93
93
|
# rubocop:disable Style/MutableConstant
|
94
94
|
PR_MERGE_OPTIONS = [
|
95
95
|
['-d', '--delete-branch', 'Delete the branch after merging'],
|
96
|
+
['-s', '--squash', 'Squash merge'],
|
96
97
|
['-u', '--upstream', 'List on the upstream repository'],
|
97
98
|
long_help: 'Merge the PR for the current branch'
|
98
99
|
]
|
data/lib/geet/github/pr.rb
CHANGED
@@ -72,10 +72,11 @@ module Geet
|
|
72
72
|
|
73
73
|
# See https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button
|
74
74
|
#
|
75
|
-
def merge
|
75
|
+
def merge(merge_method: nil)
|
76
76
|
api_path = "pulls/#{number}/merge"
|
77
|
+
request_data = { merge_method: } if merge_method
|
77
78
|
|
78
|
-
@api_interface.send_request(api_path, http_method: :put)
|
79
|
+
@api_interface.send_request(api_path, http_method: :put, data: request_data)
|
79
80
|
end
|
80
81
|
|
81
82
|
def request_review(reviewers)
|
@@ -22,16 +22,18 @@ module Geet
|
|
22
22
|
@git_client = git_client
|
23
23
|
end
|
24
24
|
|
25
|
-
def execute(delete_branch: false, **)
|
25
|
+
def execute(delete_branch: false, squash: false, **)
|
26
|
+
merge_method = 'squash' if squash
|
27
|
+
|
26
28
|
@git_client.fetch
|
27
29
|
|
28
30
|
@git_client.push
|
29
31
|
|
30
|
-
check_no_missing_upstream_commits
|
32
|
+
check_no_missing_upstream_commits if !squash
|
31
33
|
|
32
34
|
pr = checked_find_branch_pr
|
33
35
|
|
34
|
-
merge_pr(pr)
|
36
|
+
merge_pr(pr, merge_method:)
|
35
37
|
|
36
38
|
if delete_branch
|
37
39
|
branch = @git_client.current_branch
|
@@ -51,7 +53,10 @@ module Geet
|
|
51
53
|
checkout_branch(main_branch)
|
52
54
|
rebase
|
53
55
|
|
54
|
-
|
56
|
+
# When squashing, we need to force delete, since Git doesn't recognize that the branch has
|
57
|
+
# been merged.
|
58
|
+
#
|
59
|
+
delete_local_branch(pr_branch, force: squash)
|
55
60
|
end
|
56
61
|
|
57
62
|
pr
|
@@ -65,10 +70,10 @@ module Geet
|
|
65
70
|
raise "Found #{missing_upstream_commits.size} missing upstream commits!" if missing_upstream_commits.any?
|
66
71
|
end
|
67
72
|
|
68
|
-
def merge_pr(pr)
|
73
|
+
def merge_pr(pr, merge_method: nil)
|
69
74
|
@out.puts "Merging PR ##{pr.number}..."
|
70
75
|
|
71
|
-
pr.merge
|
76
|
+
pr.merge(merge_method:)
|
72
77
|
end
|
73
78
|
|
74
79
|
def delete_remote_branch(branch)
|
@@ -95,10 +100,10 @@ module Geet
|
|
95
100
|
@git_client.rebase
|
96
101
|
end
|
97
102
|
|
98
|
-
def delete_local_branch(branch)
|
103
|
+
def delete_local_branch(branch, force:)
|
99
104
|
@out.puts "Deleting local branch #{branch}..."
|
100
105
|
|
101
|
-
@git_client.delete_branch(branch)
|
106
|
+
@git_client.delete_branch(branch, force:)
|
102
107
|
end
|
103
108
|
end
|
104
109
|
end
|
@@ -232,10 +232,10 @@ module Geet
|
|
232
232
|
execute_git_command("checkout #{branch.shellescape}")
|
233
233
|
end
|
234
234
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
execute_git_command("branch --delete #{branch.shellescape}")
|
235
|
+
def delete_branch(branch, force:)
|
236
|
+
force_option = "--force" if force
|
237
|
+
|
238
|
+
execute_git_command("branch --delete #{force_option} #{branch.shellescape}")
|
239
239
|
end
|
240
240
|
|
241
241
|
def rebase
|
data/lib/geet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saverio Miroddi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_scripting
|
@@ -175,7 +175,7 @@ homepage: https://github.com/saveriomiroddi/geet
|
|
175
175
|
licenses:
|
176
176
|
- GPL-3.0
|
177
177
|
metadata: {}
|
178
|
-
post_install_message:
|
178
|
+
post_install_message:
|
179
179
|
rdoc_options: []
|
180
180
|
require_paths:
|
181
181
|
- lib
|
@@ -190,8 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.
|
194
|
-
signing_key:
|
193
|
+
rubygems_version: 3.5.9
|
194
|
+
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: Commandline interface for performing SCM host operations, eg. create a PR
|
197
197
|
on GitHub
|