@fern-api/replay 0.15.1 → 0.15.2
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/dist/cli.cjs +2 -64
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +2 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -10
- package/dist/index.d.ts +1 -10
- package/dist/index.js +2 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -13739,7 +13739,7 @@ var ReplayDetector = class {
|
|
|
13739
13739
|
async detectPatchesInRange(rangeStart, lastGen, lock) {
|
|
13740
13740
|
const log = await this.git.exec([
|
|
13741
13741
|
"log",
|
|
13742
|
-
"--
|
|
13742
|
+
"--no-merges",
|
|
13743
13743
|
"--format=%H%x00%an%x00%ae%x00%s",
|
|
13744
13744
|
`${rangeStart}..HEAD`,
|
|
13745
13745
|
"--",
|
|
@@ -13759,18 +13759,6 @@ var ReplayDetector = class {
|
|
|
13759
13759
|
continue;
|
|
13760
13760
|
}
|
|
13761
13761
|
const parents = await this.git.getCommitParents(commit.sha);
|
|
13762
|
-
if (parents.length > 1) {
|
|
13763
|
-
const compositePatch = await this.createMergeCompositePatch({
|
|
13764
|
-
mergeCommit: commit,
|
|
13765
|
-
firstParent: parents[0],
|
|
13766
|
-
lastGen,
|
|
13767
|
-
lock
|
|
13768
|
-
});
|
|
13769
|
-
if (compositePatch) {
|
|
13770
|
-
newPatches.push(compositePatch);
|
|
13771
|
-
}
|
|
13772
|
-
continue;
|
|
13773
|
-
}
|
|
13774
13762
|
let patchContent;
|
|
13775
13763
|
try {
|
|
13776
13764
|
patchContent = await this.git.formatPatch(commit.sha);
|
|
@@ -13908,9 +13896,7 @@ var ReplayDetector = class {
|
|
|
13908
13896
|
* within the current linear detection window, and are absent from
|
|
13909
13897
|
* HEAD at the end of the window.
|
|
13910
13898
|
*
|
|
13911
|
-
* Rationale:
|
|
13912
|
-
* firstParent..mergeCommit so net-zero files never enter the composite. On
|
|
13913
|
-
* linear history each commit becomes its own patch, so a file that was
|
|
13899
|
+
* Rationale: each commit becomes its own patch, so a file that was
|
|
13914
13900
|
* briefly added and later removed survives as a create+delete pair whose
|
|
13915
13901
|
* cumulative diff is empty. We drop such patches before they reach the
|
|
13916
13902
|
* lockfile.
|
|
@@ -13977,54 +13963,6 @@ var ReplayDetector = class {
|
|
|
13977
13963
|
return /* @__PURE__ */ new Set();
|
|
13978
13964
|
}
|
|
13979
13965
|
}
|
|
13980
|
-
/**
|
|
13981
|
-
* Create a single composite patch for a merge commit by diffing the merge
|
|
13982
|
-
* commit against its first parent. This captures the net change of the
|
|
13983
|
-
* entire merged branch as one patch, eliminating accumulator chaining and
|
|
13984
|
-
* zero-net-change ghost conflicts.
|
|
13985
|
-
*/
|
|
13986
|
-
async createMergeCompositePatch(input) {
|
|
13987
|
-
const { mergeCommit, firstParent, lastGen, lock } = input;
|
|
13988
|
-
const forgottenHashes = new Set(lock.forgotten_hashes ?? []);
|
|
13989
|
-
const filesOutput = await this.git.exec([
|
|
13990
|
-
"diff",
|
|
13991
|
-
"--name-only",
|
|
13992
|
-
firstParent,
|
|
13993
|
-
mergeCommit.sha
|
|
13994
|
-
]);
|
|
13995
|
-
const { files, sensitiveFiles } = filterInfrastructureAndSensitiveFiles(filesOutput);
|
|
13996
|
-
if (sensitiveFiles.length > 0) {
|
|
13997
|
-
this.warnings.push(
|
|
13998
|
-
`Sensitive file(s) excluded from merge patch for commit ${mergeCommit.sha.slice(0, 7)}: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
|
|
13999
|
-
);
|
|
14000
|
-
}
|
|
14001
|
-
if (files.length === 0) return null;
|
|
14002
|
-
const diff = await this.git.exec([
|
|
14003
|
-
"diff",
|
|
14004
|
-
firstParent,
|
|
14005
|
-
mergeCommit.sha,
|
|
14006
|
-
"--",
|
|
14007
|
-
...files
|
|
14008
|
-
]);
|
|
14009
|
-
if (!diff.trim()) return null;
|
|
14010
|
-
const contentHash = this.computeContentHash(diff);
|
|
14011
|
-
if (lock.patches.some((p) => p.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
|
|
14012
|
-
return null;
|
|
14013
|
-
}
|
|
14014
|
-
const theirsSnapshot = await capturePatchSnapshot(this.git, files, mergeCommit.sha);
|
|
14015
|
-
return {
|
|
14016
|
-
id: `patch-merge-${mergeCommit.sha.slice(0, 8)}`,
|
|
14017
|
-
content_hash: contentHash,
|
|
14018
|
-
original_commit: mergeCommit.sha,
|
|
14019
|
-
original_message: mergeCommit.message,
|
|
14020
|
-
original_author: `${mergeCommit.authorName} <${mergeCommit.authorEmail}>`,
|
|
14021
|
-
base_generation: lastGen.commit_sha,
|
|
14022
|
-
files,
|
|
14023
|
-
patch_content: diff,
|
|
14024
|
-
...Object.keys(theirsSnapshot).length > 0 ? { theirs_snapshot: theirsSnapshot } : {},
|
|
14025
|
-
...this.isCreationOnlyPatch(diff) ? { user_owned: true } : {}
|
|
14026
|
-
};
|
|
14027
|
-
}
|
|
14028
13966
|
/**
|
|
14029
13967
|
* Detect patches via tree diff for non-linear history. Returns a composite patch.
|
|
14030
13968
|
* Revert reconciliation is skipped here because tree-diff produces a single composite
|