codemodctl 0.1.32 → 0.1.34
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.mjs +31 -9
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -117,16 +117,38 @@ const createPrCommand = defineCommand({
|
|
|
117
117
|
console.error(error);
|
|
118
118
|
process.exit(1);
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
{
|
|
121
|
+
const maxRetries = 3;
|
|
122
|
+
let pushed = false;
|
|
123
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
124
|
+
const pushResult = await $({
|
|
125
|
+
env: process.env.DEBUG ? {
|
|
126
|
+
GIT_TRACE: "1",
|
|
127
|
+
GIT_CURL_VERBOSE: "1"
|
|
128
|
+
} : {},
|
|
129
|
+
reject: false
|
|
130
|
+
})`git -c http.version=HTTP/1.1 -c http.postBuffer=524288000 push origin HEAD:refs/heads/${codemodBranchName} --force`;
|
|
131
|
+
if (pushResult.exitCode === 0) {
|
|
132
|
+
pushed = true;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
if (pushResult.stderr?.includes("Everything up-to-date")) {
|
|
136
|
+
console.log("Branch already up-to-date on remote.");
|
|
137
|
+
pushed = true;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
console.error(`Push attempt ${attempt}/${maxRetries} failed (exit code ${pushResult.exitCode}):\n${pushResult.stderr}`);
|
|
141
|
+
if (attempt < maxRetries) {
|
|
142
|
+
const delay = attempt * 2e3;
|
|
143
|
+
console.log(`Retrying in ${delay / 1e3}s...`);
|
|
144
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (!pushed) {
|
|
148
|
+
console.error("Error: Failed to push changes after all retries");
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
125
151
|
console.log(`Pushed branch to origin: ${codemodBranchName}`);
|
|
126
|
-
} catch (error) {
|
|
127
|
-
console.error("Error: Failed to push changes");
|
|
128
|
-
console.error(error);
|
|
129
|
-
process.exit(1);
|
|
130
152
|
}
|
|
131
153
|
}
|
|
132
154
|
if (body) prData.body = body;
|