╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ try.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1564 commits: bool, 1565 1566 pub fn run(ctx: @This(), cursor: *rp.Repo(.xit, .{}).DB.Cursor(.read_write)) !void { 1567 var moment = try rp.Repo(.xit, .{}).DB.HashMap(.read_write).init(cursor.*); 1568 const state = rp.Repo(.xit, .{}).State(.read_write){ .core = ctx.core, .extra = .{ .moment = &moment } }; 1569 _ = try find.refreshInTransaction(.{}, state, &moment, ctx.io, ctx.allocator, null); 1570 if (ctx.commits) _ = try srch_cmmt.refreshInTransaction(.{}, state, &moment, ctx.io, ctx.allocator, &.{}, null); 1571 } 1572 }; 1573 1574 fn transaction(io: std.Io, repo: *rp.Repo(.xit, .{}), ctx: anytype) !void { 1575 const DB = rp.Repo(.xit, .{}).DB; 1576 try repo.core.db_file.lock(io, .exclusive); 1577 defer repo.core.db_file.unlock(io); 1578 1579 const history = try DB.ArrayList(.read_write).init(repo.core.db.rootCursor()); 1580 try history.appendContext(.{ .slot = try history.getSlot(-1) }, ctx); 1581 } 1582 1583 // recursively copy the contents of src_dir into dest_dir 1584 fn copyDir(io: std.Io, src_dir: std.Io.Dir, dest_dir: std.Io.Dir) !void { 1585 var iter = src_dir.iterate(); 1586 while (try iter.next(io)) |entry| { 1587 switch (entry.kind) { 1588 .file => try src_dir.copyFile(entry.name, dest_dir, entry.name, io, .{}), 1589 .directory => { 1590 try dest_dir.createDirPath(io, entry.name); 1591 var dest_entry_dir = try dest_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1592 defer dest_entry_dir.close(io); 1593 var src_entry_dir = try src_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1594 defer src_entry_dir.close(io); 1595 try copyDir(io, src_entry_dir, dest_entry_dir); 1596 }, 1597 else => {}, 1598 } 1599 } 1600 } 1601