Lines 14–25 at 318 (were 14–24 at 55)
1414import { dirname, join, resolve } from "node:path"; 1515import type { Where } from "./api.ts"; 1616import { type Parsed, str, UsageError } from "./args.ts"; 17−import { globTest, snapshotAt, snapshotEntries } from "./at.ts";
18−import { type Env, type Output, open, plural } from "./commands.ts";
17+import { applySide, globTest, snapshotAt, snapshotEntries } from "./at.ts"; 18+import { type Env, EXIT, type Output, open, plural } from "./commands.ts"; 1919import { ignoredHere } from "./fetch.ts"; 2020import { loadIgnore, relativeTo } from "./folder.ts"; 2121import { type Refused, unsafePath } from "./safety.ts"; 22+import { refusalText, versionsText, withoutArg } from "./without.ts"; 2324/** The file an export leaves in its folder: what it holds, and the sign that the folder is one export may replace. */ 2425export const EXPORT_STAMP = ".abso-export"; Lines 82–92 at 318 (were 81–88 at 55)
8182 const rawVersion = str(args, "version"); 8283 if (rawVersion !== undefined && !/^\d+$/.test(rawVersion)) 8384 throw new UsageError(`--version is a version number (got ${JSON.stringify(rawVersion)})`); 85+ const leave = withoutArg(args); 8486 const diff = await api.diff(); 8587 const where: Where = { draft: diff.draft }; 88+ if (leave !== undefined && diff.draft !== null) 89+ throw new UsageError(`--without reads shared, and this folder is on draft ${diff.draft}`); 8690 // The listing names the version (the newest by default) and every file it holds; a server from before it answers 404. 8791 const listing = await api 8892 .filesAt(diff.draft, rawVersion === undefined ? undefined : Number(rawVersion)) Lines 106–127 at 318 (were 102–111 at 55)
105− why: "a binary file this folder has no copy of; abso sync --full, then export again",
109+ why: "a binary file this folder has no copy of; abso pull --full, then export again", 113+ // Without some versions: the server says what differs from this version, as it is without them. 114+ const without = leave === undefined ? undefined : await api.without(version, leave); 115+ if (without !== undefined && !without.ok) 120+ (vs) => `abso export ${args.positionals[0]} --version ${version} --without ${vs.join(",")}`, 122+ json: { ...without }, 124+ if (without !== undefined) applySide(snap, without.files, "after"); 109125 const entries = await snapshotEntries(api, snap); 110126 // Built before anything is removed, so a failed export leaves an earlier one whole. 111127 const keepGlob = str(args, "keep"); Lines 151–164 at 318 (were 135–147 at 55)
135151 project: config.project, 136152 space: diff.draft ?? "shared", 154+ ...(without !== undefined ? { without: without.without.map((w) => w.version), tree: without.tree } : {}), 139156 exportedAt: new Date().toISOString(), 141158 writeFileSync(join(target, EXPORT_STAMP), `${JSON.stringify(stamp)}\n`); 144− `Exported version ${version} of ${space} to ${target}: ${plural(written, "file")}. ${EXPORT_STAMP} there names the version; abso export to the same folder replaces it.`,
161+ `Exported version ${version} of ${space}${without !== undefined ? ` without ${versionsText(without.without.map((w) => w.version))}` : ""} to ${target}: ${plural(written, "file")}. ${EXPORT_STAMP} there names the version; abso export to the same folder replaces it.`, 145162 ...(kept.length > 0 ? [`Kept from the earlier export: ${kept.join(", ")}.`] : []), 146163 ...(skipped.length > 0 147164 ? [`Not exported (${skipped.length}):`, ...skipped.map((s) => ` ${s.path}: ${s.why}`)]