╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │495 target_repo: *rp.Repo(.xit, repo_opts), │ │454 - id_maybe: ?[evt.event_id_size]u8, │ │496 + progress_ctx_maybe: ?repo_opts.ProgressCtx, │ │497 ) !void { │ │456 - if (id_maybe) |id| return refreshMergeCheck(repo_opts, io, allocator, target_repo, &id); │ │457 - │ │498 // collect open patch ids before any refresh changes the database │ │499 const DB = evt.EventDB(repo_opts.hash); │ │460 - const moment = evt.currentMoment(repo_opts, target_repo) catch |err| switch (err) { │ │461 - error.NotFound => return, │ │462 - else => return err, │ │463 - }; │ │464 - const statuses_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, evt.Patch.status_to_id_set_key)) orelse return; │ │465 - const statuses = try DB.SortedMap(.read_only).init(statuses_cursor); │ │466 - const open_cursor = try statuses.getCursor("open") orelse return; │ │467 - const open = try DB.SortedSet(.read_only).init(open_cursor); │ │500 var ids: std.ArrayList([evt.event_id_size]u8) = .empty; │ │501 defer ids.deinit(allocator); │ │470 - var iter = try open.iteratorFromIndex(0); │ │471 - while (try iter.next()) |cursor| try ids.append(allocator, try evt.readOrderKeyId(DB, cursor)); │ │502 + collect: { │ │503 + const moment = evt.currentMoment(repo_opts, target_repo) catch |err| switch (err) { │ │504 + error.NotFound => break :collect, │ │505 + else => return err, │ │506 + }; │ │507 + const statuses_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, evt.Patch.status_to_id_set_key)) orelse break :collect; │ │508 + const statuses = try DB.SortedMap(.read_only).init(statuses_cursor); │ │509 + const open_cursor = try statuses.getCursor("open") orelse break :collect; │ │510 + const open = try DB.SortedSet(.read_only).init(open_cursor); │ │511 + var iter = try open.iteratorFromIndex(0); │ │512 + while (try iter.next()) |cursor| try ids.append(allocator, try evt.readOrderKeyId(DB, cursor)); │ │513 + } │ │514 │ │515 + // start progress reporting after the patch count is known │ │516 + if (repo_opts.ProgressCtx != void) { │ │517 + if (progress_ctx_maybe) |progress_ctx| progress_ctx.run(io, .{ .start = .{ .kind = .writing_patch, .estimated_total_items = ids.items.len } }) catch {};│ │518 + } │ │519 + │ │520 // refresh each collected patch independently │ │474 - for (ids.items) |id| refreshMergeability(repo_opts, io, allocator, target_repo, id); │ │521 + for (ids.items) |id| { │ │522 + refreshMergeability(repo_opts, io, allocator, target_repo, id); │ │523 + if (repo_opts.ProgressCtx != void) { │ │524 + if (progress_ctx_maybe) |progress_ctx| progress_ctx.run(io, .{ .complete_one = .writing_patch }) catch {}; │ │525 + } │ │526 + } │ │527 + │ │528 + // finish progress reporting after all patches have been visited │ │529 + if (repo_opts.ProgressCtx != void) { │ │530 + if (progress_ctx_maybe) |progress_ctx| progress_ctx.run(io, .{ .end = .writing_patch }) catch {}; │ │531 + } │ │532 } │ │533 │ │534 fn refreshMergeCheck( │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │1124 } │ │1125 │ │1126 // refresh other patches affected by the updated target branch. │ │1070 - refreshMergeability(repo_opts, io, allocator, target_repo, null); │ │1127 + refreshOpenMergeability(repo_opts, io, allocator, target_repo, null);│ │1128 │ │1129 // the merge moved the target branch, so its indexes follow │ │1130 find.refresh(repo_opts, io, allocator, target_repo) catch |err| { │ ╰───────────────────────────────────────────────────────────────────────────────╯