multi_repo 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a65fcbfd465cabf43b5382db582a7516ad14d37ddaccb9dde5de7522879bf28a
4
- data.tar.gz: eebc43a34102d63149ec5ca32369576814ec9182b402c0e823178b7b4f4c90ea
3
+ metadata.gz: 0211dacdb0aaeb7df692cbe637a7ab350e9a5ba8e3408f060caf864bc49f1355
4
+ data.tar.gz: 33224827cd2be7b34b7892c7eda346e91767c5581f42ef29346d969c201f4aef
5
5
  SHA512:
6
- metadata.gz: 51f252cfde3038b0cc51c8c254b45e9153d3e09ad535493b1a978e1dc7a3408d26aabbadf4f81fead3e7c93d2f9995c59f6d4eacd700736081a134e98e70ebdb
7
- data.tar.gz: 1bdcbab162f091ea83e96db96a81252e866f8aa87a50b9f96ec64239d54b8f9805c676d8c02544ba0f3f031ae11d472d03bf831c00fc8628b16a8292ea2439c3
6
+ metadata.gz: c4a3f5db6fa142b395c5a063510656db34d5f4ae8d0667db83bb0e5cf17b6f63d4fd453b16d5601a484fa3d57f3dfead3b6633ca48715fe9cc0d1c9632c975ca
7
+ data.tar.gz: 646793b26e6a1e952e2f36fa0b88b81dad83b7bd582dbe447847e7327e8f344cc70c3dd463b0d90a3e55153a92c2a0e4e46d188a359ed932f05be926ef30ea62
@@ -19,7 +19,7 @@ jobs:
19
19
  env:
20
20
  CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
21
21
  steps:
22
- - uses: actions/checkout@v4
22
+ - uses: actions/checkout@v5
23
23
  - name: Set up Ruby
24
24
  uses: ruby/setup-ruby@v1
25
25
  with:
data/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.1.0] - 2025-10-01
8
+ ### Added
9
+ - [show_commit_history] Add pr-changelog display format [[#49](https://github.com/ManageIQ/multi_repo/pull/49)]
10
+ - [pull_request_blaster_outer] Prevent git show paging when using --force [[#53](https://github.com/ManageIQ/multi_repo/pull/53)]
11
+
12
+ ### Changed
13
+ - Update licensee to at least 9.7.0 [[#54](https://github.com/ManageIQ/multi_repo/pull/54)]
14
+ - Separate progress bar options from creation of the progress bar [[#55](https://github.com/ManageIQ/multi_repo/pull/55)]
15
+
7
16
  ## [1.0.0] - 2025-04-24
8
17
  ### Added
9
18
  - Allow blank overrides on the command line [[#46](https://github.com/ManageIQ/multi_repo/pull/46)]
@@ -51,7 +60,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
51
60
  - [show_commit_history] Prevent missing ranges from failing the entire run [[#20](https://github.com/ManageIQ/multi_repo/pull/20)]
52
61
  - [pull_request_merger] Fixing issue passing kwargs on Ruby 3 [[#23](https://github.com/ManageIQ/multi_repo/pull/23)]
53
62
 
54
- [Unreleased]: https://github.com/ManageIQ/multi_repo/compare/v1.0.0...HEAD
63
+ [Unreleased]: https://github.com/ManageIQ/multi_repo/compare/v1.1.0...HEAD
64
+ [1.1.0]: https://github.com/ManageIQ/multi_repo/compare/v1.0.0...v1.1.0
55
65
  [1.0.0]: https://github.com/ManageIQ/multi_repo/compare/v0.6.0...v1.0.0
56
66
  [0.6.0]: https://github.com/ManageIQ/multi_repo/compare/v0.5.1...v0.6.0
57
67
  [0.5.1]: https://github.com/ManageIQ/multi_repo/compare/v0.5.0...v0.5.1
@@ -84,11 +84,15 @@ module MultiRepo
84
84
 
85
85
  def self.progress_bar(total = 100)
86
86
  require "progressbar"
87
- ProgressBar.create(
87
+ ProgressBar.create(progress_bar_options(total))
88
+ end
89
+
90
+ def self.progress_bar_options(total = 100)
91
+ {
88
92
  :format => "%j%% |%B| %E",
89
93
  :length => HEADER_SIZE,
90
94
  :total => total
91
- )
95
+ }
92
96
  end
93
97
  end
94
98
  end
@@ -2,9 +2,9 @@ require 'pathname'
2
2
 
3
3
  module MultiRepo::Helpers
4
4
  class PullRequestBlasterOuter
5
- attr_reader :repo, :base, :head, :script, :dry_run, :message, :title, :force
5
+ attr_reader :repo, :base, :head, :script, :dry_run, :message, :title, :body, :force
6
6
 
7
- def initialize(repo, base:, head:, script:, dry_run:, message:, title: nil, force: false, **)
7
+ def initialize(repo, base:, head:, script:, dry_run:, message:, title: nil, body: nil, force: false, **)
8
8
  @repo = repo
9
9
  @base = base
10
10
  @head = head
@@ -16,6 +16,7 @@ module MultiRepo::Helpers
16
16
  @dry_run = dry_run
17
17
  @message = message
18
18
  @title = (title || message)[0, 72]
19
+ @body = (body || message).gsub("\\n", "\n")
19
20
  @force = force
20
21
  end
21
22
 
@@ -41,7 +42,12 @@ module MultiRepo::Helpers
41
42
  puts
42
43
 
43
44
  if dry_run
44
- puts "** dry-run: Skipping opening pull request".light_black
45
+ puts "** dry-run: Skipping opening pull request. The pull request would look like:".light_black
46
+ puts
47
+ puts title.light_black
48
+ puts
49
+ puts body.light_black
50
+
45
51
  result = "dry run".light_black
46
52
  else
47
53
  answer =
@@ -112,7 +118,11 @@ module MultiRepo::Helpers
112
118
  end
113
119
 
114
120
  def show_commit
115
- repo.git.client.show
121
+ if force
122
+ repo.git.raw("--no-pager", "show")
123
+ else
124
+ repo.git.client.show
125
+ end
116
126
  end
117
127
 
118
128
  def blast_remote
@@ -134,7 +144,7 @@ module MultiRepo::Helpers
134
144
  end
135
145
 
136
146
  def open_pull_request
137
- pr = github.client.create_pull_request(repo.name, base, pr_head, title, title)
147
+ pr = github.client.create_pull_request(repo.name, base, pr_head, title, body)
138
148
  pr.html_url
139
149
  rescue => err
140
150
  raise unless err.message.include?("A pull request already exists")
@@ -18,18 +18,21 @@ module MultiRepo::Service
18
18
  retry
19
19
  end
20
20
 
21
- def self.clone(clone_source:, path:)
21
+ def self.raw(*args, quiet: false)
22
22
  require "minigit"
23
23
  require "shellwords"
24
24
 
25
- args = ["clone", clone_source, path]
26
25
  command = Shellwords.join(["git", *args])
27
- command << " &>/dev/null" unless ENV["GIT_DEBUG"]
26
+ command << " &>/dev/null" if quiet && !ENV["GIT_DEBUG"]
28
27
  puts "+ #{command}" if ENV["GIT_DEBUG"] # Matches the output of MiniGit
29
28
 
30
29
  raise MiniGit::GitError.new(args, $?) unless system(command)
31
30
  end
32
31
 
32
+ def self.clone(clone_source:, path:)
33
+ raw("clone", clone_source, path, quiet: true)
34
+ end
35
+
33
36
  attr_reader :dry_run, :client
34
37
 
35
38
  def initialize(path:, clone_source:, dry_run: false)
@@ -39,6 +42,10 @@ module MultiRepo::Service
39
42
  @client = self.class.client(path: path, clone_source: clone_source)
40
43
  end
41
44
 
45
+ def raw(*args)
46
+ Dir.chdir(client.git_dir) { self.class.raw(*args) }
47
+ end
48
+
42
49
  def fetch(output: false)
43
50
  client = output ? self.client : self.client.capturing
44
51
 
@@ -1,3 +1,3 @@
1
1
  module MultiRepo
2
- VERSION = "1.0.0".freeze
2
+ VERSION = "1.1.0".freeze
3
3
  end
data/multi_repo.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_runtime_dependency "activesupport"
26
26
  spec.add_runtime_dependency "colorize"
27
27
  spec.add_runtime_dependency "config"
28
- spec.add_runtime_dependency "licensee"
28
+ spec.add_runtime_dependency "licensee", ">= 9.7.0"
29
29
  spec.add_runtime_dependency "minigit"
30
30
  spec.add_runtime_dependency "more_core_extensions"
31
31
  spec.add_runtime_dependency "octokit", ">= 7.0.0"
@@ -16,6 +16,7 @@ opts = Optimist.options do
16
16
  opt :script, "The path to the script that will update the desired files.", :type => :string, :required => true
17
17
  opt :message, "The commit message for this change.", :type => :string, :required => true
18
18
  opt :title, "The PR title for this change. (default is --message)", :type => :string
19
+ opt :body, "The PR body for this change. (default is --message)", :type => :string
19
20
 
20
21
  opt :force, "Force creation of the pull request without asking.", :default => false
21
22
 
@@ -7,8 +7,9 @@ gemfile do
7
7
  end
8
8
  require "active_support/core_ext/object/blank"
9
9
  require "active_support/core_ext/string/inflections"
10
+ require "more_core_extensions/core_ext/hash/deletes"
10
11
 
11
- DISPLAY_FORMATS = %w[commit pr-title pr-label]
12
+ DISPLAY_FORMATS = %w[commit pr-title pr-label pr-changelog]
12
13
 
13
14
  opts = Optimist.options do
14
15
  synopsis "Show the git commit log between two refs for all git repos."
@@ -33,30 +34,32 @@ repos_with_changes = []
33
34
  MultiRepo::CLI.repos_for(**opts).each do |repo|
34
35
  next if opts[:skip].include?(repo.name)
35
36
 
36
- puts MultiRepo::CLI.header(repo.name)
37
+ puts MultiRepo::CLI.header(repo.name) unless opts[:display] == "pr-changelog"
37
38
  repo.git.fetch(output: false)
38
39
 
39
40
  case opts[:display]
40
- when "pr-label", "pr-title"
41
+ when "pr-label", "pr-title", "pr-changelog"
41
42
  github ||= MultiRepo::Service::Github.client
42
- pr_label_display = opts[:display] == "pr-label"
43
43
 
44
44
  results = {}
45
- if pr_label_display
46
- results["bug"] = []
47
- results["enhancement"] = []
45
+ if %w[pr-label pr-changelog].include?(opts[:display])
46
+ results["bug"] = Set.new
47
+ results["enhancement"] = Set.new
48
48
  end
49
- results["other"] = []
49
+ results["other"] = Set.new
50
50
 
51
51
  log =
52
52
  begin
53
53
  repo.git.client.capturing.log({:oneline => true}, range)
54
54
  rescue MiniGit::GitError
55
- puts "ERROR: commit range not found.".light_red
56
- puts
55
+ unless opts[:display] == "pr-changelog"
56
+ puts "ERROR: commit range not found.".light_red
57
+ puts
58
+ end
57
59
  next
58
60
  end
59
61
 
62
+ pr_index = {}
60
63
  log.lines.each do |line|
61
64
  next unless (match = line.match(/Merge pull request #(\d+)\b/))
62
65
 
@@ -66,23 +69,31 @@ MultiRepo::CLI.repos_for(**opts).each do |repo|
66
69
  rescue Octokit::NotFound
67
70
  next # PR not found could mean this was a cherry-pick from a different repo, so the PR doesn't exist.
68
71
  end
72
+
73
+ pr_index[pr.number] = pr
69
74
  label = pr.labels.detect { |l| results.key?(l.name) }&.name || "other"
70
- results[label] << pr
75
+ results[label] << pr.number
71
76
  end
77
+ results.delete_blanks
72
78
 
73
- changes_found = false
74
-
75
- results.each do |label, prs|
76
- next if prs.blank?
77
- changes_found = true
79
+ if results.present? && opts[:display] == "pr-changelog"
80
+ puts "\n## <i class=\"fa-brands fa-github\"></i> [#{repo.name}](https://github.com/#{repo.name}/compare/#{opts[:from]}...#{opts[:to]})"
81
+ end
78
82
 
79
- puts "\n## #{label.titleize}\n\n" if pr_label_display
80
- prs.each do |pr|
83
+ results.each do |label, pr_numbers|
84
+ case opts[:display]
85
+ when "pr-label"
86
+ puts "\n## #{label.titleize}\n\n"
87
+ when "pr-changelog"
88
+ puts "\n### #{label.titleize}\n\n"
89
+ end
90
+ pr_numbers.each do |pr_number|
91
+ pr = pr_index[pr_number]
81
92
  puts "* #{pr.title} [[##{pr.number}]](#{pr.html_url})"
82
93
  end
83
94
  end
84
95
 
85
- repos_with_changes << repo if changes_found
96
+ repos_with_changes << repo if results.present?
86
97
  when "commit"
87
98
  output =
88
99
  begin
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_repo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Authors
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-04-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -58,14 +57,14 @@ dependencies:
58
57
  requirements:
59
58
  - - ">="
60
59
  - !ruby/object:Gem::Version
61
- version: '0'
60
+ version: 9.7.0
62
61
  type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - ">="
67
66
  - !ruby/object:Gem::Version
68
- version: '0'
67
+ version: 9.7.0
69
68
  - !ruby/object:Gem::Dependency
70
69
  name: minigit
71
70
  requirement: !ruby/object:Gem::Requirement
@@ -330,7 +329,6 @@ homepage: http://github.com/ManageIQ/multi_repo
330
329
  licenses:
331
330
  - MIT
332
331
  metadata: {}
333
- post_install_message:
334
332
  rdoc_options: []
335
333
  require_paths:
336
334
  - lib
@@ -345,8 +343,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
343
  - !ruby/object:Gem::Version
346
344
  version: '0'
347
345
  requirements: []
348
- rubygems_version: 3.5.22
349
- signing_key:
346
+ rubygems_version: 3.7.1
350
347
  specification_version: 4
351
348
  summary: MultiRepo is a library for managing multiple repositiories and running scripts
352
349
  against them.