@nomac/cli 0.11.7 → 0.11.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/session-transfer.mjs +8 -5
package/package.json
CHANGED
package/src/session-transfer.mjs
CHANGED
|
@@ -245,11 +245,14 @@ function conflictError(paths, side) {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
/** Sync's own refusal: what was sent, and the files left alone because they changed on the Mac. */
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
const listed = paths => paths.slice(0, 10).join(", ") + (paths.length > 10 ? ` and ${paths.length - 10} more` : "");
|
|
249
|
+
function syncConflictError(paths, sent, removal = {}) {
|
|
250
|
+
// What --delete did in the same run is said too: the refusal is the last word, not the only one.
|
|
251
|
+
const removed = removal.deleted?.length ? ` Deleted on the Mac, as here: ${listed(removal.deleted)}.` : "";
|
|
252
|
+
const kept = removal.kept_on_mac?.length ? ` Kept on the Mac, changed there since: ${listed(removal.kept_on_mac)}.` : "";
|
|
253
|
+
const error = new CliError("transfer conflict", `${sent ? `Sent ${sent} changed ${sent === 1 ? "file" : "files"}. ` : ""}Not sent, because ${paths.length === 1 ? "it" : "they"} changed on the Mac since this folder last synced: ${listed(paths)}. Keep the Mac's version: nomac pull ${paths[0]}. Replace it with yours: nomac sync . --overwrite${removed}${kept}`);
|
|
251
254
|
error.code = "transfer_conflict";
|
|
252
|
-
error.details = { paths, side: "Remote", sent };
|
|
255
|
+
error.details = { paths, side: "Remote", sent, ...removal };
|
|
253
256
|
return error;
|
|
254
257
|
}
|
|
255
258
|
|
|
@@ -290,7 +293,7 @@ export async function syncProject(session, store, { overwrite = false, dryRun =
|
|
|
290
293
|
for (const path of [...deleted, ...gone.filter(path => onMac[path] === "missing")]) delete baseline[path];
|
|
291
294
|
store.saveBaseline(baseline);
|
|
292
295
|
if (changedDuringTransfer.length) throw new CliError("transfer changed during verification", "Some files changed during transfer. Stop concurrent edits and rerun sync; verified files were recorded.");
|
|
293
|
-
if (conflicts.length) throw syncConflictError(conflicts, changed.length);
|
|
296
|
+
if (conflicts.length) throw syncConflictError(conflicts, changed.length, deleteMissing ? { deleted, kept_on_mac: keptOnMac } : {});
|
|
294
297
|
return { files: paths.length, changed, ...(deleteMissing ? { deleted, kept_on_mac: keptOnMac } : {}), ...summary, output };
|
|
295
298
|
}
|
|
296
299
|
|