railbow 0.7.0 → 0.8.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: cdfe578f284175c30e3b9f4c77a83f62b8e63b8019e575590f8ad471e5639efb
4
- data.tar.gz: 5874946340d18626a566b0190f734f6a94a55a3d40dfb0777760ab377b9d295d
3
+ metadata.gz: 9ec5f893665ab78ed905fe1ca38169a82c466177db5db58f3ced482451e85b48
4
+ data.tar.gz: 9854f71484e1268819bd07947d7a07bd94e29df677a0cf57a363d392457c7730
5
5
  SHA512:
6
- metadata.gz: 3fc62787e1bfd0913be00ca297c5c9210a312b067c68960c13699298a3a064e396a20bc952e65544d19059a03c02454c99413b8f59fd84e6890d9145e8ba03c1
7
- data.tar.gz: e2253cf2117f5ed4a6702f9500774789d05007876f09ad043b014f9e7b0d53f9616ea21fc32247463081e131aa533b2bf149cb65be99f8f08b37478a281e22ee
6
+ metadata.gz: 1bafaeae1f304d088b5013349b927d36d11dc35f6ce18e80cb34e9e5deb4bf09a1b0f8ea26f2baa3545ce0f398a2fd1379a4ae3bdcb03209e3aace8517af7fa5
7
+ data.tar.gz: 5e32f6c1741bdfa49ae85c3daf9554c6bab161c4be42ec71ff1aee7c950c8303e5214db9290fae756d0542065939a1d0c776790d7b510fa8327197021eaff5bd
data/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.8.0] - 2026-11-11
9
+
10
+ ### Added
11
+
12
+ - In a multi-database `db:migrate:status`, the migrations your branch adds
13
+ always show, whichever database they target and even outside the time
14
+ window. A drawn table gains the ones the window left out. A database that
15
+ would collapse to a summary line (summarized by `focus`, or quiet) shows a
16
+ table of just those, with a header like `1 on this branch of 40` that still
17
+ counts the pending and ghost migrations it hides. "Your branch" means added
18
+ since the merge-base with the base branch, or added and not committed yet,
19
+ and needs `diff` in `RBW_GIT` (on by default).
20
+
21
+ ### Fixed
22
+
23
+ - The `⎇` branch badge in `db:migrate:status` now appears for a migration
24
+ whose filename was introduced in a merge commit, for example one
25
+ re-timestamped while merging the base branch in. The origin lookup falls
26
+ back to a merge-aware `git log` when the plain one finds nothing.
27
+
8
28
  ## [0.7.0] - 2026-10-09
9
29
 
10
30
  ### Added
data/README.md CHANGED
@@ -171,6 +171,23 @@ in full and every other one is summarized in a line each (`db: focus`).
171
171
  run is. The summary exists to hide what needs no action, and pending work is
172
172
  the opposite of that.
173
173
 
174
+ **Your branch's migrations always show**, whichever database they target and
175
+ however old they are. These are the migrations the checked-out branch adds:
176
+ committed since the merge-base with the base branch, or added and not committed
177
+ yet. A drawn table gains the ones the time window left out, and a database that
178
+ would be summarized keeps a table of just those. Its header still counts the
179
+ pending and ghost migrations the summary line would have named:
180
+
181
+ ```
182
+ ──── primary · myapp_development ──── 12 of 240 ────────────────────────
183
+ ↑↑ │ 20260721130000 │ 2026-07-21 13:00:00 │ Partition visit reminders ● visit_reminders
184
+
185
+ ──── log · log_development ──── 1 on this branch of 40 ──── 2 pending outside the 90d window - RBW_SINCE=all ────
186
+ ↑↑ │ 20260801100000 │ 2026-08-01 10:00:00 │ Add source to visit logs ● visit_logs
187
+ ```
188
+
189
+ This needs `diff` in `RBW_GIT`, which the default has.
190
+
174
191
  Setting `db` to an empty value expands every database that has recent activity,
175
192
  each as its own section with column widths shared so the tables line up:
176
193
 
data/lib/railbow/init.rb CHANGED
@@ -67,6 +67,8 @@ module Railbow
67
67
  # Multi-database runs (comma-separated). Leave empty ("") to expand every
68
68
  # database into its own section, in database.yml order; a database with
69
69
  # nothing in the time window collapses to a one-line summary either way.
70
+ # Migrations your branch adds always show, even outside the window, and a
71
+ # database that would be summarized lists just those (git: diff).
70
72
  # focus - expand only the first database, summarizing the rest.
71
73
  # A database with migrations pending is always expanded
72
74
  # only:<name> - render only this database (repeatable)
@@ -43,6 +43,120 @@ module Railbow
43
43
  cache[[migrate_dir, opts]] ||= new(migrate_dir: migrate_dir, **opts)
44
44
  end
45
45
 
46
+ # Basenames of the migrations the checked-out branch adds over its base:
47
+ # committed since the merge-base, or added and not committed yet. Much
48
+ # cheaper than a full instance (no history walk, no origin lookup), so a
49
+ # database that is otherwise only summarized can afford to ask.
50
+ def self.branch_files(paths, base_override: "")
51
+ run_cached([:branch_files, paths, base_override]) do
52
+ files = Set.new(committed_branch_paths(paths, base_override).map { |f| File.basename(f) })
53
+ files.merge(uncommitted_files(paths, additions_only: true))
54
+ end
55
+ end
56
+
57
+ # Paths of the migrations committed on this branch since it left its
58
+ # base. Shared with the origin badge, so the badge and the branch rows
59
+ # agree on which migrations are the branch's.
60
+ def self.committed_branch_paths(paths, base_override)
61
+ merge_base = run_cached([:merge_base, base_override]) do
62
+ out, status = Railbow::GitUtils.capture2("merge-base", "HEAD", default_branch(base_override))
63
+ status.success? ? out.strip : nil
64
+ end
65
+ return [] unless merge_base
66
+
67
+ diff_out, diff_status = Railbow::GitUtils.capture2(
68
+ "diff", "--name-status", "--diff-filter=AR", merge_base, "HEAD", "--", *paths
69
+ )
70
+ return [] unless diff_status.success?
71
+
72
+ diff_out.each_line.filter_map { |l| name_status_path(l.strip) }
73
+ end
74
+
75
+ # Memoized for the rest of a multi-database run, so per-database calls
76
+ # share what does not depend on the database. Outside a run, no cache.
77
+ def self.run_cached(key)
78
+ cache = Railbow::MultiDb.current&.git_cache
79
+ return yield unless cache
80
+ return cache[key] if cache.key?(key)
81
+
82
+ cache[key] = yield
83
+ end
84
+
85
+ def self.default_branch(override)
86
+ return override if override && !override.empty?
87
+
88
+ run_cached([:default_branch]) { detect_default_branch }
89
+ end
90
+
91
+ def self.detect_default_branch
92
+ output, status = Railbow::GitUtils.capture2("symbolic-ref", "refs/remotes/origin/HEAD")
93
+ if status.success?
94
+ branch = output.strip.sub(%r{^refs/remotes/origin/}, "")
95
+ return branch unless branch.empty?
96
+ end
97
+
98
+ %w[main master].each do |candidate|
99
+ _, st = Railbow::GitUtils.capture2("rev-parse", "--verify", "refs/heads/#{candidate}")
100
+ return candidate if st.success?
101
+ end
102
+
103
+ "main"
104
+ end
105
+
106
+ # --name-status lines are "A\tfilepath" or "Rnnn\told\tnew"; a rename
107
+ # attributes to its destination.
108
+ def self.name_status_path(line)
109
+ cols = line.split("\t")
110
+ filepath = cols[0]&.start_with?("R") ? cols[2] : cols[1]
111
+ (filepath.nil? || filepath.empty?) ? nil : filepath
112
+ end
113
+
114
+ def self.name_status_basename(line)
115
+ filepath = name_status_path(line)
116
+ filepath && File.basename(filepath)
117
+ end
118
+
119
+ # A staged edit ("M ") belongs to the current branch for the badge, but
120
+ # with additions_only it is not a migration the branch adds: an edit to
121
+ # an old migration would otherwise count until it is committed.
122
+ def self.uncommitted_files(paths, additions_only: false)
123
+ output, status = Railbow::GitUtils.capture2("status", "--porcelain", "--", *paths)
124
+ return Set.new unless status.success?
125
+
126
+ result = Set.new
127
+ output.each_line do |line|
128
+ code = line[0..1]
129
+
130
+ if code[0] == "R"
131
+ # Rename: "R old -> new" or "R100 old -> new". Take the destination.
132
+ parts = line[3..].split(" -> ", 2)
133
+ filepath = (parts[1] || parts[0]).strip
134
+ elsif ["??", "A ", "AM"].include?(code) || (code == "M " && !additions_only)
135
+ filepath = line[3..].strip
136
+ else
137
+ next
138
+ end
139
+
140
+ result << File.basename(filepath) unless filepath.empty?
141
+ end
142
+
143
+ # During an in-progress merge, files from MERGE_HEAD (e.g. main) show up
144
+ # as staged additions. Exclude them so they are not tagged as ours.
145
+ result - incoming_merge_files(paths)
146
+ end
147
+
148
+ def self.incoming_merge_files(paths)
149
+ merging = run_cached([:merging]) { Railbow::GitUtils.capture3("rev-parse", "MERGE_HEAD")[2].success? }
150
+ return Set.new unless merging
151
+
152
+ output, _, status = Railbow::GitUtils.capture3(
153
+ "diff", "--name-only", "--diff-filter=AR", "HEAD", "MERGE_HEAD", "--", *paths
154
+ )
155
+ return Set.new unless status.success?
156
+
157
+ Set.new(output.each_line.map { |l| File.basename(l.strip) }.reject(&:empty?))
158
+ end
159
+
46
160
  # Extracts a display label from a branch name. "auto" uses the built-in
47
161
  # ticket pattern; anything else is a regex whose first capture wins.
48
162
  def self.apply_branch_mask(branch, branch_mask)
@@ -145,12 +259,8 @@ module Railbow
145
259
  dates
146
260
  end
147
261
 
148
- # --name-status lines are "A\tfilepath" or "Rnnn\told\tnew"; a rename
149
- # attributes to its destination.
150
262
  def name_status_basename(line)
151
- cols = line.split("\t")
152
- filepath = cols[0]&.start_with?("R") ? cols[2] : cols[1]
153
- filepath ? File.basename(filepath) : nil
263
+ self.class.name_status_basename(line)
154
264
  end
155
265
 
156
266
  def current_git_email
@@ -171,36 +281,11 @@ module Railbow
171
281
  end
172
282
 
173
283
  def detect_default_branch(override)
174
- return override if override && !override.empty?
175
-
176
- output, status = Railbow::GitUtils.capture2("symbolic-ref", "refs/remotes/origin/HEAD")
177
- if status.success?
178
- branch = output.strip.sub(%r{^refs/remotes/origin/}, "")
179
- return branch unless branch.empty?
180
- end
181
-
182
- %w[main master].each do |candidate|
183
- _, st = Railbow::GitUtils.capture2("rev-parse", "--verify", "refs/heads/#{candidate}")
184
- return candidate if st.success?
185
- end
186
-
187
- "main"
284
+ self.class.default_branch(override)
188
285
  end
189
286
 
190
287
  def branch_migration_origins(base_branch, branch_mask)
191
- merge_base_out, mb_status = Railbow::GitUtils.capture2("merge-base", "HEAD", base_branch)
192
- return {} unless mb_status.success?
193
-
194
- merge_base = merge_base_out.strip
195
- diff_out, diff_status = Railbow::GitUtils.capture2(
196
- "diff", "--name-status", "--diff-filter=AR", merge_base, "HEAD", "--", migrate_dir
197
- )
198
- return {} unless diff_status.success?
199
-
200
- files = diff_out.each_line.map { |l|
201
- cols = l.strip.split("\t")
202
- cols[0]&.start_with?("R") ? cols[2] : cols[1]
203
- }.compact.reject(&:empty?)
288
+ files = self.class.committed_branch_paths([migrate_dir], base_branch)
204
289
  origins = {}
205
290
 
206
291
  files.each do |filepath|
@@ -218,14 +303,27 @@ module Railbow
218
303
  origins
219
304
  end
220
305
 
306
+ # The commit that first produced this filename. A plain log shows no diff
307
+ # for a merge commit, so a file named inside one (a migration
308
+ # re-timestamped while merging the base branch in) needs the -m form,
309
+ # oldest match first. -m stays a fallback: a later "merge main into
310
+ # feature" commit lists every main migration as added against one parent,
311
+ # and pick_origin_branch would then label those with the base branch.
221
312
  def adding_commit(filepath)
222
- commit_out, cs = Railbow::GitUtils.capture2(
223
- "log", "--diff-filter=AR", "--format=%H", "-1", "--", filepath
313
+ commits = commits_touching(filepath, "-1")
314
+ return nil if commits.nil?
315
+ return commits.first if commits.any?
316
+
317
+ commits_touching(filepath, "-m")&.last
318
+ end
319
+
320
+ def commits_touching(filepath, *flags)
321
+ out, status = Railbow::GitUtils.capture2(
322
+ "log", "--diff-filter=AR", "--format=%H", *flags, "--", filepath
224
323
  )
225
- return nil unless cs.success?
324
+ return nil unless status.success?
226
325
 
227
- commit = commit_out.strip
228
- commit.empty? ? nil : commit
326
+ out.each_line.map(&:strip).reject(&:empty?)
229
327
  end
230
328
 
231
329
  def branches_containing(commit)
@@ -260,29 +358,7 @@ module Railbow
260
358
  end
261
359
 
262
360
  def uncommitted_migration_files
263
- output, status = Railbow::GitUtils.capture2("status", "--porcelain", "--", migrate_dir)
264
- return Set.new unless status.success?
265
-
266
- result = Set.new
267
- output.each_line do |line|
268
- code = line[0..1]
269
-
270
- if code[0] == "R"
271
- # Rename: "R old -> new" or "R100 old -> new". Take the destination.
272
- parts = line[3..].split(" -> ", 2)
273
- filepath = (parts[1] || parts[0]).strip
274
- elsif ["??", "A ", "AM", "M "].include?(code)
275
- filepath = line[3..].strip
276
- else
277
- next
278
- end
279
-
280
- result << File.basename(filepath) unless filepath.empty?
281
- end
282
-
283
- # During an in-progress merge, files from MERGE_HEAD (e.g. main) show up
284
- # as staged additions. Exclude them so they are not tagged as ours.
285
- result - incoming_merge_files_from_git
361
+ self.class.uncommitted_files([migrate_dir])
286
362
  end
287
363
 
288
364
  def detect_merge_source_label(branch_mask)
@@ -305,15 +381,7 @@ module Railbow
305
381
  end
306
382
 
307
383
  def incoming_merge_files_from_git
308
- _, _, mh_status = Railbow::GitUtils.capture3("rev-parse", "MERGE_HEAD")
309
- return Set.new unless mh_status.success?
310
-
311
- output, _, status = Railbow::GitUtils.capture3(
312
- "diff", "--name-only", "--diff-filter=AR", "HEAD", "MERGE_HEAD", "--", migrate_dir
313
- )
314
- return Set.new unless status.success?
315
-
316
- Set.new(output.each_line.map { |l| File.basename(l.strip) }.reject(&:empty?))
384
+ self.class.incoming_merge_files([migrate_dir])
317
385
  end
318
386
  end
319
387
  end
@@ -69,7 +69,10 @@ module Railbow
69
69
  with column widths shared so the tables
70
70
  line up. Databases sharing a migrations
71
71
  path (shards) merge into one table with a
72
- status per database.
72
+ status per database. Migrations your branch
73
+ adds always show, even outside the window,
74
+ and a summarized database lists just those
75
+ (needs RBW_GIT=diff).
73
76
  focus - expand only the first
74
77
  database, summarizing the
75
78
  rest in a line each. A
@@ -29,6 +29,7 @@ module Railbow
29
29
  def print
30
30
  return print_solo(sections.first) if solo?
31
31
 
32
+ apply_branch_rows
32
33
  print_overview
33
34
  Railbow::Params.db_inline? ? print_inline : print_sections
34
35
  print_skipped
@@ -202,11 +203,22 @@ module Railbow
202
203
  puts formatter.dim("#{COLLAPSED} #{count_label(skipped.size, "database")} hidden: #{skipped.join(", ")}")
203
204
  end
204
205
 
206
+ # Your own migrations show up whichever database they target and however
207
+ # old they are: a drawn table gains the ones the time window left out, and
208
+ # a database that would collapse keeps a table of just those.
209
+ def apply_branch_rows
210
+ sections.each do |section|
211
+ next if section.branch_versions.empty?
212
+
213
+ collapse?(section) ? section.narrow_to_branch! : section.include_branch!
214
+ end
215
+ end
216
+
205
217
  # A quiet database has no table to draw, so one line says it all.
206
218
  # RBW_DB=focus collapses all but the first database too, unless one has
207
219
  # migrations pending.
208
220
  def collapse?(section)
209
- return false if Railbow::Params.db_full?
221
+ return false if Railbow::Params.db_full? || section.branch_only?
210
222
  return true if section.quiet?
211
223
  # Focus would empty the inline table of every database but the first.
212
224
  return false if Railbow::Params.db_inline?
@@ -241,13 +253,29 @@ module Railbow
241
253
  end
242
254
  end
243
255
 
256
+ # What a narrowed section's summary line would have warned about: pending
257
+ # or ghost migrations among the rows it does not draw.
258
+ def hidden_outside(section)
259
+ parts = []
260
+ parts << "#{section.hidden_pending_count} pending" if section.hidden_pending_count > 0
261
+ parts << count_label(section.hidden_ghost_count, "ghost") if section.hidden_ghost_count > 0
262
+ return nil if parts.empty?
263
+
264
+ "#{parts.join(", ")} outside the #{section.since_value} window - RBW_SINCE=all"
265
+ end
266
+
244
267
  # "──── primary · pawshop-dev ──── 12 of 240 ────", ruled out to where
245
268
  # the last column starts so it frames the table rather than floating.
246
269
  def section_header(section, rule_width)
247
270
  label = section.db_names.join(" + ")
248
271
  detail = section.sharded? ? shared_path(section) : section.database
249
272
  head = "#{RULE * 4} #{label} · #{detail} "
250
- head += "#{RULE * 4} #{shown_count(section)} of #{section.total_count} " if section.hidden_count > 0
273
+ if section.branch_only?
274
+ head += "#{RULE * 4} #{section.rows.size} on this branch of #{section.total_count} "
275
+ head += "#{RULE * 4} #{hidden_outside(section)} " if hidden_outside(section)
276
+ elsif section.hidden_count > 0
277
+ head += "#{RULE * 4} #{shown_count(section)} of #{section.total_count} "
278
+ end
251
279
 
252
280
  width = (rule_width > 0) ? rule_width : DEFAULT_RULE_WIDTH
253
281
  if (term = terminal_width)
@@ -52,6 +52,8 @@ module Railbow
52
52
  @databases = [{name: pool.db_config.name, database: pool.db_config.database}]
53
53
  @migrations_key = migrations_key_for(pool)
54
54
  @entries = {}
55
+ @all_entries = {}
56
+ @version_to_file = {}
55
57
  @ghosts = {}
56
58
  @hidden_count = 0
57
59
  @total_count = 0
@@ -82,11 +84,9 @@ module Railbow
82
84
  # Folds in another database running the same migration files. Anything
83
85
  # already built is discarded.
84
86
  def merge!(other)
85
- other.entries.each do |version, entry|
86
- mine = (@entries[version] ||= {name: entry[:name], statuses: {}})
87
- mine[:name] = entry[:name] if mine[:name].include?(NO_FILE)
88
- mine[:statuses].merge!(entry[:statuses])
89
- end
87
+ merge_entries(@entries, other.entries)
88
+ merge_entries(@all_entries, other.all_entries)
89
+ @version_to_file = other.version_to_file.merge(@version_to_file)
90
90
  @databases.concat(other.databases)
91
91
  @fallback_output = [fallback_output, other.fallback_output].compact.join
92
92
  @ghosts = other.ghosts.merge(@ghosts)
@@ -104,6 +104,57 @@ module Railbow
104
104
  databases.size > 1
105
105
  end
106
106
 
107
+ # Versions the checked-out branch adds to this database, wherever they
108
+ # fall relative to the time window. Needs RBW_GIT=diff, which is what
109
+ # already makes railbow branch-aware.
110
+ def branch_versions
111
+ return @branch_versions if @branch_versions
112
+ return @branch_versions = [] unless Railbow::Params.git_diff?
113
+
114
+ files = GitData.branch_files(migrations_key, base_override: Railbow::Params.git_base)
115
+ @branch_versions = @all_entries.keys.select do |version|
116
+ file = version_to_file[version]
117
+ file && files.include?(File.basename(file))
118
+ end.sort
119
+ end
120
+
121
+ # Adds the branch's migrations the time window left out, so a drawn
122
+ # table never hides your own work.
123
+ def include_branch!
124
+ missing = branch_versions - @entries.keys
125
+ return self if missing.empty?
126
+
127
+ @entries = @entries.merge(@all_entries.slice(*missing))
128
+ @hidden_count -= missing.size
129
+ reset_built
130
+ self
131
+ end
132
+
133
+ # Keeps only the branch's migrations, for a database that would otherwise
134
+ # collapse to a summary line.
135
+ def narrow_to_branch!
136
+ @entries = @all_entries.slice(*branch_versions)
137
+ @hidden_count = total_count - @entries.size
138
+ @floor_applied = false
139
+ @branch_only = true
140
+ reset_built
141
+ self
142
+ end
143
+
144
+ def branch_only?
145
+ @branch_only == true
146
+ end
147
+
148
+ # Pending migrations not among the rows drawn. A narrowed section still
149
+ # owes the reader what its summary line would have said.
150
+ def hidden_pending_count
151
+ pending_count - entries.count { |_, e| e[:statuses].value?("down") }
152
+ end
153
+
154
+ def hidden_ghost_count
155
+ ghost_count - entries.count { |_, e| e[:name].to_s.include?(NO_FILE) }
156
+ end
157
+
107
158
  # Answered from collected entries, so it costs no git work: it is asked
108
159
  # to decide whether to build the rows at all.
109
160
  def pending_in_view?
@@ -130,6 +181,12 @@ module Railbow
130
181
 
131
182
  attr_reader :latest_applied_version
132
183
 
184
+ protected
185
+
186
+ attr_reader :all_entries, :version_to_file
187
+
188
+ public
189
+
133
190
  def latest_applied_date
134
191
  version_date(latest_applied_version) if latest_applied_version
135
192
  end
@@ -166,7 +223,7 @@ module Railbow
166
223
 
167
224
  private
168
225
 
169
- attr_reader :formatter, :git, :version_to_file
226
+ attr_reader :formatter, :git
170
227
 
171
228
  def migrations_key_for(pool)
172
229
  paths = Array(pool.migration_context.migrations_paths)
@@ -181,6 +238,20 @@ module Railbow
181
238
  @built = false
182
239
  end
183
240
 
241
+ def merge_entries(into, from)
242
+ from.each do |version, entry|
243
+ mine = (into[version] ||= {name: entry[:name], statuses: {}})
244
+ mine[:name] = entry[:name] if mine[:name].include?(NO_FILE)
245
+ mine[:statuses].merge!(entry[:statuses])
246
+ end
247
+ end
248
+
249
+ def entries_for(db_list)
250
+ db_list.to_h do |status, version, name|
251
+ [version.to_s, {name: name, statuses: {db_name => status}}]
252
+ end
253
+ end
254
+
184
255
  def collect(pool)
185
256
  db_list = pool.migration_context.migrations_status
186
257
  @total_count = db_list.size
@@ -191,22 +262,20 @@ module Railbow
191
262
  return
192
263
  end
193
264
 
265
+ # The whole list, unfiltered: a summarized database can still show the
266
+ # branch's migrations, and those may sit outside the window.
267
+ @all_entries = entries_for(db_list)
268
+ pool.migration_context.migrations.each do |m|
269
+ @version_to_file[m.version.to_s] = m.filename
270
+ end
271
+
194
272
  db_list = apply_since_filter(db_list)
195
273
 
196
274
  # State tracks recency, not row count: a section whose only rows were
197
275
  # pulled in by the floor still has nothing recent to say, and should
198
276
  # still collapse in a multi-database run.
199
277
  @state = @window_count.zero? ? :none_in_period : :ok
200
- return if db_list.empty?
201
-
202
- @entries = db_list.to_h do |status, version, name|
203
- [version.to_s, {name: name, statuses: {db_name => status}}]
204
- end
205
-
206
- @version_to_file = {}
207
- pool.migration_context.migrations.each do |m|
208
- @version_to_file[m.version.to_s] = m.filename
209
- end
278
+ @entries = entries_for(db_list)
210
279
  end
211
280
 
212
281
  # Counted over every migration, not just the ones in the window, so a
@@ -287,8 +356,9 @@ module Railbow
287
356
  @tables_enabled = Railbow::Params.view_tables?
288
357
  end
289
358
 
290
- # Git lookups and ghost recovery happen here rather than during collect,
291
- # so a section that ends up collapsed never pays for them.
359
+ # Git history lookups and ghost recovery happen here rather than during
360
+ # collect, so a section that ends up collapsed never pays for them. It
361
+ # pays only the cheap branch lookup (#branch_versions).
292
362
  def build!
293
363
  @built = true
294
364
  @columns = []
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Railbow
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railbow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene M