edsger 0.21.6 → 0.21.7
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/services/branches.d.ts +8 -12
- package/dist/services/branches.js +19 -29
- package/package.json +1 -1
|
@@ -61,19 +61,15 @@ export declare function getNextPendingBranch(options: PipelinePhaseOptions): Pro
|
|
|
61
61
|
export declare function allBranchesCompleted(options: PipelinePhaseOptions): Promise<boolean>;
|
|
62
62
|
/**
|
|
63
63
|
* Get the base branch information for a branch.
|
|
64
|
-
* Returns:
|
|
65
|
-
* - If base_branch_id is null: use main (first branch in chain)
|
|
66
|
-
* - If base_branch_id is set and that branch is completed: use main
|
|
67
|
-
* (completed means feat merged to main)
|
|
68
|
-
* - If base_branch_id is set and that branch is merged: use base branch's feat branch
|
|
69
|
-
* (merged means dev merged to feat, not to main)
|
|
70
|
-
* - If base_branch_id is set and that branch is not merged: use base branch's dev branch
|
|
71
64
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* -
|
|
76
|
-
* -
|
|
65
|
+
* Rebase strategies based on base branch status:
|
|
66
|
+
* - no base_branch_id: git rebase main (first branch in chain)
|
|
67
|
+
* - completed (feat merged to main): git rebase main
|
|
68
|
+
* - merged (dev merged to feat): git rebase --onto main feat/xxx
|
|
69
|
+
* - in_progress/pending: git rebase dev/xxx (base on parent dev branch)
|
|
70
|
+
*
|
|
71
|
+
* For 'merged' status, we use --onto to rebase only new commits (after feat branch)
|
|
72
|
+
* onto main, avoiding conflicts from re-applying squashed commits.
|
|
77
73
|
*/
|
|
78
74
|
export declare function getBaseBranchInfo(branch: Branch, allBranches: Branch[], mainBranch?: string): Promise<{
|
|
79
75
|
baseBranch: string;
|
|
@@ -160,19 +160,15 @@ export async function allBranchesCompleted(options) {
|
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* Get the base branch information for a branch.
|
|
163
|
-
* Returns:
|
|
164
|
-
* - If base_branch_id is null: use main (first branch in chain)
|
|
165
|
-
* - If base_branch_id is set and that branch is completed: use main
|
|
166
|
-
* (completed means feat merged to main)
|
|
167
|
-
* - If base_branch_id is set and that branch is merged: use base branch's feat branch
|
|
168
|
-
* (merged means dev merged to feat, not to main)
|
|
169
|
-
* - If base_branch_id is set and that branch is not merged: use base branch's dev branch
|
|
170
163
|
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* -
|
|
175
|
-
* -
|
|
164
|
+
* Rebase strategies based on base branch status:
|
|
165
|
+
* - no base_branch_id: git rebase main (first branch in chain)
|
|
166
|
+
* - completed (feat merged to main): git rebase main
|
|
167
|
+
* - merged (dev merged to feat): git rebase --onto main feat/xxx
|
|
168
|
+
* - in_progress/pending: git rebase dev/xxx (base on parent dev branch)
|
|
169
|
+
*
|
|
170
|
+
* For 'merged' status, we use --onto to rebase only new commits (after feat branch)
|
|
171
|
+
* onto main, avoiding conflicts from re-applying squashed commits.
|
|
176
172
|
*/
|
|
177
173
|
export async function getBaseBranchInfo(branch, allBranches, mainBranch = 'main') {
|
|
178
174
|
// No base branch - start from main (first branch in chain)
|
|
@@ -195,27 +191,21 @@ export async function getBaseBranchInfo(branch, allBranches, mainBranch = 'main'
|
|
|
195
191
|
}
|
|
196
192
|
// Check if base branch is completed (feat merged to main)
|
|
197
193
|
if (baseBranch.status === 'completed') {
|
|
198
|
-
// Base branch's feat is merged to main
|
|
199
|
-
//
|
|
200
|
-
|
|
201
|
-
return {
|
|
202
|
-
baseBranch: mainBranch,
|
|
203
|
-
needsRebase: false,
|
|
204
|
-
baseBranchMerged: true,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
const featBranchName = baseBranch.branch_name.replace(/^dev\//, 'feat/');
|
|
194
|
+
// Base branch's feat is already squash-merged to main
|
|
195
|
+
// Just rebase directly to main - no need for --onto
|
|
196
|
+
// Main already contains all the changes, so a normal rebase will work correctly
|
|
208
197
|
return {
|
|
209
198
|
baseBranch: mainBranch,
|
|
210
|
-
originalBaseBranch
|
|
211
|
-
needsRebase:
|
|
199
|
+
// Don't set originalBaseBranch - we want a normal rebase, not --onto
|
|
200
|
+
needsRebase: false,
|
|
212
201
|
baseBranchMerged: true,
|
|
213
202
|
};
|
|
214
203
|
}
|
|
215
|
-
// Check if base branch is merged (dev merged to feat)
|
|
204
|
+
// Check if base branch is merged (dev merged to feat, but feat not yet merged to main)
|
|
216
205
|
if (baseBranch.status === 'merged') {
|
|
217
|
-
// Base branch's dev is merged to feat
|
|
218
|
-
//
|
|
206
|
+
// Base branch's dev is squash-merged to feat
|
|
207
|
+
// Use --onto to rebase only new commits (after feat branch) onto main
|
|
208
|
+
// This correctly handles the case where feat contains squashed commits
|
|
219
209
|
if (!baseBranch.branch_name) {
|
|
220
210
|
return {
|
|
221
211
|
baseBranch: mainBranch,
|
|
@@ -225,8 +215,8 @@ export async function getBaseBranchInfo(branch, allBranches, mainBranch = 'main'
|
|
|
225
215
|
}
|
|
226
216
|
const featBranchName = baseBranch.branch_name.replace(/^dev\//, 'feat/');
|
|
227
217
|
return {
|
|
228
|
-
baseBranch:
|
|
229
|
-
originalBaseBranch:
|
|
218
|
+
baseBranch: mainBranch, // Rebase onto main
|
|
219
|
+
originalBaseBranch: featBranchName, // Use feat branch for --onto
|
|
230
220
|
needsRebase: true,
|
|
231
221
|
baseBranchMerged: true,
|
|
232
222
|
};
|