╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ try.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1528 var moment = try rp.Repo(.xit, .{}).DB.HashMap(.read_write).init(cursor.*); 1529 const state = rp.Repo(.xit, .{}).State(.read_write){ .core = ctx.core, .extra = .{ .moment = &moment } }; 1530 _ = try find.refreshInTransaction(.{}, state, &moment, ctx.io, ctx.allocator, null); 1531 if (ctx.commits) _ = try srch_cmmt.refreshInTransaction(.{}, state, &moment, ctx.io, ctx.allocator, &.{}, null); 1532 } 1533 }; 1534 1535 fn transaction(io: std.Io, repo: *rp.Repo(.xit, .{}), ctx: anytype) !void { 1536 const DB = rp.Repo(.xit, .{}).DB; 1537 try repo.core.db_file.lock(io, .exclusive); 1538 defer repo.core.db_file.unlock(io); 1539 1540 const history = try DB.ArrayList(.read_write).init(repo.core.db.rootCursor()); 1541 try history.appendContext(.{ .slot = try history.getSlot(-1) }, ctx); 1542 } 1543 1544 // recursively copy the contents of src_dir into dest_dir 1545 fn copyDir(io: std.Io, src_dir: std.Io.Dir, dest_dir: std.Io.Dir) !void { 1546 var iter = src_dir.iterate(); 1547 while (try iter.next(io)) |entry| { 1548 switch (entry.kind) { 1549 .file => try src_dir.copyFile(entry.name, dest_dir, entry.name, io, .{}), 1550 .directory => { 1551 try dest_dir.createDirPath(io, entry.name); 1552 var dest_entry_dir = try dest_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1553 defer dest_entry_dir.close(io); 1554 var src_entry_dir = try src_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1555 defer src_entry_dir.close(io); 1556 try copyDir(io, src_entry_dir, dest_entry_dir); 1557 }, 1558 else => {}, 1559 } 1560 } 1561 } 1562