╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ try.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1601 }; 1602 1603 fn transaction(io: std.Io, repo: *rp.Repo(.xit, .{}), ctx: anytype) !void { 1604 const DB = rp.Repo(.xit, .{}).DB; 1605 try repo.core.db_file.lock(io, .exclusive); 1606 defer repo.core.db_file.unlock(io); 1607 1608 const history = try DB.ArrayList(.read_write).init(repo.core.db.rootCursor()); 1609 try history.appendContext(.{ .slot = try history.getSlot(-1) }, ctx); 1610 } 1611 1612 // recursively copy the contents of src_dir into dest_dir 1613 fn copyDir(io: std.Io, src_dir: std.Io.Dir, dest_dir: std.Io.Dir) !void { 1614 var iter = src_dir.iterate(); 1615 while (try iter.next(io)) |entry| { 1616 switch (entry.kind) { 1617 .file => try src_dir.copyFile(entry.name, dest_dir, entry.name, io, .{}), 1618 .directory => { 1619 try dest_dir.createDirPath(io, entry.name); 1620 var dest_entry_dir = try dest_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1621 defer dest_entry_dir.close(io); 1622 var src_entry_dir = try src_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1623 defer src_entry_dir.close(io); 1624 try copyDir(io, src_entry_dir, dest_entry_dir); 1625 }, 1626 else => {}, 1627 } 1628 } 1629 } 1630