╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │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 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───╮ │src/push.zig│ ╰────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │13 const serve_common = @import("serve_common.zig"); │ │14 const ssh = @import("serve_ssh_protocol.zig"); │ │15 const progress = @import("./progress.zig"); │ │16 +const notify = @import("notify.zig"); │ │17 │ │18 // prepare all reachable commits, including history received before patch│ │19 // generation was enabled. this shares the receive-pack transaction. │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────╮ │117 writer: *std.Io.Writer, │ │118 options: xit.net_server_receive_pack.Options,│ │119 author: evt.CommitAuthor, │ │120 + pusher_id: *const [evt.event_id_size]u8, │ │121 server: evt.Host.Server, │ │122 error_writer: *std.Io.Writer, │ │123 sess: ?*ssh.SessionCtx, │ ╰──────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │132 defer updates.deinit(); │ │133 │ │134 var sideband = progress.Sideband{ .response = &response, .writer = writer, .sess = sess };│ │135 + // the moment index the pushed events were consumed into │ │136 + var moment_index: ?u64 = null; │ │137 const Ctx = struct { │ │138 updates: *xit.net_server_receive_pack.AppliedRefUpdates, │ │139 core: *rp.Repo(.xit, repo_opts).Core, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────╮ │147 server: evt.Host.Server, │ │148 error_writer: *std.Io.Writer, │ │149 sideband: *progress.Sideband, │ │150 + moment_index: *?u64, │ │151 │ │152 pub fn run(ctx: @This(), cursor: *DB.Cursor(.read_write)) !void {│ │153 var moment = try DB.HashMap(.read_write).init(cursor.*); │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │164 // no-op consume must not cancel here, since the push shares the │ │165 // transaction and must commit regardless. │ │166 if (null != try rf.readRecur(.xit, repo_opts, state.readOnly(), ctx.io, .{ .ref = evt.events_ref })) { │ │162 - _ = try evt.consumeInTransaction(.repo, .xit, repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, evt.events_ref); │ │167 + ctx.moment_index.* = evt.consumeInTransaction(.repo, .xit, repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, evt.events_ref) catch |err| switch (err) {│ │168 + error.CancelTransaction => null, │ │169 + else => |e| return e, │ │170 + }; │ │171 try pch.detectMerged(repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, ctx.server.users_dir, ctx.updates.items.items, ctx.error_writer); │ │172 │ │173 // the revisions the pushed branches cause belong to the push │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────╮ │207 .server = server, │ │208 .error_writer = error_writer, │ │209 .sideband = &sideband, │ │210 + .moment_index = &moment_index,│ │211 }, │ │212 ); │ │213 }; │ ╰───────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯