╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──╮ │src/try.zig│ ╰───────────╯ ╭─────────────────────────────────────────────────────╮ │1187 repo_user_id: *const [evt.event_id_size]u8,│ │1188 user_id: *const [evt.event_id_size]u8, │ │1189 random: std.Random, │ │1190 + now: u64, │ │1191 ) !void { │ │1192 const patch_data = [_]struct { │ │1193 title: []const u8, │ ╰─────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1247 const patch_author = evt.CommitAuthor{ .name = "admin", .email = "admin@example.test" }; │ │1248 var patch_ids: [patch_data.len][evt.event_id_size]u8 = undefined; │ │1249 for (patch_data, 0..) |patch, i| { │ │1242 - const timestamp: u64 = @intCast(500 + i * 10); │ │1250 + const timestamp = seedTimestamp(now, i, patch_data.len, 25 * std.time.s_per_day, 3 * std.time.s_per_hour);│ │1251 patch_ids[i] = evt.EventWithId.randomId(random); │ │1252 const patch_hex = std.fmt.bytesToHex(patch_ids[i], .lower); │ │1253 const path = try fork.create(.{}, io, allocator, users_dir, .{ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1333 for (&comments, 0..) |*comment, i| { │ │1334 comment.* = .{ │ │1335 .id = std.fmt.bytesToHex(comment_ids[i], .lower), │ │1328 - .timestamp = @intCast(700 + i), │ │1336 + .timestamp = seedTimestamp(now, i, comments.len, 2 * std.time.s_per_hour, 45), │ │1337 .author = .{ .name = if (i % 2 == 0) "alice" else "bobby", .email = if (i % 2 == 0) "alice@example.test" else "bobby@example.test" },│ │1338 .event = .{ .comment = .{ │ │1339 .thread_id = std.fmt.bytesToHex(patch_ids[patch_ids.len - 1], .lower), │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │1378 var ours = [_]evt.EventWithId{ │ │1379 .{ │ │1380 .id = std.fmt.bytesToHex(patch_ids[1], .lower), │ │1373 - .timestamp = 800, │ │1381 + .timestamp = now - 30 * std.time.s_per_min, │ │1382 .author = .{ .name = "alice", .email = "alice@example.test" },│ │1383 .event = .{ .patch = ours_values[0] }, │ │1384 }, │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │1385 .{ │ │1386 .id = std.fmt.bytesToHex(patch_ids[2], .lower), │ │1379 - .timestamp = 801, │ │1387 + .timestamp = now - 29 * std.time.s_per_min, │ │1388 .author = .{ .name = "alice", .email = "alice@example.test" },│ │1389 .event = .{ .patch = ours_values[1] }, │ │1390 }, │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │1391 .{ │ │1392 .id = std.fmt.bytesToHex(patch_ids[3], .lower), │ │1385 - .timestamp = 802, │ │1393 + .timestamp = now - 28 * std.time.s_per_min, │ │1394 .author = .{ .name = "alice", .email = "alice@example.test" },│ │1395 .event = .{ .patch = ours_values[2] }, │ │1396 }, │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │1397 }; │ │1398 │ │1399 var theirs = ours; │ │1392 - theirs[0].timestamp = 810; │ │1400 + theirs[0].timestamp = now - 25 * std.time.s_per_min; │ │1401 theirs[0].author = .{ .name = "bobby", .email = "bobby@example.test" };│ │1402 theirs[0].event.patch = theirs_values[0]; │ │1395 - theirs[1].timestamp = 811; │ │1403 + theirs[1].timestamp = now - 24 * std.time.s_per_min; │ │1404 theirs[1].author = .{ .name = "bobby", .email = "bobby@example.test" };│ │1405 theirs[1].event.patch = theirs_values[1]; │ │1398 - theirs[2].timestamp = 812; │ │1406 + theirs[2].timestamp = now - 23 * std.time.s_per_min; │ │1407 theirs[2].author = .{ .name = "bobby", .email = "bobby@example.test" };│ │1408 theirs[2].event.patch = theirs_values[2]; │ │1409 │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1426 │ │1427 // a push onto the branch that patch tracks, so the undo tab shows the │ │1428 // action and the patch refresh it sets off │ │1421 - try seedPush(io, allocator, target_repo, users_dir, patch_author); │ │1429 + try seedPush(io, allocator, target_repo, users_dir, patch_author, now - 15); │ │1430 try pch.refreshBranches(.{ .server = .{ .users_dir = users_dir } }, .xit, .{}, io, allocator, target_repo, null, null);│ │1431 } │ │1432 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1433 // stand in for a client push, which the fixture has no server to receive: one │ │1434 // transaction moves the branch, refreshes the patches tracking it and records │ │1435 // the action, the way receive-pack does │ │1428 -fn seedPush(io: std.Io, allocator: std.mem.Allocator, repo: *rp.Repo(.xit, .{}), users_dir: []const u8, author: evt.CommitAuthor) !void { │ │1436 +fn seedPush(io: std.Io, allocator: std.mem.Allocator, repo: *rp.Repo(.xit, .{}), users_dir: []const u8, author: evt.CommitAuthor, timestamp: u64) !void {│ │1437 const Repo = rp.Repo(.xit, .{}); │ │1438 const DB = Repo.DB; │ │1439 const Ctx = struct { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │1442 allocator: std.mem.Allocator, │ │1443 users_dir: []const u8, │ │1444 author: evt.CommitAuthor, │ │1445 + timestamp: u64, │ │1446 │ │1447 pub fn run(ctx: @This(), cursor: *DB.Cursor(.read_write)) !void {│ │1448 const opts: rp.RepoOpts(.xit) = .{}; │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯