╭ changed ──────╮ │src/ui/Repo.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────╮ │16 pub const Commits = @import("./Repo/Commits.zig"); │ │17 pub const Refs = @import("./Repo/Refs.zig"); │ │18 pub const Issues = @import("./Repo/Issues.zig"); │ │19 +pub const Patches = @import("./Repo/Patches.zig"); │ │20 pub const Discussions = @import("./Repo/Discussions.zig");│ │21 pub const Comment = @import("./Repo/Comment.zig"); │ │22 pub const Events = @import("./Repo/Events.zig"); │ ╰──────────────────────────────────────────────────────────────╯ ╭─────────────────────────────╮ │32 commits: Commits, │ │33 refs: Refs, │ │34 issues: Issues, │ │35 +patches: Patches, │ │36 discussions: Discussions,│ │37 events: Events, │ │38 settings: Settings, │ ╰─────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────╮ │130 const issues_comments_start: usize = switch (route) { │ │131 .repo_issues => |i| i.comments_start, │ │132 else => 0, │ │133 + }; │ │134 + const patches_tag: []const u8 = switch (route) { │ │135 + .repo_patches => |*p| p.tag.slice(), │ │136 + else => "", │ │137 + }; │ │138 + const patches_selected: []const u8 = switch (route) { │ │139 + .repo_patches => |*p| p.selected.slice(), │ │140 + else => "", │ │141 + }; │ │142 + const patches_comment: []const u8 = switch (route) { │ │143 + .repo_patches => |*p| p.comment.slice(), │ │144 + else => "", │ │145 + }; │ │146 + const patches_theirs: []const u8 = switch (route) { │ │147 + .repo_patches => |*p| p.theirs.slice(), │ │148 + else => "", │ │149 + }; │ │150 + const patches_view: ui.RoutablePage.PatchesView = switch (route) {│ │151 + .repo_patches => |p| p.view, │ │152 + else => .open, │ │153 }; │ │154 + const patches_comments_start: usize = switch (route) { │ │155 + .repo_patches => |p| p.comments_start, │ │156 + else => 0, │ │157 + }; │ │158 const discussions_tag: []const u8 = switch (route) { │ │159 .repo_discussions => |*t| t.tag.slice(), │ │160 else => "", │ ╰───────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │192 // the repo and owner-name metadata the header shows. local mode already│ │193 // knows all three; the server paths resolve them from the admin db. │ │194 var source: ?ui.RepoSource = null; │ │195 + var repo_id_maybe: ?[evt.event_id_size]u8 = null; │ │196 var repo: evt.Repo.Record = undefined; │ │197 var owner_name: []const u8 = undefined; │ │198 if (session.local) |local| { │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │209 const haxy_moment = session.haxy_moment orelse return error.NoMoment; │ │210 const found = (try evt.Repo.readByOwnerAndName(DB, hash_kind, haxy_moment, arena, repo_identity.owner, repo_identity.name)) orelse return error.NotFound;│ │211 repo = found.repo; │ │212 + repo_id_maybe = found.event_id; │ │213 │ │214 // resolve the creating user so the header can show their name to the left │ │215 // of the repo title. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │231 // route named none), so they end up viewing the same one and either's │ │232 // resolved ref can canonicalize the tab mirror urls below. no filesystem │ │233 // (wasm), nowhere to look, or a failed open: empty tabs. │ │206 - const files, const commits, const refs, var issues, var discussions, const events = blk: { │ │234 + const files, const commits, const refs, var issues, var patches, var discussions, const events = blk: {│ │235 read: { │ │236 const io = session.io orelse break :read; │ │237 const src = source orelse break :read; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │249 try Commits.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, session.haxy_moment, repo_identity.identity, requested_ref_or_oid, requested_ref_value, commits_content), │ │250 try Refs.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, repo_identity.identity, refs_kind, refs_from), │ │251 try Issues.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, repo_identity.identity, issues_tag, issues_selected, issues_comment, issues_comments_start, issues_theirs, issues_view), │ │252 + try Patches.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, session, repo_id_maybe, repo_identity.identity, patches_tag, patches_selected, patches_comment, patches_comments_start, patches_theirs, patches_view),│ │253 try Discussions.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, repo_identity.identity, discussions_tag, discussions_selected, discussions_comment, discussions_comments_start, discussions_view), │ │254 try Events.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, repo_identity.identity, events_view, events_kind, events_selected, session.local != null, session.data.sync_failure), │ │255 }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │264 try Commits.emptyResult(aa, repo_identity.identity, requested_ref_or_oid orelse .branch, requested_ref_value, commits_content), │ │265 try Refs.emptyResult(arena, repo_identity.identity, refs_kind, refs_from), │ │266 try Issues.emptyResult(aa, repo_identity.identity, issues_tag, issues_selected, issues_comment, issues_comments_start, issues_theirs, issues_view), │ │267 + try Patches.emptyResult(aa, repo_identity.identity, patches_tag, patches_selected, patches_comment, patches_comments_start, patches_theirs, patches_view), │ │268 try Discussions.emptyResult(aa, repo_identity.identity, discussions_tag, discussions_selected, discussions_comment, discussions_comments_start, discussions_view),│ │269 try Events.empty(aa, repo_identity.identity, events_view, session.local != null, session.data.sync_failure), │ │270 }; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │271 }; │ │272 issues.repo_source = source; │ │273 + patches.repo_source = source; │ │274 + patches.repo_id = repo_id_maybe; │ │275 + patches.target_branch = if (files.ref_or_oid == .branch) files.ref_or_oid_value else "";│ │276 discussions.repo_source = source; │ │277 │ │278 // each tab mirror carries this page's route for that tab; tabs not targeted │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │294 return .{ │ │295 // files and commits resolve the same ref, so either's serves the header, │ │296 // which points both tabs at it. │ │264 - .header = try Header.init(arena, repo.event.name, owner_name, files.ref_or_oid, files.ref_or_oid_value, issues_tag, discussions_tag), │ │297 + .header = try Header.init(arena, repo.event.name, owner_name, files.ref_or_oid, files.ref_or_oid_value, issues_tag, patches_tag, discussions_tag),│ │298 .repo = repo, │ │299 .files = files, │ │300 .commits = commits, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯