╭ changed ──────────╮ │src/event/Patch.zig│ ╰───────────────────╯ ╭───────────────────────────────╮ │ 4 const xit = @import("xit");│ │ 5 const rp = xit.repo; │ │ 6 const hash = xit.hash; │ │ 7 +const rf = xit.ref; │ │ 8 │ │ 9 title: []const u8, │ │10 description: []const u8, │ ╰───────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │34 std.mem.eql(u8, record.event.source_oid, self.source_oid) and │ │35 std.mem.eql(u8, record.event.target_ref, self.target_ref); │ │36 } │ │37 + │ │38 + pub fn targetBranch(self: Revision) ?[]const u8 { │ │39 + const target_ref = rf.Ref.initFromPath(self.target_ref, null) orelse return null;│ │40 + return switch (target_ref.kind) { │ │41 + .head => target_ref.name, │ │42 + else => null, │ │43 + }; │ │44 + } │ │45 }; │ │46 │ │47 pub const Record = struct { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────╮ │src/event/Repo.zig│ ╰──────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │177 return .{ .repo = try evt.read(Record, DB, hash_kind, arena, repo_map), .event_id = repo_id }; │ │178 } │ │179 │ │180 +pub fn readById( │ │181 + comptime DB: type, │ │182 + comptime hash_kind: hash.HashKind, │ │183 + haxy_moment: DB.HashMap(.read_only), │ │184 + arena: *std.heap.ArenaAllocator, │ │185 + id: []const u8, │ │186 +) !?Record { │ │187 + const records_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, record_map_key)) orelse return null;│ │188 + const records = try DB.HashMap(.read_only).init(records_cursor); │ │189 + const record_cursor = try records.getCursor(hash.hashInt(hash_kind, id)) orelse return null; │ │190 + return try evt.read(Record, DB, hash_kind, arena, try DB.HashMap(.read_only).init(record_cursor)); │ │191 +} │ │192 + │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/test/ui.zig│ ╰───────────────╯ ╭────────────────────────────────────────────────────────────────────╮ │17 const next_oid = "2222222222222222222222222222222222222222";│ │18 │ │19 const data = Commits{ │ │20 - .identity = identity, │ │20 + .location = .{ .repo = identity }, │ │21 .ref_or_oid = .object, │ │22 .ref_or_oid_value = oid0, │ │23 .commits = &.{ │ ╰────────────────────────────────────────────────────────────────────╯ ╭ changed ──╮ │src/try.zig│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1157 } │ │1158 if (status != .open) { │ │1159 try evt.Patch.update(.xit, .{}, io, allocator, target_repo, &patch_ids[i], .{ .status = status }, .{│ │1160 + .name = "admin", │ │1161 + .email = "admin@example.test", │ │1162 + }); │ │1163 + } │ │1164 + if (status == .merged) { │ │1165 + try fork.remove(io, allocator, repos_path, admin_repo, &patch_hex, user_id, .{ │ │1166 .name = "admin", │ │1167 .email = "admin@example.test", │ │1168 }); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭──────────────────────────────────────────────────────╮ │18 pub const Home = @import("./ui/Home.zig"); │ │19 pub const User = @import("./ui/User.zig"); │ │20 pub const Repo = @import("./ui/Repo.zig"); │ │21 +pub const Fork = @import("./ui/Fork.zig"); │ │22 pub const Title = @import("./ui/Title.zig"); │ │23 pub const SubTitle = @import("./ui/SubTitle.zig");│ │24 pub const Quit = @import("./ui/Quit.zig"); │ ╰──────────────────────────────────────────────────────╯ ╭──────────────────────────────────────╮ │45 home, │ │46 user, │ │47 repo, │ │48 + fork, │ │49 }; │ │50 │ │51 pub const Page = union(PageKind) {│ ╰──────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────╮ │52 home: Home, │ │53 user: User, │ │54 repo: Repo, │ │55 + fork: Fork, │ │56 │ │57 pub fn init(arena: *std.heap.ArenaAllocator, session: *Session, route: RoutablePage) !Page {│ │58 // the repo page can build without a moment in local mode; the home and │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │76 }, │ │77 .repo => switch (route) { │ │78 .repo_files, .repo_commits, .repo_refs, .repo_issues, .repo_patches, .repo_discussions, .repo_events, .repo_settings, .repo_auth => .{ .repo = try Repo.init(arena, session, route) },│ │79 + else => return error.UnexpectedRoute, │ │80 + }, │ │81 + .fork => switch (route) { │ │82 + .fork_patch, .fork_files, .fork_commits, .fork_settings, .fork_auth => .{ .fork = try Fork.init(arena, session, route) }, │ │83 else => return error.UnexpectedRoute, │ │84 }, │ │85 }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────╮ │153 repo_events: RepoEventsRoute, │ │154 repo_settings: Array(repo_route_max_len), │ │155 repo_auth: Array(repo_route_max_len), │ │156 + fork_patch: ForkRoute, │ │157 + fork_files: ForkFilesRoute, │ │158 + fork_commits: ForkCommitsRoute, │ │159 + fork_settings: ForkRoute, │ │160 + fork_auth: ForkRoute, │ │161 │ │162 pub const default: RoutablePage = .{ .home_repos = 0 };│ │163 │ ╰────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯