╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │497 var closed_window = try thread.loadWindow(Self, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_patch, closed_set, closed_root, conflict_set, empty.selected_id, thread_comments_start); │ │498 var merged_window = try thread.loadWindow(Self, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_patch, merged_set, merged_root, conflict_set, empty.selected_id, thread_comments_start); │ │499 var conflicts_window = try thread.loadWindow(Self, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_patch, conflict_set, conflicts_root, conflict_set, empty.selected_id, thread_comments_start);│ │500 - try setForkAvailability(arena, admin_moment, &open_window); │ │501 - try setForkAvailability(arena, admin_moment, &closed_window); │ │502 - try setForkAvailability(arena, admin_moment, &merged_window); │ │503 - try setForkAvailability(arena, admin_moment, &conflicts_window); │ │500 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &open_window); │ │501 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &closed_window); │ │502 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &merged_window); │ │503 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &conflicts_window); │ │504 if (view == .conflicts and conflicts_window.count > 0) resolved_view = .conflicts; │ │505 │ │506 const comment_page = if (empty.comment_id.len == 0) │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │530 }; │ │531 } │ │532 │ │533 -fn setForkAvailability(arena: *std.heap.ArenaAllocator, admin_moment: ?evt.AdminDB.HashMap(.read_only), target: *Window) !void {│ │534 - const moment = admin_moment orelse return; │ │533 +fn setForkDetails( │ │534 + comptime repo_kind: rp.RepoKind, │ │535 + comptime repo_opts: rp.RepoOpts(repo_kind), │ │536 + io: std.Io, │ │537 + arena: *std.heap.ArenaAllocator, │ │538 + admin_moment: ?evt.AdminDB.HashMap(.read_only), │ │539 + repo: *rp.Repo(repo_kind, repo_opts), │ │540 + target: *Window, │ │541 +) !void { │ │542 if (target.items.len == 0) return; │ │543 const items = try arena.allocator().dupe(PatchWithId, target.items); │ │544 for (items) |*item| { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │538 - const id = try evt.parseEventId(item.id); │ │539 - const record = try evt.Fork.readById(evt.AdminDB, evt.admin_repo_opts.hash, moment, arena, &id); │ │540 - item.fork_exists = if (record) |value| !value.removed else false; │ │545 + if (admin_moment) |moment| { │ │546 + const id = try evt.parseEventId(item.id); │ │547 + const record = try evt.Fork.readById(evt.AdminDB, evt.admin_repo_opts.hash, moment, arena, &id);│ │548 + item.fork_exists = if (record) |value| !value.removed else false; │ │549 + } │ │550 + const revision = item.record.event.revision orelse continue; │ │551 + const target_branch = revision.targetBranch() orelse continue; │ │552 + item.fork_oid = revision.source_oid; │ │553 + item.target_branch = target_branch; │ │554 + if (item.record.event.status == .merged) continue; │ │555 + const target_oid = try repo.readRef(io, .{ .kind = .head, .name = target_branch }); │ │556 + item.no_changes = if (target_oid) |oid| std.mem.eql(u8, &oid, revision.source_oid) else false; │ │557 } │ │558 target.items = items; │ │559 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │675 │ │676 pub const Header = thread.Header; │ │677 │ │662 -pub fn appendDraftDetails(self: *const Self, allocator: std.mem.Allocator, box: *wgt.Box(ui.Widget), session: *ui.Session, entry: Entry) !void {│ │678 +pub fn appendDetails(self: *const Self, allocator: std.mem.Allocator, box: *wgt.Box(ui.Widget), session: *ui.Session, entry: Entry) !void { │ │679 const aa = session.page_arena.allocator(); │ │680 var fields: [2]ui.widget.CopyableText.Choice = undefined; │ │681 var field_count: usize = 0; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │682 │ │667 - if (entry.target_branch.len != 0) if (session.data.git_ssh_port) |port| { │ │683 + if (entry.record.event.status != .merged and entry.fork_exists and entry.target_branch.len != 0) if (session.data.git_ssh_port) |port| { │ │684 const url = try std.fmt.allocPrint(aa, "ssh://localhost:{d}/repo/{s}/patch:{s}/branch:{s}", .{ port, self.identity, entry.id, entry.target_branch });│ │685 const push_command = try std.fmt.allocPrint(aa, "git push {s} HEAD:patch", .{url}); │ │686 const clone_name = try cloneDirectoryName(aa, entry.record.event.title); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │718 fields[field_count] = .{ │ │719 .selector = "to", │ │720 .text = entry.target_branch, │ │705 - .label = " target branch this patch will go to ", │ │706 - .bottom_label = " (set by the url you push to above) ", │ │721 + .label = if (entry.record.event.status == .merged) " target branch this patch was merged into " else " target branch this patch will go to ",│ │722 + .bottom_label = if (entry.record.event.status == .merged) "" else " (set by the url you push to above) ", │ │723 }; │ │724 field_count += 1; │ │725 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │728 var copyable_text = try ui.widget.CopyableText.init(allocator, session, fields[0..field_count]); │ │729 errdefer copyable_text.deinit(allocator); │ │730 try box.children.put(allocator, copyable_text.getFocus().id, .{ .widget = .{ .copyable_text = copyable_text }, .rect = null, .min_size = null }); │ │715 - │ │716 - var spacer = try ui.widget.Spacer.init(allocator); │ │717 - errdefer spacer.deinit(allocator); │ │718 - try box.children.put(allocator, spacer.getFocus().id, .{ .widget = .{ .spacer = spacer }, .rect = null, .min_size = .{ .width = null, .height = 1 }, .max_size = .{ .width = null, .height = 1 } });│ │731 } │ │732 } │ │733 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯