geet 0.4.0 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/geet +14 -10
- data/geet.gemspec +1 -1
- data/lib/geet/commandline/configuration.rb +2 -0
- data/lib/geet/git/repository.rb +2 -2
- data/lib/geet/github/abstract_issue.rb +3 -0
- data/lib/geet/github/pr.rb +28 -8
- data/lib/geet/helpers/services_workflow_helper.rb +9 -7
- data/lib/geet/services/abstract_create_issue.rb +0 -12
- data/lib/geet/services/comment_pr.rb +1 -2
- data/lib/geet/services/create_issue.rb +0 -3
- data/lib/geet/services/create_pr.rb +11 -14
- data/lib/geet/services/merge_pr.rb +4 -5
- data/lib/geet/services/open_pr.rb +2 -3
- data/lib/geet/utils/git_client.rb +17 -17
- data/lib/geet/version.rb +1 -1
- data/spec/integration/create_pr_spec.rb +8 -13
- data/spec/integration/merge_pr_spec.rb +2 -2
- data/spec/vcr_cassettes/github_com/create_pr.yml +1 -1
- data/spec/vcr_cassettes/github_com/create_pr_in_auto_mode_create_upstream.yml +1 -1
- data/spec/vcr_cassettes/github_com/create_pr_in_auto_mode_with_push.yml +1 -1
- data/spec/vcr_cassettes/github_com/create_pr_upstream.yml +1 -1
- data/spec/vcr_cassettes/github_com/create_pr_upstream_without_write_permissions.yml +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2ebbfe0a429595d3584630edcde97a281aaa6482e9c3815c051af46b09c9630
|
4
|
+
data.tar.gz: 63840e956153e2301874e18531e1888e97b6b6d5b9d1f5c7e41d5263bee0433b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c78a72b2f9a876fed2b7647f5dd37a3f183a183562e5f4622921b3ab6b61bdc80e8eccb0b5f38a0ab7999a9f193a209197cff8b7174c0abd769f554f1f7ed93
|
7
|
+
data.tar.gz: e9f5a7eba5d9bac198c5a2b354727472318c18aad9a849004fb97c12dfd103deb08254868e929a502a4b75c32360c9f26ddc1dec8cac060a56134805de37ebd3
|
data/bin/geet
CHANGED
@@ -17,6 +17,7 @@ class GeetLauncher
|
|
17
17
|
include Geet::Helpers::SummaryHelper
|
18
18
|
|
19
19
|
SUMMARY_TEMPLATE = IO.read(File.expand_path('../lib/geet/resources/templates/edit_summary.md', __dir__))
|
20
|
+
SUMMARY_BACKUP = File.join(Dir.tmpdir, 'last_geet_edited_summary.md')
|
20
21
|
|
21
22
|
def launch
|
22
23
|
command, options = Commandline::Configuration.new.decode_argv || exit
|
@@ -88,21 +89,24 @@ class GeetLauncher
|
|
88
89
|
private
|
89
90
|
|
90
91
|
def edit_pr_summary(base: nil)
|
91
|
-
base ||= 'master'
|
92
|
-
|
93
92
|
# Tricky. It would be best to have Git logic exlusively inside the services,
|
94
93
|
# but at the same time, the summary editing should be out.
|
95
94
|
git = Utils::GitClient.new
|
96
|
-
pr_commits = git.cherry(base)
|
95
|
+
pr_commits = git.cherry(base: base)
|
97
96
|
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
summary =
|
98
|
+
if pr_commits.size == 1
|
99
|
+
prepopulated_summary = git.show_description('HEAD')
|
100
|
+
cancel_pr_help = "In order to cancel the PR creation, delete the description above.\n"
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
Commandline::Editor.new.edit_content(content: prepopulated_summary, help: SUMMARY_TEMPLATE + cancel_pr_help)
|
103
|
+
else
|
104
|
+
Commandline::Editor.new.edit_content(help: SUMMARY_TEMPLATE)
|
105
|
+
end
|
106
|
+
|
107
|
+
IO.write(SUMMARY_BACKUP, summary)
|
108
|
+
|
109
|
+
summary
|
106
110
|
end
|
107
111
|
|
108
112
|
def default_to_manual_selection(options, *params)
|
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.3.0'
|
12
12
|
s.authors = ['Saverio Miroddi']
|
13
|
-
s.date = '2021-
|
13
|
+
s.date = '2021-10-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'
|
@@ -68,6 +68,7 @@ module Geet
|
|
68
68
|
['-A', '--automated-mode', "Automate the branch operations (see long help)"],
|
69
69
|
['-n', '--no-open-pr', "Don't open the PR link in the browser after creation"],
|
70
70
|
['-b', '--base develop', "Specify the base branch; defaults to the main branch"],
|
71
|
+
['-d', '--draft', "Create as draft"],
|
71
72
|
['-l', '--labels "legacy,code review"', 'Labels'],
|
72
73
|
['-m', '--milestone 1.5.0', 'Milestone title pattern'],
|
73
74
|
['-r', '--reviewers john,tom,adrian,kevin', 'Reviewer logins'],
|
@@ -95,6 +96,7 @@ module Geet
|
|
95
96
|
]
|
96
97
|
|
97
98
|
PR_OPEN_OPTIONS = [
|
99
|
+
['-u', '--upstream', 'List on the upstream repository'],
|
98
100
|
long_help: 'Open in the browser the PR for the current branch'
|
99
101
|
]
|
100
102
|
|
data/lib/geet/git/repository.rb
CHANGED
@@ -74,11 +74,11 @@ module Geet
|
|
74
74
|
attempt_provider_call(:Milestone, :close, number, api_interface)
|
75
75
|
end
|
76
76
|
|
77
|
-
def create_pr(title, description, head, base)
|
77
|
+
def create_pr(title, description, head, base, draft)
|
78
78
|
confirm(LOCAL_ACTION_ON_UPSTREAM_REPOSITORY_MESSAGE) if local_action_on_upstream_repository? && @warnings
|
79
79
|
confirm(ACTION_ON_PROTECTED_REPOSITORY_MESSAGE) if action_on_protected_repository? && @warnings
|
80
80
|
|
81
|
-
attempt_provider_call(:PR, :create, title, description, head, api_interface, base)
|
81
|
+
attempt_provider_call(:PR, :create, title, description, head, api_interface, base, draft: draft)
|
82
82
|
end
|
83
83
|
|
84
84
|
def prs(owner: nil, head: nil, milestone: nil)
|
@@ -22,6 +22,9 @@ module Geet
|
|
22
22
|
|
23
23
|
# See https://developer.github.com/v3/issues/#list-issues-for-a-repository
|
24
24
|
#
|
25
|
+
# This works both for Issues and PRs, however, when the `/pulls` API (path) is used, additional
|
26
|
+
# information is provided (e.g. `head`).
|
27
|
+
#
|
25
28
|
def self.list(api_interface, milestone: nil, assignee: nil, &type_filter)
|
26
29
|
api_path = 'issues'
|
27
30
|
|
data/lib/geet/github/pr.rb
CHANGED
@@ -8,7 +8,7 @@ module Geet
|
|
8
8
|
class PR < AbstractIssue
|
9
9
|
# See https://developer.github.com/v3/pulls/#create-a-pull-request
|
10
10
|
#
|
11
|
-
def self.create(title, description, head, api_interface, base)
|
11
|
+
def self.create(title, description, head, api_interface, base, draft: false)
|
12
12
|
api_path = 'pulls'
|
13
13
|
|
14
14
|
if api_interface.upstream?
|
@@ -16,7 +16,7 @@ module Geet
|
|
16
16
|
head = "#{authenticated_user}:#{head}"
|
17
17
|
end
|
18
18
|
|
19
|
-
request_data = { title: title, body: description, head: head, base: base }
|
19
|
+
request_data = { title: title, body: description, head: head, base: base, draft: draft }
|
20
20
|
|
21
21
|
response = api_interface.send_request(api_path, data: request_data)
|
22
22
|
|
@@ -32,14 +32,34 @@ module Geet
|
|
32
32
|
|
33
33
|
if head
|
34
34
|
api_path = 'pulls'
|
35
|
-
request_params = { head: "#{owner}:#{head}" }
|
36
35
|
|
37
|
-
|
36
|
+
# Technically, the upstream approach could be used for both, but it's actually good to have
|
37
|
+
# both of them as reference.
|
38
|
+
#
|
39
|
+
# For upstream pulls, the owner is the authenticated user, otherwise, the repository owner.
|
40
|
+
#
|
41
|
+
response = if api_interface.upstream?
|
42
|
+
unfiltered_response = api_interface.send_request(api_path, multipage: true)
|
43
|
+
|
44
|
+
# VERY weird. From the docs, it's not clear if the user/org is required in the `head` parameter,
|
45
|
+
# but:
|
46
|
+
#
|
47
|
+
# - if it isn't included (eg. `anything`), the parameter is ignored
|
48
|
+
# - if it's included (eg. `saveriomiroddi:local_branch_name`), an empty resultset is returned.
|
49
|
+
#
|
50
|
+
# For this reason, we can't use that param, and have to filter manually.
|
51
|
+
#
|
52
|
+
unfiltered_response.select { |pr_data| pr_data.fetch('head').fetch('label') == "#{owner}:#{head}" }
|
53
|
+
else
|
54
|
+
request_params = { head: "#{owner}:#{head}" }
|
55
|
+
|
56
|
+
api_interface.send_request(api_path, params: request_params, multipage: true)
|
57
|
+
end
|
38
58
|
|
39
|
-
response.map do |
|
40
|
-
number =
|
41
|
-
title =
|
42
|
-
link =
|
59
|
+
response.map do |pr_data|
|
60
|
+
number = pr_data.fetch('number')
|
61
|
+
title = pr_data.fetch('title')
|
62
|
+
link = pr_data.fetch('html_url')
|
43
63
|
|
44
64
|
new(number, api_interface, title, link)
|
45
65
|
end
|
@@ -9,17 +9,19 @@ module Geet
|
|
9
9
|
# Helper for services common workflow, for example, find the merge head.
|
10
10
|
#
|
11
11
|
module ServicesWorkflowHelper
|
12
|
-
# Requires: @git_client
|
13
|
-
#
|
14
|
-
def find_merge_head
|
15
|
-
[@git_client.owner, @git_client.current_branch]
|
16
|
-
end
|
17
|
-
|
18
12
|
# Expect to find only one.
|
19
13
|
#
|
20
14
|
# Requires: @out, @repository.
|
21
15
|
#
|
22
|
-
def checked_find_branch_pr
|
16
|
+
def checked_find_branch_pr
|
17
|
+
owner = if @repository.upstream?
|
18
|
+
@repository.authenticated_user.username
|
19
|
+
else
|
20
|
+
@git_client.owner
|
21
|
+
end
|
22
|
+
|
23
|
+
head = @git_client.current_branch
|
24
|
+
|
23
25
|
@out.puts "Finding PR with head (#{owner}:#{head})..."
|
24
26
|
|
25
27
|
prs = @repository.prs(owner: owner, head: head)
|
@@ -12,22 +12,10 @@ module Geet
|
|
12
12
|
class AbstractCreateIssue
|
13
13
|
include Geet::Helpers::OsHelper
|
14
14
|
|
15
|
-
SUMMARY_BACKUP_FILENAME = File.join(Dir.tmpdir, 'last_geet_edited_summary.md')
|
16
|
-
|
17
15
|
def initialize(repository, out: $stdout)
|
18
16
|
@repository = repository
|
19
17
|
@out = out
|
20
18
|
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def save_summary(title, description)
|
25
|
-
summary = "#{title}\n\n#{description}".strip + "\n"
|
26
|
-
|
27
|
-
IO.write(SUMMARY_BACKUP_FILENAME, summary)
|
28
|
-
|
29
|
-
@out.puts "Error! Saved summary to #{SUMMARY_BACKUP_FILENAME}"
|
30
|
-
end
|
31
19
|
end
|
32
20
|
end
|
33
21
|
end
|
@@ -20,8 +20,7 @@ module Geet
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def execute(comment, no_open_pr: nil)
|
23
|
-
|
24
|
-
pr = checked_find_branch_pr(merge_owner, merge_head)
|
23
|
+
pr = checked_find_branch_pr
|
25
24
|
pr.comment(comment)
|
26
25
|
open_file_with_default_application(pr.link) unless no_open_pr
|
27
26
|
pr
|
@@ -25,7 +25,7 @@ module Geet
|
|
25
25
|
#
|
26
26
|
def execute(
|
27
27
|
title, description, labels: nil, milestone: nil, reviewers: nil,
|
28
|
-
base: nil, no_open_pr: nil, automated_mode: false, **
|
28
|
+
base: nil, draft: false, no_open_pr: nil, automated_mode: false, **
|
29
29
|
)
|
30
30
|
ensure_clean_tree if automated_mode
|
31
31
|
|
@@ -37,9 +37,9 @@ module Geet
|
|
37
37
|
selected_labels, selected_milestone, selected_reviewers = find_and_select_attributes(labels, milestone, reviewers)
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
sync_with_remote_branch if automated_mode
|
41
41
|
|
42
|
-
pr = create_pr(title, description, base: base)
|
42
|
+
pr = create_pr(title, description, base: base, draft: draft)
|
43
43
|
|
44
44
|
if user_has_write_permissions
|
45
45
|
edit_pr(pr, selected_labels, selected_milestone, selected_reviewers)
|
@@ -52,9 +52,6 @@ module Geet
|
|
52
52
|
end
|
53
53
|
|
54
54
|
pr
|
55
|
-
rescue => error
|
56
|
-
save_summary(title, description) if title
|
57
|
-
raise
|
58
55
|
end
|
59
56
|
|
60
57
|
private
|
@@ -81,26 +78,26 @@ module Geet
|
|
81
78
|
selection_manager.select_attributes
|
82
79
|
end
|
83
80
|
|
84
|
-
def
|
85
|
-
if @git_client.
|
86
|
-
@out.puts "Pushing to
|
81
|
+
def sync_with_remote_branch
|
82
|
+
if @git_client.remote_branch
|
83
|
+
@out.puts "Pushing to remote branch..."
|
87
84
|
|
88
85
|
@git_client.push
|
89
86
|
else
|
90
|
-
|
87
|
+
remote_branch = @git_client.current_branch
|
91
88
|
|
92
|
-
@out.puts "Creating
|
89
|
+
@out.puts "Creating remote branch #{remote_branch.inspect}..."
|
93
90
|
|
94
|
-
@git_client.push(
|
91
|
+
@git_client.push(remote_branch: remote_branch)
|
95
92
|
end
|
96
93
|
end
|
97
94
|
|
98
|
-
def create_pr(title, description, base:
|
95
|
+
def create_pr(title, description, base:, draft:)
|
99
96
|
@out.puts 'Creating PR...'
|
100
97
|
|
101
98
|
base ||= @git_client.main_branch
|
102
99
|
|
103
|
-
@repository.create_pr(title, description, @git_client.current_branch, base)
|
100
|
+
@repository.create_pr(title, description, @git_client.current_branch, base, draft)
|
104
101
|
end
|
105
102
|
|
106
103
|
def edit_pr(pr, labels, milestone, reviewers)
|
@@ -23,8 +23,7 @@ module Geet
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def execute(delete_branch: false)
|
26
|
-
|
27
|
-
pr = checked_find_branch_pr(merge_owner, merge_head)
|
26
|
+
pr = checked_find_branch_pr
|
28
27
|
|
29
28
|
merge_pr(pr)
|
30
29
|
|
@@ -36,7 +35,7 @@ module Geet
|
|
36
35
|
|
37
36
|
fetch_repository
|
38
37
|
|
39
|
-
if
|
38
|
+
if remote_branch_gone?
|
40
39
|
pr_branch = @git_client.current_branch
|
41
40
|
main_branch = @git_client.main_branch
|
42
41
|
|
@@ -72,8 +71,8 @@ module Geet
|
|
72
71
|
@git_client.fetch
|
73
72
|
end
|
74
73
|
|
75
|
-
def
|
76
|
-
@git_client.
|
74
|
+
def remote_branch_gone?
|
75
|
+
@git_client.remote_branch_gone?
|
77
76
|
end
|
78
77
|
|
79
78
|
def checkout_branch(branch)
|
@@ -19,9 +19,8 @@ module Geet
|
|
19
19
|
@git_client = git_client
|
20
20
|
end
|
21
21
|
|
22
|
-
def execute(delete_branch: false)
|
23
|
-
|
24
|
-
pr = checked_find_branch_pr(merge_owner, merge_head)
|
22
|
+
def execute(delete_branch: false, **)
|
23
|
+
pr = checked_find_branch_pr
|
25
24
|
open_file_with_default_application(pr.link)
|
26
25
|
pr
|
27
26
|
end
|
@@ -34,7 +34,7 @@ module Geet
|
|
34
34
|
\Z
|
35
35
|
}x
|
36
36
|
|
37
|
-
|
37
|
+
REMOTE_BRANCH_REGEX = %r{\A[^/]+/(.+)\Z}
|
38
38
|
|
39
39
|
MAIN_BRANCH_CONFIG_ENTRY = 'custom.development-branch'
|
40
40
|
|
@@ -48,11 +48,13 @@ module Geet
|
|
48
48
|
# BRANCH/TREE APIS
|
49
49
|
##########################################################################
|
50
50
|
|
51
|
-
# Return the commit
|
51
|
+
# Return the commit SHAs between HEAD and `base`, excluding the already applied commits
|
52
52
|
# (which start with `-`)
|
53
53
|
#
|
54
|
-
def cherry(
|
55
|
-
|
54
|
+
def cherry(base: nil)
|
55
|
+
base ||= main_branch
|
56
|
+
|
57
|
+
raw_commits = execute_git_command("cherry #{base.shellescape}")
|
56
58
|
|
57
59
|
raw_commits.split("\n").grep(/^\+/).map { |line| line[3..-1] }
|
58
60
|
end
|
@@ -65,25 +67,23 @@ module Geet
|
|
65
67
|
branch
|
66
68
|
end
|
67
69
|
|
68
|
-
# Not to be confused with `upstream` repository!
|
69
|
-
#
|
70
70
|
# This API doesn't reveal if the remote branch is gone.
|
71
71
|
#
|
72
|
-
# return: nil, if the
|
72
|
+
# return: nil, if the remote branch is not configured.
|
73
73
|
#
|
74
|
-
def
|
74
|
+
def remote_branch
|
75
75
|
head_symbolic_ref = execute_git_command("symbolic-ref -q HEAD")
|
76
76
|
|
77
|
-
|
77
|
+
raw_remote_branch = execute_git_command("for-each-ref --format='%(upstream:short)' #{head_symbolic_ref.shellescape}").strip
|
78
78
|
|
79
|
-
if
|
80
|
-
|
79
|
+
if raw_remote_branch != ''
|
80
|
+
raw_remote_branch[REMOTE_BRANCH_REGEX, 1] || raise("Unexpected remote branch format: #{raw_remote_branch}")
|
81
81
|
else
|
82
82
|
nil
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
# TODO: May be merged with :
|
86
|
+
# TODO: May be merged with :remote_branch, although it would require designing how a gone
|
87
87
|
# remote branch is expressed.
|
88
88
|
#
|
89
89
|
# Sample command output:
|
@@ -91,7 +91,7 @@ module Geet
|
|
91
91
|
# ## add_milestone_closing...origin/add_milestone_closing [gone]
|
92
92
|
# M spec/integration/merge_pr_spec.rb
|
93
93
|
#
|
94
|
-
def
|
94
|
+
def remote_branch_gone?
|
95
95
|
git_command = "status -b --porcelain"
|
96
96
|
status_output = execute_git_command(git_command)
|
97
97
|
|
@@ -216,12 +216,12 @@ module Geet
|
|
216
216
|
execute_git_command("rebase")
|
217
217
|
end
|
218
218
|
|
219
|
-
#
|
219
|
+
# remote_branch: create an upstream branch.
|
220
220
|
#
|
221
|
-
def push(
|
222
|
-
|
221
|
+
def push(remote_branch: nil)
|
222
|
+
remote_branch_option = "-u #{ORIGIN_NAME} #{remote_branch.shellescape}" if remote_branch
|
223
223
|
|
224
|
-
execute_git_command("push #{
|
224
|
+
execute_git_command("push #{remote_branch_option}")
|
225
225
|
end
|
226
226
|
|
227
227
|
# Performs pruning.
|
data/lib/geet/version.rb
CHANGED
@@ -117,10 +117,6 @@ describe Geet::Services::CreatePr do
|
|
117
117
|
allow(git_client).to receive(:working_tree_clean?).and_return(false)
|
118
118
|
allow(git_client).to receive(:remote).with(no_args).and_return('git@github.com:donaldduck/testrepo_f')
|
119
119
|
|
120
|
-
expected_output = <<~STR
|
121
|
-
Error! Saved summary to /tmp/last_geet_edited_summary.md
|
122
|
-
STR
|
123
|
-
|
124
120
|
actual_output = StringIO.new
|
125
121
|
|
126
122
|
operation = -> do
|
@@ -129,21 +125,20 @@ describe Geet::Services::CreatePr do
|
|
129
125
|
end
|
130
126
|
|
131
127
|
expect(operation).to raise_error(RuntimeError, 'The working tree is not clean!')
|
132
|
-
|
133
|
-
expect(actual_output.string).to eql(expected_output)
|
128
|
+
expect(actual_output.string).to be_empty
|
134
129
|
end
|
135
130
|
|
136
|
-
it 'should push to the
|
131
|
+
it 'should push to the remote branch' do
|
137
132
|
allow(git_client).to receive(:working_tree_clean?).and_return(true)
|
138
133
|
allow(git_client).to receive(:current_branch).and_return('mybranch')
|
139
134
|
allow(git_client).to receive(:main_branch).and_return('master')
|
140
|
-
expect(git_client).to receive(:
|
135
|
+
expect(git_client).to receive(:remote_branch).and_return('mybranch')
|
141
136
|
expect(git_client).to receive(:push)
|
142
137
|
|
143
138
|
allow(git_client).to receive(:remote).with(no_args).and_return('git@github.com:donaldduck/testrepo_f')
|
144
139
|
|
145
140
|
expected_output = <<~STR
|
146
|
-
Pushing to
|
141
|
+
Pushing to remote branch...
|
147
142
|
Creating PR...
|
148
143
|
Assigning authenticated user...
|
149
144
|
PR address: https://github.com/donaldduck/testrepo_f/pull/2
|
@@ -159,17 +154,17 @@ describe Geet::Services::CreatePr do
|
|
159
154
|
expect(actual_output.string).to eql(expected_output)
|
160
155
|
end
|
161
156
|
|
162
|
-
it "should create
|
157
|
+
it "should create a remote branch, when there isn't one (is not tracked)" do
|
163
158
|
allow(git_client).to receive(:working_tree_clean?).and_return(true)
|
164
159
|
allow(git_client).to receive(:current_branch).and_return('mybranch')
|
165
160
|
allow(git_client).to receive(:main_branch).and_return('master')
|
166
|
-
expect(git_client).to receive(:
|
167
|
-
expect(git_client).to receive(:push).with(
|
161
|
+
expect(git_client).to receive(:remote_branch).and_return(nil)
|
162
|
+
expect(git_client).to receive(:push).with(remote_branch: 'mybranch')
|
168
163
|
|
169
164
|
allow(git_client).to receive(:remote).with(no_args).and_return('git@github.com:donaldduck/testrepo_f')
|
170
165
|
|
171
166
|
expected_output = <<~STR
|
172
|
-
Creating
|
167
|
+
Creating remote branch "mybranch"...
|
173
168
|
Creating PR...
|
174
169
|
Assigning authenticated user...
|
175
170
|
PR address: https://github.com/donaldduck/testrepo_f/pull/4
|
@@ -7,7 +7,7 @@ require_relative '../../lib/geet/services/merge_pr'
|
|
7
7
|
|
8
8
|
# Currently disabled: it requires updates following the addition of the automatic removal of the local
|
9
9
|
# branch.
|
10
|
-
# Specifically, `GitClient#
|
10
|
+
# Specifically, `GitClient#remote_branch_gone?` needs to be handled, since it returns the current
|
11
11
|
# branch, while it's supposed to return
|
12
12
|
#
|
13
13
|
describe Geet::Services::MergePr do
|
@@ -19,7 +19,7 @@ describe Geet::Services::MergePr do
|
|
19
19
|
|
20
20
|
before :each do
|
21
21
|
expect(git_client).to receive(:fetch)
|
22
|
-
expect(git_client).to receive(:
|
22
|
+
expect(git_client).to receive(:remote_branch_gone?).and_return(true)
|
23
23
|
expect(git_client).to receive(:checkout).with(main_branch)
|
24
24
|
expect(git_client).to receive(:rebase)
|
25
25
|
expect(git_client).to receive(:delete_branch).with('mybranch')
|
@@ -686,7 +686,7 @@ http_interactions:
|
|
686
686
|
uri: https://api.github.com/repos/donaldduck/testrepo_f/pulls
|
687
687
|
body:
|
688
688
|
encoding: UTF-8
|
689
|
-
string: '{"title":"Title","body":"Description","head":"mybranch","base":"master"}'
|
689
|
+
string: '{"title":"Title","body":"Description","head":"mybranch","base":"master","draft":false}'
|
690
690
|
headers:
|
691
691
|
Accept-Encoding:
|
692
692
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
@@ -381,7 +381,7 @@ http_interactions:
|
|
381
381
|
uri: https://api.github.com/repos/donaldduck/testrepo_f/pulls
|
382
382
|
body:
|
383
383
|
encoding: UTF-8
|
384
|
-
string: '{"title":"Title","body":"Description","head":"mybranch","base":"master"}'
|
384
|
+
string: '{"title":"Title","body":"Description","head":"mybranch","base":"master","draft":false}'
|
385
385
|
headers:
|
386
386
|
Accept-Encoding:
|
387
387
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
@@ -381,7 +381,7 @@ http_interactions:
|
|
381
381
|
uri: https://api.github.com/repos/donaldduck/testrepo_f/pulls
|
382
382
|
body:
|
383
383
|
encoding: UTF-8
|
384
|
-
string: '{"title":"Title","body":"Description","head":"mybranch","base":"master"}'
|
384
|
+
string: '{"title":"Title","body":"Description","head":"mybranch","base":"master","draft":false}'
|
385
385
|
headers:
|
386
386
|
Accept-Encoding:
|
387
387
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
@@ -459,7 +459,7 @@ http_interactions:
|
|
459
459
|
uri: https://api.github.com/repos/donald-fr/testrepo_u/pulls
|
460
460
|
body:
|
461
461
|
encoding: UTF-8
|
462
|
-
string: '{"title":"Title","body":"Description","head":"donaldduck:mybranch","base":"master"}'
|
462
|
+
string: '{"title":"Title","body":"Description","head":"donaldduck:mybranch","base":"master","draft":false}'
|
463
463
|
headers:
|
464
464
|
Accept-Encoding:
|
465
465
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
@@ -230,7 +230,7 @@ http_interactions:
|
|
230
230
|
uri: https://api.github.com/repos/donald-fr/testrepo_u/pulls
|
231
231
|
body:
|
232
232
|
encoding: UTF-8
|
233
|
-
string: '{"title":"Title","body":"Description","head":"donaldduck:mybranch","base":"master"}'
|
233
|
+
string: '{"title":"Title","body":"Description","head":"donaldduck:mybranch","base":"master","draft":false}'
|
234
234
|
headers:
|
235
235
|
Accept-Encoding:
|
236
236
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
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.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saverio Miroddi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_scripting
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.
|
193
|
+
rubygems_version: 3.1.6
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: Commandline interface for performing SCM host operations, eg. create a PR
|