╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭────────────────────────────────────────────────────╮ │684 }; │ │685 } │ │686 │ │583 -fn setForkDetails( │ │687 +fn setPatchDetails( │ │688 comptime repo_kind: rp.RepoKind, │ │689 comptime repo_opts: rp.RepoOpts(repo_kind),│ │690 io: std.Io, │ ╰────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────╮ │703 } │ │704 const target_branch = item.record.event.target_branch; │ │705 const revision = item.record.event.revision orelse continue;│ │602 - item.fork_oid = switch (item.record.event.status) { │ │706 + item.revision_oid = switch (item.record.event.status) { │ │707 .merged => |oid| oid, │ │708 else => revision.source_oid, │ │709 }; │ ╰─────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │813 .record = patch, │ │814 .author = try ui.Author.initFromEmail(admin_moment, arena, patch.author_email), │ │815 .draft = true, │ │712 - .fork_oid = try aa.dupe(u8, &fork_oid), │ │816 + .revision_oid = try aa.dupe(u8, &fork_oid), │ │817 .no_changes = if (target_oid) |oid| std.mem.eql(u8, &oid, &fork_oid) else false,│ │818 .fork_exists = true, │ │819 }; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │829 const aa = session.page_arena.allocator(); │ │830 const status_kind = entry.record.event.status.kind(); │ │831 const target_branch = entry.record.event.target_branch; │ │728 - var fields: [2]ui.widget.CopyableText.Choice = undefined; │ │729 - var field_count: usize = 0; │ │832 │ │833 if (status_kind != .merged and entry.fork_exists) if (session.data.git_ssh_port) |port| { │ │834 const url = try std.fmt.allocPrint(aa, "ssh://localhost:{d}/fork/{s}/patch:{s}", .{ port, self.identity, entry.id });│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │863 errdefer copyable_text.deinit(allocator); │ │864 try box.children.put(allocator, copyable_text.getFocus().id, .{ .widget = .{ .copyable_text = copyable_text }, .rect = null, .min_size = null }); │ │865 }; │ │764 - if (entry.fork_oid.len != 0) { │ │765 - fields[field_count] = .{ │ │866 + if (entry.record.event.source_branch) |branch| { │ │867 + var source = try wgt.TextBox.init(allocator, branch, .{ .label = " source branch ", .border_style = .single, .rounded_corners = true, .wrap_kind = .none });│ │868 + errdefer source.deinit(allocator); │ │869 + source.getFocus().mode = .all; │ │870 + try box.children.put(allocator, source.getFocus().id, .{ .widget = .{ .text_box = source }, .rect = null, .min_size = null }); │ │871 + } │ │872 + const fields = [_]ui.widget.CopyableText.Choice{ │ │873 + .{ │ │874 .selector = "from", │ │767 - .text = entry.fork_oid, │ │875 + .text = entry.revision_oid, │ │876 .label = if (entry.no_changes) " object id of this patch (no changes) " else " object id of this patch ", │ │769 - }; │ │770 - field_count += 1; │ │771 - } │ │772 - fields[field_count] = .{ │ │773 - .selector = "to", │ │774 - .text = target_branch, │ │775 - .label = if (status_kind == .merged) " target branch this patch was merged into " else " target branch this patch will go to ", │ │877 + }, │ │878 + .{ │ │879 + .selector = "to", │ │880 + .text = target_branch, │ │881 + .label = if (status_kind == .merged) " target branch this patch was merged into " else " target branch this patch will go to ", │ │882 + }, │ │883 }; │ │777 - field_count += 1; │ │778 - │ │779 - if (field_count > 0) { │ │780 - var copyable_text = try ui.widget.CopyableText.init(allocator, session, fields[0..field_count]); │ │781 - errdefer copyable_text.deinit(allocator); │ │782 - try box.children.put(allocator, copyable_text.getFocus().id, .{ .widget = .{ .copyable_text = copyable_text }, .rect = null, .min_size = null }); │ │783 - } │ │884 + var copyable_text = try ui.widget.CopyableText.init(allocator, session, fields[@intFromBool(entry.revision_oid.len == 0)..]); │ │885 + errdefer copyable_text.deinit(allocator); │ │886 + try box.children.put(allocator, copyable_text.getFocus().id, .{ .widget = .{ .copyable_text = copyable_text }, .rect = null, .min_size = null }); │ │887 } │ │888 │ │889 fn cloneDirectoryName(allocator: std.mem.Allocator, title: []const u8) ![]const u8 { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │941 } │ │942 │ │943 // new-patch tab; an edit or resolve url shows its tab in this place │ │841 - if (session.local == null) { │ │944 + { │ │945 const route = switch (data.view) { │ │946 .edit => ui.RoutablePage.repoThreadEditRoute(.patch, data.identity, data.selected_id) orelse return error.RouteTooLong,│ │947 .publish => ui.RoutablePage.repoPatchPublishRoute(data.identity, data.selected_id) orelse return error.RouteTooLong, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │967 } │ │968 │ │969 // drafts belong to the logged-in user and are not available locally │ │867 - if (session.local == null) { │ │970 + if (session.data.host_kind != .local) { │ │971 const route = ui.RoutablePage.repoPatchesDraftsRoute(data.identity) orelse return error.RouteTooLong; │ │972 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.drafts));│ │973 var label_buf: [64]u8 = undefined; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯