╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────╮ │29 │ │30 // capture an existing branch without creating a fork│ │31 pub fn writeBranchPatch( │ │32 - host_kind: evt.HostKind, │ │32 + host: evt.Host, │ │33 comptime repo_kind: rp.RepoKind, │ │34 comptime repo_opts: rp.RepoOpts(repo_kind), │ │35 io: std.Io, │ ╰─────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │53 │ │54 // capture the branch revision and consume its events │ │55 const events = try branchEvents(repo_kind, repo_opts, .{ .core = &repo.core, .extra = .{} }, io, &arena, id, patch, author);│ │56 - try evt.consume(host_kind, .repo, repo_kind, repo_opts, io, allocator, repo, evt.events_ref, &events); │ │56 + try evt.consume(host, .repo, repo_kind, repo_opts, io, allocator, repo, evt.events_ref, &events); │ │57 } else { │ │58 const DB = evt.EventDB(repo_opts.hash); │ │59 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │86 // a branch patch has no fork, so this only names the patch to check │ │87 var checks: MergeCheckInputs(repo_opts) = .{}; │ │88 defer checks.deinit(io, allocator); │ │89 - if (host_kind == .server) try checks.add(io, allocator, &repo.core, try evt.parseEventId(&id), patch); │ │89 + if (host == .server) try checks.add(io, allocator, &repo.core, host.server.users_dir, try evt.parseEventId(&id), patch);│ │90 │ │91 try repo.core.db_file.lock(io, .exclusive); │ │92 defer repo.core.db_file.unlock(io); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │200 state: rp.Repo(repo_kind, repo_opts).State(.read_only), │ │201 moment: evt.EventDB(repo_opts.hash).HashMap(.read_only), │ │202 updates: ?[]const xit.net_server_receive_pack.AppliedRefUpdate, │ │203 - host_kind: evt.HostKind, │ │203 + host: evt.Host, │ │204 patches: *std.AutoArrayHashMapUnmanaged([evt.event_id_size]u8, evt.Patch.Record),│ │205 ) !void { │ │206 const DB = evt.EventDB(repo_opts.hash); │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │218 │ │219 // read the source tip before comparing stored revisions │ │220 const source = (try rf.readRecur(repo_kind, repo_opts, state, io, .{ .ref = .{ .kind = .head, .name = branch } })) orelse {│ │221 - if (host_kind == .server) std.log.warn("patch source branch missing: {s}", .{branch}); │ │221 + if (host == .server) std.log.warn("patch source branch missing: {s}", .{branch}); │ │222 continue; │ │223 }; │ │224 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │244 // transaction can cancel it. mergeability is only saved for branch patches:│ │245 // a fork's lock has to be taken before this transaction opened │ │246 pub fn refreshBranchesInTransaction( │ │247 - host_kind: evt.HostKind, │ │247 + host: evt.Host, │ │248 comptime repo_opts: rp.RepoOpts(.xit), │ │249 state: rp.Repo(.xit, repo_opts).State(.read_write), │ │250 moment: *evt.EventDB(repo_opts.hash).HashMap(.read_write), │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │263 error.NotFound => return false, │ │264 else => return err, │ │265 }; │ │266 - try collectOutdatedBranchPatches(.xit, repo_opts, io, allocator, &arena, state.readOnly(), events_moment, updates, host_kind, &patches);│ │266 + try collectOutdatedBranchPatches(.xit, repo_opts, io, allocator, &arena, state.readOnly(), events_moment, updates, host, &patches); │ │267 │ │268 const total = patches.count(); │ │269 if (total > 0) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │278 // a branch patch opens no fork, so its checks need no lock of their own │ │279 var checks: MergeCheckInputs(repo_opts) = .{}; │ │280 defer checks.deinit(io, allocator); │ │281 - if (host_kind == .server) try checks.add(io, allocator, state.core, id, record.event); │ │281 + if (host == .server) try checks.add(io, allocator, state.core, host.server.users_dir, id, record.event); │ │282 │ │283 const author = evt.CommitAuthor{ .name = "haxy", .email = record.author_email orelse "user@haxy" }; │ │284 writeBranchPatchInTransaction(repo_opts, state, moment, io, &arena, std.fmt.bytesToHex(id, .lower), record.event, record.event, author, first_parent, &checks) catch |err| {│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │295 // mergeability. this runs after the caller's transaction, and on xit writes│ │296 // every revision in one transaction of its own │ │297 pub fn refreshBranches( │ │298 - host_kind: evt.HostKind, │ │298 + host: evt.Host, │ │299 comptime repo_kind: rp.RepoKind, │ │300 comptime repo_opts: rp.RepoOpts(repo_kind), │ │301 io: std.Io, │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────╮ │315 core: *rp.Repo(.xit, repo_opts).Core, │ │316 io: std.Io, │ │317 allocator: std.mem.Allocator, │ │318 - host_kind: evt.HostKind, │ │318 + host: evt.Host, │ │319 updates: ?[]const xit.net_server_receive_pack.AppliedRefUpdate,│ │320 first_parent: ?[1][hash.hexLen(repo_opts.hash)]u8, │ │321 progress_ctx_maybe: ?repo_opts.ProgressCtx, │ ╰────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯