╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ try.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1513 1514 pub fn run(ctx: @This(), cursor: *rp.Repo(.xit, .{}).DB.Cursor(.read_write)) !void { 1515 var moment = try rp.Repo(.xit, .{}).DB.HashMap(.read_write).init(cursor.*); 1516 const state = rp.Repo(.xit, .{}).State(.read_write){ .core = ctx.core, .extra = .{ .moment = &moment } }; 1517 _ = try find.refreshInTransaction(.{}, state, &moment, ctx.io, ctx.allocator, null); 1518 if (ctx.commits) _ = try srch_cmmt.refreshInTransaction(.{}, state, &moment, ctx.io, ctx.allocator, &.{}, null); 1519 } 1520 }; 1521 1522 fn transaction(io: std.Io, repo: *rp.Repo(.xit, .{}), ctx: anytype) !void { 1523 const DB = rp.Repo(.xit, .{}).DB; 1524 try repo.core.db_file.lock(io, .exclusive); 1525 defer repo.core.db_file.unlock(io); 1526 1527 const history = try DB.ArrayList(.read_write).init(repo.core.db.rootCursor()); 1528 try history.appendContext(.{ .slot = try history.getSlot(-1) }, ctx); 1529 } 1530 1531 // recursively copy the contents of src_dir into dest_dir 1532 fn copyDir(io: std.Io, src_dir: std.Io.Dir, dest_dir: std.Io.Dir) !void { 1533 var iter = src_dir.iterate(); 1534 while (try iter.next(io)) |entry| { 1535 switch (entry.kind) { 1536 .file => try src_dir.copyFile(entry.name, dest_dir, entry.name, io, .{}), 1537 .directory => { 1538 try dest_dir.createDirPath(io, entry.name); 1539 var dest_entry_dir = try dest_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1540 defer dest_entry_dir.close(io); 1541 var src_entry_dir = try src_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1542 defer src_entry_dir.close(io); 1543 try copyDir(io, src_entry_dir, dest_entry_dir); 1544 }, 1545 else => {}, 1546 } 1547 } 1548 } 1549