retell-sync-cli 1.0.0 → 1.0.1
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.js +27 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -134695,21 +134695,36 @@ Warning: ${regressions.length} agent(s) would have their version regressed:`));
|
|
|
134695
134695
|
targetBranch = stdout.toString().trim();
|
|
134696
134696
|
}
|
|
134697
134697
|
spinner = createSpinner(`Merging ${branch} into ${targetBranch}...`);
|
|
134698
|
-
const {
|
|
134699
|
-
|
|
134700
|
-
|
|
134701
|
-
|
|
134702
|
-
|
|
134703
|
-
|
|
134704
|
-
|
|
134705
|
-
|
|
134698
|
+
const { stdout: srcStdout } = await $11`git rev-parse refs/heads/${branch}`.quiet();
|
|
134699
|
+
const srcSha = srcStdout.toString().trim();
|
|
134700
|
+
const { stdout: targetStdout, exitCode: targetExitCode } = await $11`git rev-parse refs/heads/${targetBranch} 2>/dev/null`.nothrow().quiet();
|
|
134701
|
+
if (targetExitCode !== 0) {
|
|
134702
|
+
await $11`git update-ref refs/heads/${targetBranch} ${srcSha}`.quiet();
|
|
134703
|
+
spinner.stop(source_default.green(`Created ${source_default.bold(targetBranch)} from ${source_default.bold(branch)}`));
|
|
134704
|
+
} else {
|
|
134705
|
+
const targetSha = targetStdout.toString().trim();
|
|
134706
|
+
if (srcSha === targetSha) {
|
|
134706
134707
|
spinner.stop(source_default.dim(`Already up to date`));
|
|
134707
134708
|
} else {
|
|
134708
|
-
|
|
134709
|
+
const { exitCode: isAncestor } = await $11`git merge-base --is-ancestor ${targetSha} ${srcSha}`.nothrow().quiet();
|
|
134710
|
+
if (isAncestor === 0) {
|
|
134711
|
+
await $11`git update-ref refs/heads/${targetBranch} ${srcSha}`.quiet();
|
|
134712
|
+
spinner.stop(source_default.green(`Fast-forwarded ${source_default.bold(targetBranch)} to ${source_default.bold(branch)}`));
|
|
134713
|
+
} else {
|
|
134714
|
+
const { stdout: mergeTreeOut, exitCode: mergeTreeExit } = await $11`git merge-tree --write-tree ${targetSha} ${srcSha}`.nothrow().quiet();
|
|
134715
|
+
if (mergeTreeExit !== 0) {
|
|
134716
|
+
spinner.stop(source_default.red(`Merge conflict`));
|
|
134717
|
+
console.error(source_default.red(`Cannot auto-merge ${branch} into ${targetBranch}. Resolve conflicts manually.`));
|
|
134718
|
+
} else {
|
|
134719
|
+
const mergedTreeSha = mergeTreeOut.toString().trim();
|
|
134720
|
+
const message = `Merge ${branch} into ${targetBranch}`;
|
|
134721
|
+
const { stdout: commitOut } = await $11`git commit-tree ${mergedTreeSha} -p ${targetSha} -p ${srcSha} -m ${message}`.quiet();
|
|
134722
|
+
const mergeCommitSha = commitOut.toString().trim();
|
|
134723
|
+
await $11`git update-ref refs/heads/${targetBranch} ${mergeCommitSha}`.quiet();
|
|
134724
|
+
spinner.stop(source_default.green(`Merged ${source_default.bold(branch)} into ${source_default.bold(targetBranch)}`));
|
|
134725
|
+
}
|
|
134726
|
+
}
|
|
134709
134727
|
}
|
|
134710
|
-
} else {
|
|
134711
|
-
spinner.stop(source_default.red(`Merge failed`));
|
|
134712
|
-
console.error(source_default.red(stderr.toString()));
|
|
134713
134728
|
}
|
|
134714
134729
|
}
|
|
134715
134730
|
}
|