╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ push.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
466 const target_update_moment = evt.currentMoment(repo_opts, target_repo) catch break :update; 467 const published_patch = (evt.Patch.readById(evt.EventDB(repo_opts.hash), repo_opts.hash, target_update_moment, &update_arena, &patch_id) catch break :update) orelse break :update; 468 if (published_patch.removed) break :update; 469 const fork_update_moment = evt.currentMoment(repo_opts, fork_repo) catch break :update; 470 const revision = (evt.PatchRev.readById(evt.EventDB(repo_opts.hash), repo_opts.hash, fork_update_moment, &update_arena, &revision_id) catch break :update) orelse break :update; 471 if (revision.removed) break :update; 472 const selected = evt.Patch.Revision.fromRecord(revision_id, revision); 473 if (published_patch.event.revision) |current| { 474 if (evt.fieldEqual(evt.Patch.Revision, current, selected)) break :update; 475 } 476 var patch = published_patch.event; 477 patch.revision = selected; 478 evt.consume(.{ .server = server }, .repo, .xit, repo_opts, io, allocator, target_repo, evt.events_ref, &.{.{ 479 .id = id.*, 480 .timestamp = timestamp, 481 .author = author, 482 .event = .{ .patch = patch }, 483 }}) catch |update_err| { 484 serve_common.logError(io, error_writer, "failed to update published patch {s}: {s}\n", .{ id, @errorName(update_err) }); 485 break :update; 486 }; 487 // consume also refreshed mergeability 488 refreshed = true; 489 } 490 491 if (!refreshed) pch.refreshMergeability(repo_opts, io, allocator, target_repo, server.users_dir, patch_id); 492 sideband.run(io, .{ .complete_one = .writing_patch }) catch {}; 493 sideband.run(io, .{ .end = .writing_patch }) catch {}; 494 495 // the client may read either repo as soon as it gets the final response. 496 try response.finish(writer, null); 497 } 498