╭ changed ────╮ │build.zig.zon│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 3 .version = "0.0.0", │ │ 4 .dependencies = .{ │ │ 5 .xit = .{ │ │ 6 - .url = "git+https://github.com/xit-vcs/xit#cf3dda9285596889171ff8c3dff33549b3eb30e5",│ │ 7 - .hash = "xit-0.0.0-Ub3nDFF1UwHbs36cNTAD6KVt4W6aHvt9Q3098WrOtKEB", │ │ 6 + .url = "git+https://github.com/xit-vcs/xit#af3d8da9918650b1307ce66d45bd6300f31e1e89",│ │ 7 + .hash = "xit-0.0.0-Ub3nDP-vUwF35WVwa11ze1S3l2Y01uUktq4T8ErrjAq1", │ │ 8 }, │ │ 9 }, │ │10 .paths = .{ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │364 │ │365 try commitEvents(.xit, repo_opts, state, ctx.io, ctx.allocator, ctx.ref, ctx.events, ctx.first_parent_oids); │ │366 if (!try consumeInTransaction(role, .xit, repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, ctx.ref)) return error.CancelTransaction;│ │367 - try xit.undo.writeMessage(repo_opts, state, .{ .custom = "event" }); │ │367 + try xit.undo.write(repo_opts, state, std.Io.Timestamp.now(ctx.io, .real).toSeconds(), .{ .custom = .{ .action = "event" } }); │ │368 } │ │369 }; │ │370 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │429 var moment = try DB.HashMap(.read_write).init(cursor.*); │ │430 const state = State(.read_write){ .core = ctx.core, .extra = .{ .moment = &moment } }; │ │431 if (!try mergeEventsInTransaction(.xit, repo_opts, state, ctx.io, ctx.allocator, ctx.remote_ref)) return error.CancelTransaction;│ │432 - try xit.undo.writeMessage(repo_opts, state, .{ .custom = "event" }); │ │432 + try xit.undo.write(repo_opts, state, std.Io.Timestamp.now(ctx.io, .real).toSeconds(), .{ .custom = .{ .action = "event" } }); │ │433 } │ │434 }; │ │435 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───╮ │src/fork.zig│ ╰────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │149 try bch.add(.xit, repo_opts, state, ctx.io, .{ .name = ref.name, .target = .none }); │ │150 } │ │151 try rf.replaceHead(.xit, repo_opts, state, ctx.io, .{ .ref = ref }); │ │152 - try xit.undo.writeMessage(repo_opts, state, .{ .custom = "create fork" }); │ │152 + try xit.undo.write(repo_opts, state, std.Io.Timestamp.now(ctx.io, .real).toSeconds(), .{ .custom = .{ .action = "create_fork" } });│ │153 } │ │154 }; │ │155 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │68 const parent = if (try rf.readRecur(repo_kind, repo_opts, state.readOnly(), ctx.io, .{ .ref = evt.events_ref }) == null) ctx.first_parent else null; │ │69 try evt.commitEvents(repo_kind, repo_opts, state, ctx.io, ctx.arena.child_allocator, evt.events_ref, &events, parent); │ │70 if (!try evt.consumeInTransaction(.repo, repo_kind, repo_opts, state, &ctx.repo.core.db, &moment, ctx.io, ctx.arena.child_allocator, evt.events_ref)) return error.CancelTransaction;│ │71 - try xit.undo.writeMessage(repo_opts, state, .{ .custom = "update branch patch" }); │ │71 + try xit.undo.write(repo_opts, state, std.Io.Timestamp.now(ctx.io, .real).toSeconds(), .{ .custom = .{ .action = "update_branch_patch" } }); │ │72 } │ │73 }; │ │74 { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │727 // retain the submitted revision and snapshot the merge result │ │728 if (!try importMergedRevision(repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, ctx.fork_repo, &ctx.patch_id, .{ .revision = ctx.revision, .before_oid = &before_oid, .after_oid = &after_oid }, ctx.expected_patch, ctx.author, ctx.timestamp)) return error.PatchOutOfDate;│ │729 │ │730 - try xit.undo.writeMessage(repo_opts, state, .{ .custom = "merge patch" }); │ │730 + try xit.undo.write(repo_opts, state, std.Io.Timestamp.now(ctx.io, .real).toSeconds(), .{ .custom = .{ .action = "merge_patch" } }); │ │731 } │ │732 }; │ │733 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───╮ │src/push.zig│ ╰────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │68 } │ │69 var progress = PushProgress{ .response = response, .writer = writer }; │ │70 try xit.patch.writePatches(repo_opts, state, io, allocator, &iter, &progress); │ │71 +} │ │72 + │ │73 +fn writeUndo( │ │74 + comptime repo_opts: rp.RepoOpts(.xit), │ │75 + state: rp.Repo(.xit, repo_opts).State(.read_write), │ │76 + io: std.Io, │ │77 + allocator: std.mem.Allocator, │ │78 + author: ?evt.CommitAuthor, │ │79 +) !void { │ │80 + var author_json: std.json.ObjectMap = if (author) |user| │ │81 + try .init(allocator, &.{ "username", "email" }, &.{ .{ .string = user.name }, .{ .string = user.email } }) │ │82 + else │ │83 + .empty; │ │84 + defer author_json.deinit(allocator); │ │85 + var payload: std.json.ObjectMap = try .init(allocator, &.{"author"}, &.{if (author != null) .{ .object = author_json } else .null}); │ │86 + defer payload.deinit(allocator); │ │87 + try xit.undo.write(repo_opts, state, std.Io.Timestamp.now(io, .real).toSeconds(), .{ .custom = .{ .action = "push", .payload = payload } });│ │88 } │ │89 │ │90 // serve a receive-pack and consume any events it pushed to the events branch, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────╮ │ 98 reader: *std.Io.Reader, │ │ 99 writer: *std.Io.Writer, │ │100 options: xit.net_server_receive_pack.Options,│ │101 + author: ?evt.CommitAuthor, │ │102 repo_root_path: []const u8, │ │103 error_writer: *std.Io.Writer, │ │104 ) !void { │ ╰──────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────╮ │118 reader: *std.Io.Reader, │ │119 writer: *std.Io.Writer, │ │120 options: xit.net_server_receive_pack.Options, │ │121 + author: ?evt.CommitAuthor, │ │122 response: *xit.net_server_receive_pack.Response,│ │123 repo_root_path: []const u8, │ │124 error_writer: *std.Io.Writer, │ ╰─────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │140 _ = try evt.consumeInTransaction(.repo, .xit, repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, evt.events_ref); │ │141 try pch.detectMerged(repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, ctx.repo_root_path, ctx.updates.items.items, ctx.error_writer);│ │142 } │ │124 - try xit.undo.writeMessage(repo_opts, state, .push); │ │143 + try writeUndo(repo_opts, state, ctx.io, ctx.allocator, ctx.author); │ │144 } │ │145 }; │ │146 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯