╭ changed ──╮ │src/try.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │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) = .{}; │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1459 const feature_new = try obj.writeCommit(.xit, opts, state, ctx.io, ctx.allocator, .{│ │1460 .message = "Revise the feature branch", │ │1461 .author = author_line, │ │1453 - .timestamp = 820, │ │1462 + .timestamp = ctx.timestamp, │ │1463 }, null, .{ .kind = .head, .name = "feature" }); │ │1464 │ │1465 // a branch the push creates has no old tip, so its range is open │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1484 } │ │1485 }; │ │1486 │ │1478 - try transaction(io, repo, Ctx{ .core = &repo.core, .io = io, .allocator = allocator, .users_dir = users_dir, .author = author }); │ │1487 + try transaction(io, repo, Ctx{ .core = &repo.core, .io = io, .allocator = allocator, .users_dir = users_dir, .author = author, .timestamp = timestamp });│ │1488 } │ │1489 │ │1490 // commit `events` onto `ref`, rooted at `parent`, as one transaction. │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯