ai-project-manage-cli 5.0.9 → 5.0.10
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/index.js +22 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -410,18 +410,30 @@ async function ensureFeatureBranch(branch, baselineBranch, options) {
|
|
|
410
410
|
await execGit(cwd, ["fetch", "origin", branch]);
|
|
411
411
|
await execGit(cwd, ["checkout", "-B", branch, `origin/${branch}`]);
|
|
412
412
|
} else if (await localBranchExists(cwd, branch)) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
if (await getCurrentBranch(cwd) !== branch) {
|
|
414
|
+
await execGit(cwd, ["checkout", branch]);
|
|
415
|
+
}
|
|
416
|
+
console.log(`[apm] \u5206\u652F ${branch} \u5DF2\u5B58\u5728\uFF0C\u8DF3\u8FC7\u521B\u5EFA`);
|
|
416
417
|
} else {
|
|
417
418
|
await execGit(cwd, ["fetch", "origin", baselineBranch]);
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
419
|
+
try {
|
|
420
|
+
await execGit(cwd, [
|
|
421
|
+
"checkout",
|
|
422
|
+
"-b",
|
|
423
|
+
branch,
|
|
424
|
+
`origin/${baselineBranch}`
|
|
425
|
+
]);
|
|
426
|
+
await execGit(cwd, ["push", "-u", "origin", branch]);
|
|
427
|
+
} catch (err) {
|
|
428
|
+
if (await localBranchExists(cwd, branch)) {
|
|
429
|
+
if (await getCurrentBranch(cwd) !== branch) {
|
|
430
|
+
await execGit(cwd, ["checkout", branch]);
|
|
431
|
+
}
|
|
432
|
+
console.log(`[apm] \u5206\u652F ${branch} \u5DF2\u5B58\u5728\uFF0C\u8DF3\u8FC7\u521B\u5EFA`);
|
|
433
|
+
} else {
|
|
434
|
+
throw err;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
425
437
|
}
|
|
426
438
|
}
|
|
427
439
|
console.log(`[apm] \u5DF2\u5C31\u7EEA\u5206\u652F ${branch}`);
|