fix: reapply saved person merges to project files
This commit is contained in:
@@ -76,9 +76,11 @@ export function planProjectRevision(
|
||||
if (finalRoot === key) delete mapping[key].merged_into;
|
||||
else mapping[key].merged_into = finalRoot;
|
||||
}
|
||||
if (finalRoot !== oldRoot) {
|
||||
// Older files can still contain an alias even when the mapping already
|
||||
// points at its canonical person. Reapply that substitution on revisions.
|
||||
if (finalRoot !== key) {
|
||||
replacements[key] = { original: finalRoot, type: entry.type };
|
||||
merged.push(key);
|
||||
if (finalRoot !== oldRoot) merged.push(key);
|
||||
}
|
||||
}
|
||||
// A saved alias may still occur in older output files. Rewrite it together
|
||||
@@ -95,6 +97,8 @@ export async function reviseProjectRun(args: {
|
||||
previousDirectory: string;
|
||||
release: Set<string>;
|
||||
merges: Record<string, string>;
|
||||
/** Re-run already saved person merges against files from an older project stand. */
|
||||
reapplyMerges?: boolean;
|
||||
rewriteDocument: (filename: string, data: Buffer, replacements: PlaceholderMapping) => Promise<Buffer>;
|
||||
support?: string;
|
||||
}): Promise<{ run: ProjectRun; directory: string }> {
|
||||
@@ -104,7 +108,10 @@ export async function reviseProjectRun(args: {
|
||||
throw new Error("Es gibt bereits einen neueren Projektstand. Bitte die Liste aktualisieren.");
|
||||
}
|
||||
const plan = planProjectRevision(previous.mapping, args.release, args.merges);
|
||||
if (!plan.released.length && !plan.merged.length) throw new Error("Bitte mindestens einen Begriff freigeben oder Personen zusammenführen.");
|
||||
if (!plan.released.length && !plan.merged.length
|
||||
&& !(args.reapplyMerges && Object.keys(plan.replacements).length)) {
|
||||
throw new Error("Bitte mindestens einen Begriff freigeben oder Personen zusammenführen.");
|
||||
}
|
||||
const inPlace = Boolean(previous.inPlace || previous.sourceInPlace);
|
||||
const previousWhitelist = plan.whitelist.length
|
||||
? await loadProjectWhitelist(previous.projectPath, support) : [];
|
||||
|
||||
Reference in New Issue
Block a user