gitlab-housekeeper 0.1.0.codechallenge5e4fde.pre → 0.1.0.codechallenge.f84720.pre
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 +4 -4
- data/bin/gitlab-housekeeper +4 -0
- data/lib/gitlab/housekeeper/runner.rb +8 -7
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee74498546758970e74d4aaa6468311860ee32a4ae63352f2ead5eb530b9af99
|
|
4
|
+
data.tar.gz: 81073133134ebde88ddf70ce8dee21b1cc9adcbc1c48778ab456fe4635fa1dc2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 65450889ea2fd69a70f9474b46aca3494257bcb07863cb4cb3045df20cd983ed0aa78a49eef7b0842b1cf0a7c4445bbfbc36150537e16b9046b19f84432bd37b
|
|
7
|
+
data.tar.gz: 734b4504e7980932f4d8dc3d5410cf7abb20b035eb4e0bd0b8f8d02eabd2010ed5ba55d6f7e16bbc9f47394135c95d91e55b0ab4793bbc8de9822f4c2c3fb8ce
|
data/bin/gitlab-housekeeper
CHANGED
|
@@ -8,6 +8,10 @@ options = {}
|
|
|
8
8
|
OptionParser.new do |opts|
|
|
9
9
|
opts.banner = 'Creates merge requests that can be inferred from the current state of the codebase'
|
|
10
10
|
|
|
11
|
+
opts.on('-b=BRANCH', '--target-branch=BRANCH', String, 'Target branch to use. Defaults to master.') do |branch|
|
|
12
|
+
options[:target_branch] = branch
|
|
13
|
+
end
|
|
14
|
+
|
|
11
15
|
opts.on('-m=M', '--max-mrs=M', Integer, 'Limit of MRs to create. Defaults to 1.') do |m|
|
|
12
16
|
options[:max_mrs] = m
|
|
13
17
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'active_support'
|
|
4
|
-
require 'active_support/core_ext
|
|
4
|
+
require 'active_support/core_ext'
|
|
5
5
|
require 'gitlab/housekeeper/keep'
|
|
6
6
|
require 'gitlab/housekeeper/keeps/rubocop_fixer'
|
|
7
7
|
require 'gitlab/housekeeper/keeps/upgrade_dependency'
|
|
@@ -15,10 +15,11 @@ require 'digest'
|
|
|
15
15
|
module Gitlab
|
|
16
16
|
module Housekeeper
|
|
17
17
|
class Runner
|
|
18
|
-
def initialize(max_mrs: 1, dry_run: false, keeps: nil, filter_identifiers: [])
|
|
18
|
+
def initialize(max_mrs: 1, dry_run: false, keeps: nil, filter_identifiers: [], target_branch: 'master')
|
|
19
19
|
@max_mrs = max_mrs
|
|
20
20
|
@dry_run = dry_run
|
|
21
21
|
@logger = Logger.new($stdout)
|
|
22
|
+
@target_branch = target_branch
|
|
22
23
|
require_keeps
|
|
23
24
|
|
|
24
25
|
@keeps = if keeps
|
|
@@ -97,7 +98,7 @@ module Gitlab
|
|
|
97
98
|
end
|
|
98
99
|
|
|
99
100
|
def git
|
|
100
|
-
@git ||= ::Gitlab::Housekeeper::Git.new(logger: @logger)
|
|
101
|
+
@git ||= ::Gitlab::Housekeeper::Git.new(logger: @logger, branch_from: @target_branch)
|
|
101
102
|
end
|
|
102
103
|
|
|
103
104
|
def require_keeps
|
|
@@ -126,7 +127,7 @@ module Gitlab
|
|
|
126
127
|
end
|
|
127
128
|
|
|
128
129
|
puts '=> Diff:'
|
|
129
|
-
puts Shell.execute('git', '--no-pager', 'diff', '--color=always',
|
|
130
|
+
puts Shell.execute('git', '--no-pager', 'diff', '--color=always', @target_branch, branch_name, '--',
|
|
130
131
|
*change.changed_files)
|
|
131
132
|
puts
|
|
132
133
|
end
|
|
@@ -135,7 +136,7 @@ module Gitlab
|
|
|
135
136
|
non_housekeeper_changes = gitlab_client.non_housekeeper_changes(
|
|
136
137
|
source_project_id: housekeeper_fork_project_id,
|
|
137
138
|
source_branch: branch_name,
|
|
138
|
-
target_branch:
|
|
139
|
+
target_branch: @target_branch,
|
|
139
140
|
target_project_id: housekeeper_target_project_id
|
|
140
141
|
)
|
|
141
142
|
|
|
@@ -147,7 +148,7 @@ module Gitlab
|
|
|
147
148
|
change: change,
|
|
148
149
|
source_project_id: housekeeper_fork_project_id,
|
|
149
150
|
source_branch: branch_name,
|
|
150
|
-
target_branch:
|
|
151
|
+
target_branch: @target_branch,
|
|
151
152
|
target_project_id: housekeeper_target_project_id,
|
|
152
153
|
update_title: !non_housekeeper_changes.include?(:title),
|
|
153
154
|
update_description: !non_housekeeper_changes.include?(:description),
|
|
@@ -160,7 +161,7 @@ module Gitlab
|
|
|
160
161
|
gitlab_client.get_existing_merge_request(
|
|
161
162
|
source_project_id: housekeeper_fork_project_id,
|
|
162
163
|
source_branch: branch_name,
|
|
163
|
-
target_branch:
|
|
164
|
+
target_branch: @target_branch,
|
|
164
165
|
target_project_id: housekeeper_target_project_id
|
|
165
166
|
)
|
|
166
167
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gitlab-housekeeper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.0.
|
|
4
|
+
version: 0.1.0.codechallenge.f84720.pre
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- group::tenant-scale
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-03-
|
|
11
|
+
date: 2024-03-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|