╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────╮ │11 const fork = @import("fork.zig"); │ │12 const serve_common = @import("serve_common.zig");│ │13 const progress = @import("./progress.zig"); │ │14 +const notify = @import("notify.zig"); │ │15 │ │16 // the action a patch merge records │ │17 pub const merge_undo_action = "haxy/merge"; │ ╰─────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 95 const history = try DB.ArrayList(.read_write).init(repo.core.db.rootCursor()); │ │ 96 try history.appendContext(.{ .slot = try history.getSlot(-1) }, Ctx{ .repo = repo, .io = io, .arena = &arena, .id = id, .patch = patch, .expected_patch = expected_patch, .author = author, .checks = &checks, .first_parent = first_parent });│ │ 97 } │ │ 97 - if (host == .server) evt.bumpRepoActivityAt(io, allocator, host.server, repo.core.work_path); │ │ 98 + if (host == .server) { │ │ 99 + notify.subscribeParticipants(io, allocator, host.server, repo.core.work_path, &.{.{ .id = id, .author = author, .event = .{ .patch = patch } }}); │ │100 + evt.bumpRepoActivityAt(io, allocator, host.server, repo.core.work_path); │ │101 + } │ │102 } │ │103 } │ │104 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │132 { │ │133 const parent = if (try rf.readRecur(.xit, repo_opts, state.readOnly(), io, .{ .ref = evt.events_ref }) == null) first_parent else null; │ │134 try evt.commitEvents(.xit, repo_opts, state, io, arena.child_allocator, evt.events_ref, &events, parent); │ │131 - if (!try evt.consumeInTransaction(.repo, .xit, repo_opts, state, &state.core.db, moment, io, arena.child_allocator, evt.events_ref)) return error.CancelTransaction;│ │135 + _ = try evt.consumeInTransaction(.repo, .xit, repo_opts, state, &state.core.db, moment, io, arena.child_allocator, evt.events_ref); │ │136 } │ │137 │ │138 // save mergeability before finishing the patch transaction │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │944 if (existing == null) patch.status = .open; │ │945 │ │946 // write the published patch and its forker to the target repository│ │947 + const events = &[_]evt.EventWithId{.{ │ │948 + .id = input.id, │ │949 + .timestamp = input.timestamp, │ │950 + .author = input.author, │ │951 + .event = .{ .patch = patch }, │ │952 + }}; │ │953 { │ │954 var checks: MergeCheckInputs(repo_opts) = .{}; │ │955 defer checks.deinit(io, allocator); │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │979 │ │980 const parent = if (try rf.readRecur(.xit, repo_opts, state.readOnly(), ctx.io, .{ .ref = evt.events_ref }) == null) ctx.first_parent else null; │ │981 try evt.commitEvents(.xit, repo_opts, state, ctx.io, ctx.allocator, evt.events_ref, ctx.events, parent); │ │972 - if (!try evt.consumeInTransaction(.repo, .xit, repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, evt.events_ref)) return error.CancelTransaction;│ │982 + _ = try evt.consumeInTransaction(.repo, .xit, repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, evt.events_ref); │ │983 _ = try ctx.checks.update(state, ctx.io, ctx.allocator); │ │984 try xit.undo.write(repo_opts, state, std.Io.Timestamp.now(ctx.io, .real).toSeconds(), .{ .custom = .{ .action_kind = evt.undo_action } }); │ │985 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │993 .core = &target_repo.core, │ │994 .io = io, │ │995 .allocator = allocator, │ │986 - .events = &.{.{ │ │987 - .id = input.id, │ │988 - .timestamp = input.timestamp, │ │989 - .author = input.author, │ │990 - .event = .{ .patch = patch }, │ │991 - }}, │ │996 + .events = events, │ │997 .patch_id = patch_id, │ │998 .forker_id = std.fmt.bytesToHex(input.user_id, .lower),│ │999 .checks = &checks, │ ╰────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1003 else => |e| return e, │ │1004 }; │ │1005 } │ │1006 + notify.subscribeParticipants(io, allocator, server, target_repo.core.work_path, events);│ │1007 evt.bumpRepoActivityAt(io, allocator, server, target_repo.core.work_path); │ │1008 │ │1009 // remove the consumed draft from the fork │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1426 │ │1427 // commit and consume the revision and patch events together. │ │1428 try evt.commitEvents(.xit, repo_opts, state, io, allocator, evt.events_ref, events.items, null); │ │1423 - if (!try evt.consumeInTransaction(.repo, .xit, repo_opts, state, db, moment, io, allocator, evt.events_ref)) return error.CancelTransaction;│ │1429 + _ = try evt.consumeInTransaction(.repo, .xit, repo_opts, state, db, moment, io, allocator, evt.events_ref); │ │1430 return true; │ │1431 } │ │1432 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯