@teambit/lanes 0.0.393 → 0.0.396

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.
@@ -1,377 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- require("core-js/modules/es.array.iterator.js");
6
-
7
- require("core-js/modules/es.promise.js");
8
-
9
- Object.defineProperty(exports, "__esModule", {
10
- value: true
11
- });
12
- exports.mergeLanes = mergeLanes;
13
-
14
- function _chalk() {
15
- const data = _interopRequireDefault(require("chalk"));
16
-
17
- _chalk = function () {
18
- return data;
19
- };
20
-
21
- return data;
22
- }
23
-
24
- function _bitError() {
25
- const data = require("@teambit/bit-error");
26
-
27
- _bitError = function () {
28
- return data;
29
- };
30
-
31
- return data;
32
- }
33
-
34
- function _pMapSeries() {
35
- const data = _interopRequireDefault(require("p-map-series"));
36
-
37
- _pMapSeries = function () {
38
- return data;
39
- };
40
-
41
- return data;
42
- }
43
-
44
- function _bitId() {
45
- const data = require("@teambit/legacy/dist/bit-id");
46
-
47
- _bitId = function () {
48
- return data;
49
- };
50
-
51
- return data;
52
- }
53
-
54
- function _laneId() {
55
- const data = require("@teambit/lane-id");
56
-
57
- _laneId = function () {
58
- return data;
59
- };
60
-
61
- return data;
62
- }
63
-
64
- function _repositories() {
65
- const data = require("@teambit/legacy/dist/scope/repositories");
66
-
67
- _repositories = function () {
68
- return data;
69
- };
70
-
71
- return data;
72
- }
73
-
74
- function _consumer() {
75
- const data = require("@teambit/legacy/dist/api/consumer");
76
-
77
- _consumer = function () {
78
- return data;
79
- };
80
-
81
- return data;
82
- }
83
-
84
- async function mergeLanes({
85
- merging,
86
- workspace,
87
- laneName,
88
- mergeStrategy,
89
- remoteName,
90
- noSnap,
91
- snapMessage,
92
- existingOnWorkspaceOnly,
93
- build,
94
- keepReadme,
95
- squash,
96
- pattern,
97
- includeDeps,
98
- skipDependencyInstallation
99
- }) {
100
- const consumer = workspace.consumer;
101
- const currentLaneId = consumer.getCurrentLaneId();
102
-
103
- if (!remoteName && laneName === currentLaneId.name) {
104
- throw new (_bitError().BitError)(`unable to merge lane "${laneName}", you're already at this lane. to get updates, simply run "bit checkout head"`);
105
- }
106
-
107
- const parsedLaneId = await consumer.getParsedLaneId(laneName);
108
- const localLane = currentLaneId.isDefault() ? null : await consumer.scope.loadLane(currentLaneId);
109
- let bitIds;
110
- let otherLane;
111
- let remoteLane;
112
- let otherLaneName;
113
-
114
- const isDefaultLane = laneName === _laneId().DEFAULT_LANE;
115
-
116
- if (isDefaultLane) {
117
- if (!localLane) throw new Error(`unable to merge ${_laneId().DEFAULT_LANE}, the current lane was not found`);
118
- bitIds = await consumer.scope.getDefaultLaneIdsFromLane(localLane);
119
- otherLaneName = _laneId().DEFAULT_LANE;
120
- } else if (remoteName) {
121
- const remoteLaneId = _laneId().LaneId.from(parsedLaneId.name, remoteName);
122
-
123
- remoteLane = await consumer.scope.objects.remoteLanes.getRemoteLane(remoteLaneId);
124
-
125
- if (!remoteLane.length) {
126
- throw new (_bitError().BitError)(`unable to switch to "${laneName}" of "${remoteName}", the remote lane was not found or not fetched locally`);
127
- }
128
-
129
- bitIds = await consumer.scope.objects.remoteLanes.getRemoteBitIds(remoteLaneId);
130
- otherLaneName = `${remoteName}/${parsedLaneId.name}`;
131
- } else {
132
- otherLane = await consumer.scope.loadLane(parsedLaneId);
133
- if (!otherLane) throw new (_bitError().BitError)(`unable to switch to "${laneName}", the lane was not found`);
134
- bitIds = otherLane.components.map(c => c.id.changeVersion(c.head.toString()));
135
- otherLaneName = parsedLaneId.name;
136
- }
137
-
138
- let allComponentsStatus = await getAllComponentsStatus();
139
-
140
- if (pattern) {
141
- const componentIds = await workspace.resolveMultipleComponentIds(bitIds);
142
- const compIdsFromPattern = workspace.scope.filterIdsFromPoolIdsByPattern(pattern, componentIds);
143
- allComponentsStatus = await filterComponentsStatus(allComponentsStatus, compIdsFromPattern, bitIds, workspace, includeDeps, otherLane || undefined);
144
- bitIds.forEach(bitId => {
145
- if (!allComponentsStatus.find(c => c.id.isEqualWithoutVersion(bitId))) {
146
- allComponentsStatus.push({
147
- id: bitId,
148
- unmergedLegitimately: true,
149
- unmergedMessage: `excluded by pattern`
150
- });
151
- }
152
- });
153
- }
154
-
155
- if (existingOnWorkspaceOnly) {
156
- const workspaceIds = await workspace.listIds();
157
- const compIdsFromPattern = workspaceIds.filter(id => allComponentsStatus.find(c => c.id.isEqualWithoutVersion(id._legacy)));
158
- allComponentsStatus = await filterComponentsStatus(allComponentsStatus, compIdsFromPattern, bitIds, workspace, includeDeps);
159
- bitIds.forEach(bitId => {
160
- if (!allComponentsStatus.find(c => c.id.isEqualWithoutVersion(bitId))) {
161
- allComponentsStatus.push({
162
- id: bitId,
163
- unmergedLegitimately: true,
164
- unmergedMessage: `not in the workspace`
165
- });
166
- }
167
- });
168
- }
169
-
170
- throwForFailures();
171
-
172
- if (squash) {
173
- squashSnaps(allComponentsStatus, laneName, consumer);
174
- }
175
-
176
- const mergeResults = await merging.mergeSnaps({
177
- mergeStrategy,
178
- allComponentsStatus,
179
- remoteName,
180
- laneId: parsedLaneId,
181
- localLane,
182
- noSnap,
183
- snapMessage,
184
- build,
185
- skipDependencyInstallation
186
- });
187
- const mergedSuccessfully = !mergeResults.failedComponents || mergeResults.failedComponents.length === 0 || mergeResults.failedComponents.every(failedComponent => failedComponent.unchangedLegitimately);
188
- let deleteResults = {};
189
-
190
- if (!keepReadme && otherLane && otherLane.readmeComponent && mergedSuccessfully) {
191
- var _otherLane$readmeComp, _otherLane$readmeComp2;
192
-
193
- // await consumer.bitMap.syncWithLanes(consumer.bitMap.workspaceLane);
194
- const readmeComponentId = [otherLane.readmeComponent.id.changeVersion((_otherLane$readmeComp = otherLane.readmeComponent) === null || _otherLane$readmeComp === void 0 ? void 0 : (_otherLane$readmeComp2 = _otherLane$readmeComp.head) === null || _otherLane$readmeComp2 === void 0 ? void 0 : _otherLane$readmeComp2.hash).toString()];
195
- deleteResults = await (0, _consumer().remove)({
196
- ids: readmeComponentId,
197
- force: false,
198
- remote: false,
199
- track: false,
200
- deleteFiles: true
201
- });
202
- } else if (otherLane && !otherLane.readmeComponent) {
203
- deleteResults = {
204
- readmeResult: `\nlane ${otherLane.name} doesn't have a readme component`
205
- };
206
- }
207
-
208
- return {
209
- mergeResults,
210
- deleteResults
211
- };
212
-
213
- async function getAllComponentsStatus() {
214
- const tmp = new (_repositories().Tmp)(consumer.scope);
215
-
216
- try {
217
- const componentsStatus = await Promise.all(bitIds.map(bitId => merging.getComponentMergeStatus(bitId, localLane, otherLaneName)));
218
- await tmp.clear();
219
- return componentsStatus;
220
- } catch (err) {
221
- await tmp.clear();
222
- throw err;
223
- }
224
- }
225
-
226
- function throwForFailures() {
227
- const failedComponents = allComponentsStatus.filter(c => c.unmergedMessage && !c.unmergedLegitimately);
228
-
229
- if (failedComponents.length) {
230
- const failureMsgs = failedComponents.map(failedComponent => `${_chalk().default.bold(failedComponent.id.toString())} - ${_chalk().default.red(failedComponent.unmergedMessage)}`).join('\n');
231
- throw new (_bitError().BitError)(`unable to merge due to the following failures:\n${failureMsgs}`);
232
- }
233
- }
234
- }
235
-
236
- async function filterComponentsStatus(allComponentsStatus, compIdsToKeep, allBitIds, workspace, includeDeps = false, lane) {
237
- const bitIdsFromPattern = _bitId().BitIds.fromArray(compIdsToKeep.map(c => c._legacy));
238
-
239
- const bitIdsNotFromPattern = allBitIds.filter(bitId => !bitIdsFromPattern.hasWithoutVersion(bitId));
240
- const filteredComponentStatus = [];
241
- const depsToAdd = [];
242
- await (0, _pMapSeries().default)(compIdsToKeep, async compId => {
243
- const fromStatus = allComponentsStatus.find(c => c.id.isEqualWithoutVersion(compId._legacy));
244
-
245
- if (!fromStatus) {
246
- throw new Error(`filterComponentsStatus: unable to find ${compId.toString()} in component-status`);
247
- }
248
-
249
- filteredComponentStatus.push(fromStatus);
250
-
251
- if (fromStatus.unmergedMessage) {
252
- return;
253
- }
254
-
255
- const {
256
- divergeData
257
- } = fromStatus;
258
-
259
- if (!divergeData) {
260
- throw new Error(`filterComponentsStatus: unable to find divergeData for ${compId.toString()}`);
261
- }
262
-
263
- const remoteVersions = divergeData.snapsOnRemoteOnly;
264
-
265
- if (!remoteVersions.length) {
266
- return;
267
- }
268
-
269
- const modelComponent = await workspace.consumer.scope.getModelComponent(compId._legacy); // optimization suggestion: if squash is given, check only the last version.
270
-
271
- const laneIds = lane === null || lane === void 0 ? void 0 : lane.toBitIds();
272
- await (0, _pMapSeries().default)(remoteVersions, async remoteVersion => {
273
- const versionObj = await modelComponent.loadVersion(remoteVersion.toString(), workspace.consumer.scope.objects);
274
- const flattenedDeps = versionObj.getAllFlattenedDependencies();
275
- const depsNotIncludeInPattern = flattenedDeps.filter(id => bitIdsNotFromPattern.find(bitId => bitId.isEqualWithoutVersion(id)));
276
-
277
- if (!depsNotIncludeInPattern.length) {
278
- return;
279
- }
280
-
281
- const depsOnLane = [];
282
- await Promise.all(depsNotIncludeInPattern.map(async dep => {
283
- const isOnLane = await workspace.consumer.scope.isIdOnLane(dep, lane, laneIds);
284
-
285
- if (isOnLane) {
286
- depsOnLane.push(dep);
287
- }
288
- }));
289
-
290
- if (!depsOnLane.length) {
291
- return;
292
- }
293
-
294
- if (!includeDeps) {
295
- throw new (_bitError().BitError)(`unable to merge ${compId.toString()}.
296
- it has (in version ${remoteVersion.toString()}) the following dependencies which were not included in the pattern. consider adding "--include-deps" flag
297
- ${depsOnLane.map(d => d.toString()).join('\n')}`);
298
- }
299
-
300
- depsToAdd.push(...depsOnLane);
301
- });
302
- });
303
-
304
- if (depsToAdd.length) {
305
- const depsUniq = _bitId().BitIds.uniqFromArray(depsToAdd);
306
-
307
- depsUniq.forEach(id => {
308
- const fromStatus = allComponentsStatus.find(c => c.id.isEqualWithoutVersion(id));
309
-
310
- if (!fromStatus) {
311
- throw new Error(`filterComponentsStatus: unable to find ${id.toString()} in component-status`);
312
- }
313
-
314
- filteredComponentStatus.push(fromStatus);
315
- });
316
- }
317
-
318
- return filteredComponentStatus;
319
- }
320
-
321
- function squashSnaps(allComponentsStatus, laneName, consumer) {
322
- const succeededComponents = allComponentsStatus.filter(c => !c.unmergedMessage);
323
- succeededComponents.forEach(({
324
- id,
325
- divergeData,
326
- componentFromModel
327
- }) => {
328
- if (!divergeData) {
329
- throw new Error(`unable to squash. divergeData is missing from ${id.toString()}`);
330
- }
331
-
332
- if (divergeData.isDiverged()) {
333
- throw new (_bitError().BitError)(`unable to squash because ${id.toString()} is diverged in history.
334
- consider switching to ${laneName} first, merging this lane, then switching back to this lane and merging ${laneName}`);
335
- }
336
-
337
- if (divergeData.isLocalAhead()) {
338
- // nothing to do. current is ahead, nothing to merge. (it was probably filtered out already as a "failedComponent")
339
- return;
340
- }
341
-
342
- if (!divergeData.isRemoteAhead()) {
343
- // nothing to do. current and remote are the same, nothing to merge. (it was probably filtered out already as a "failedComponent")
344
- return;
345
- } // remote is ahead and was not diverge.
346
-
347
-
348
- const remoteSnaps = divergeData.snapsOnRemoteOnly;
349
-
350
- if (remoteSnaps.length === 0) {
351
- throw new Error(`remote is ahead but it has no snaps. it's impossible`);
352
- }
353
-
354
- if (remoteSnaps.length === 1) {
355
- // nothing to squash. it has only one commit.
356
- return;
357
- }
358
-
359
- if (!componentFromModel) {
360
- throw new Error('unable to squash, the componentFromModel is missing');
361
- } // do the squash.
362
-
363
-
364
- if (divergeData.commonSnapBeforeDiverge) {
365
- componentFromModel.addAsOnlyParent(divergeData.commonSnapBeforeDiverge);
366
- } else {
367
- // there is no commonSnapBeforeDiverge. the local has no snaps, all are remote, no need for parents. keep only head.
368
- componentFromModel.parents.forEach(ref => componentFromModel.removeParent(ref));
369
- }
370
-
371
- const squashedSnaps = remoteSnaps.filter(snap => !snap.isEqual(componentFromModel.hash()));
372
- componentFromModel.setSquashed(squashedSnaps);
373
- consumer.scope.objects.add(componentFromModel);
374
- });
375
- }
376
-
377
- //# sourceMappingURL=merge-lanes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["mergeLanes","merging","workspace","laneName","mergeStrategy","remoteName","noSnap","snapMessage","existingOnWorkspaceOnly","build","keepReadme","squash","pattern","includeDeps","skipDependencyInstallation","consumer","currentLaneId","getCurrentLaneId","name","BitError","parsedLaneId","getParsedLaneId","localLane","isDefault","scope","loadLane","bitIds","otherLane","remoteLane","otherLaneName","isDefaultLane","DEFAULT_LANE","Error","getDefaultLaneIdsFromLane","remoteLaneId","LaneId","from","objects","remoteLanes","getRemoteLane","length","getRemoteBitIds","components","map","c","id","changeVersion","head","toString","allComponentsStatus","getAllComponentsStatus","componentIds","resolveMultipleComponentIds","compIdsFromPattern","filterIdsFromPoolIdsByPattern","filterComponentsStatus","undefined","forEach","bitId","find","isEqualWithoutVersion","push","unmergedLegitimately","unmergedMessage","workspaceIds","listIds","filter","_legacy","throwForFailures","squashSnaps","mergeResults","mergeSnaps","laneId","mergedSuccessfully","failedComponents","every","failedComponent","unchangedLegitimately","deleteResults","readmeComponent","readmeComponentId","hash","remove","ids","force","remote","track","deleteFiles","readmeResult","tmp","Tmp","componentsStatus","Promise","all","getComponentMergeStatus","clear","err","failureMsgs","chalk","bold","red","join","compIdsToKeep","allBitIds","lane","bitIdsFromPattern","BitIds","fromArray","bitIdsNotFromPattern","hasWithoutVersion","filteredComponentStatus","depsToAdd","pMapSeries","compId","fromStatus","divergeData","remoteVersions","snapsOnRemoteOnly","modelComponent","getModelComponent","laneIds","toBitIds","remoteVersion","versionObj","loadVersion","flattenedDeps","getAllFlattenedDependencies","depsNotIncludeInPattern","depsOnLane","dep","isOnLane","isIdOnLane","d","depsUniq","uniqFromArray","succeededComponents","componentFromModel","isDiverged","isLocalAhead","isRemoteAhead","remoteSnaps","commonSnapBeforeDiverge","addAsOnlyParent","parents","ref","removeParent","squashedSnaps","snap","isEqual","setSquashed","add"],"sources":["merge-lanes.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport pMapSeries from 'p-map-series';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ApplyVersionResults } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { ComponentID } from '@teambit/component-id';\nimport { Workspace } from '@teambit/workspace';\nimport { LaneId, DEFAULT_LANE } from '@teambit/lane-id';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport { MergingMain, ComponentMergeStatus } from '@teambit/merging';\nimport { remove } from '@teambit/legacy/dist/api/consumer';\nimport { MergeLaneOptions } from './lanes.main.runtime';\n\nexport async function mergeLanes({\n merging,\n workspace,\n laneName,\n mergeStrategy,\n remoteName,\n noSnap,\n snapMessage,\n existingOnWorkspaceOnly,\n build,\n keepReadme,\n squash,\n pattern,\n includeDeps,\n skipDependencyInstallation,\n}: {\n merging: MergingMain;\n workspace: Workspace;\n laneName: string;\n} & MergeLaneOptions): Promise<{ mergeResults: ApplyVersionResults; deleteResults: any }> {\n const consumer = workspace.consumer;\n const currentLaneId = consumer.getCurrentLaneId();\n if (!remoteName && laneName === currentLaneId.name) {\n throw new BitError(\n `unable to merge lane \"${laneName}\", you're already at this lane. to get updates, simply run \"bit checkout head\"`\n );\n }\n const parsedLaneId = await consumer.getParsedLaneId(laneName);\n const localLane = currentLaneId.isDefault() ? null : await consumer.scope.loadLane(currentLaneId);\n let bitIds: BitId[];\n let otherLane: Lane | null | undefined;\n let remoteLane;\n let otherLaneName: string;\n const isDefaultLane = laneName === DEFAULT_LANE;\n\n if (isDefaultLane) {\n if (!localLane) throw new Error(`unable to merge ${DEFAULT_LANE}, the current lane was not found`);\n bitIds = await consumer.scope.getDefaultLaneIdsFromLane(localLane);\n otherLaneName = DEFAULT_LANE;\n } else if (remoteName) {\n const remoteLaneId = LaneId.from(parsedLaneId.name, remoteName);\n remoteLane = await consumer.scope.objects.remoteLanes.getRemoteLane(remoteLaneId);\n if (!remoteLane.length) {\n throw new BitError(\n `unable to switch to \"${laneName}\" of \"${remoteName}\", the remote lane was not found or not fetched locally`\n );\n }\n bitIds = await consumer.scope.objects.remoteLanes.getRemoteBitIds(remoteLaneId);\n otherLaneName = `${remoteName}/${parsedLaneId.name}`;\n } else {\n otherLane = await consumer.scope.loadLane(parsedLaneId);\n if (!otherLane) throw new BitError(`unable to switch to \"${laneName}\", the lane was not found`);\n bitIds = otherLane.components.map((c) => c.id.changeVersion(c.head.toString()));\n otherLaneName = parsedLaneId.name;\n }\n\n let allComponentsStatus = await getAllComponentsStatus();\n\n if (pattern) {\n const componentIds = await workspace.resolveMultipleComponentIds(bitIds);\n const compIdsFromPattern = workspace.scope.filterIdsFromPoolIdsByPattern(pattern, componentIds);\n allComponentsStatus = await filterComponentsStatus(\n allComponentsStatus,\n compIdsFromPattern,\n bitIds,\n workspace,\n includeDeps,\n otherLane || undefined\n );\n bitIds.forEach((bitId) => {\n if (!allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(bitId))) {\n allComponentsStatus.push({ id: bitId, unmergedLegitimately: true, unmergedMessage: `excluded by pattern` });\n }\n });\n }\n if (existingOnWorkspaceOnly) {\n const workspaceIds = await workspace.listIds();\n const compIdsFromPattern = workspaceIds.filter((id) =>\n allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(id._legacy))\n );\n allComponentsStatus = await filterComponentsStatus(\n allComponentsStatus,\n compIdsFromPattern,\n bitIds,\n workspace,\n includeDeps\n );\n bitIds.forEach((bitId) => {\n if (!allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(bitId))) {\n allComponentsStatus.push({ id: bitId, unmergedLegitimately: true, unmergedMessage: `not in the workspace` });\n }\n });\n }\n\n throwForFailures();\n\n if (squash) {\n squashSnaps(allComponentsStatus, laneName, consumer);\n }\n\n const mergeResults = await merging.mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n remoteName,\n laneId: parsedLaneId,\n localLane,\n noSnap,\n snapMessage,\n build,\n skipDependencyInstallation,\n });\n\n const mergedSuccessfully =\n !mergeResults.failedComponents ||\n mergeResults.failedComponents.length === 0 ||\n mergeResults.failedComponents.every((failedComponent) => failedComponent.unchangedLegitimately);\n\n let deleteResults = {};\n\n if (!keepReadme && otherLane && otherLane.readmeComponent && mergedSuccessfully) {\n // await consumer.bitMap.syncWithLanes(consumer.bitMap.workspaceLane);\n\n const readmeComponentId = [\n otherLane.readmeComponent.id.changeVersion(otherLane.readmeComponent?.head?.hash).toString(),\n ];\n\n deleteResults = await remove({\n ids: readmeComponentId,\n force: false,\n remote: false,\n track: false,\n deleteFiles: true,\n });\n } else if (otherLane && !otherLane.readmeComponent) {\n deleteResults = { readmeResult: `\\nlane ${otherLane.name} doesn't have a readme component` };\n }\n\n return { mergeResults, deleteResults };\n\n async function getAllComponentsStatus(): Promise<ComponentMergeStatus[]> {\n const tmp = new Tmp(consumer.scope);\n try {\n const componentsStatus = await Promise.all(\n bitIds.map((bitId) => merging.getComponentMergeStatus(bitId, localLane, otherLaneName))\n );\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n }\n\n function throwForFailures() {\n const failedComponents = allComponentsStatus.filter((c) => c.unmergedMessage && !c.unmergedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unmergedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to merge due to the following failures:\\n${failureMsgs}`);\n }\n }\n}\n\nasync function filterComponentsStatus(\n allComponentsStatus: ComponentMergeStatus[],\n compIdsToKeep: ComponentID[],\n allBitIds: BitId[],\n workspace: Workspace,\n includeDeps = false,\n lane?: Lane\n): Promise<ComponentMergeStatus[]> {\n const bitIdsFromPattern = BitIds.fromArray(compIdsToKeep.map((c) => c._legacy));\n const bitIdsNotFromPattern = allBitIds.filter((bitId) => !bitIdsFromPattern.hasWithoutVersion(bitId));\n const filteredComponentStatus: ComponentMergeStatus[] = [];\n const depsToAdd: BitId[] = [];\n await pMapSeries(compIdsToKeep, async (compId) => {\n const fromStatus = allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(compId._legacy));\n if (!fromStatus) {\n throw new Error(`filterComponentsStatus: unable to find ${compId.toString()} in component-status`);\n }\n filteredComponentStatus.push(fromStatus);\n if (fromStatus.unmergedMessage) {\n return;\n }\n const { divergeData } = fromStatus;\n if (!divergeData) {\n throw new Error(`filterComponentsStatus: unable to find divergeData for ${compId.toString()}`);\n }\n const remoteVersions = divergeData.snapsOnRemoteOnly;\n if (!remoteVersions.length) {\n return;\n }\n const modelComponent = await workspace.consumer.scope.getModelComponent(compId._legacy);\n // optimization suggestion: if squash is given, check only the last version.\n const laneIds = lane?.toBitIds();\n await pMapSeries(remoteVersions, async (remoteVersion) => {\n const versionObj = await modelComponent.loadVersion(remoteVersion.toString(), workspace.consumer.scope.objects);\n const flattenedDeps = versionObj.getAllFlattenedDependencies();\n const depsNotIncludeInPattern = flattenedDeps.filter((id) =>\n bitIdsNotFromPattern.find((bitId) => bitId.isEqualWithoutVersion(id))\n );\n if (!depsNotIncludeInPattern.length) {\n return;\n }\n const depsOnLane: BitId[] = [];\n await Promise.all(\n depsNotIncludeInPattern.map(async (dep) => {\n const isOnLane = await workspace.consumer.scope.isIdOnLane(dep, lane, laneIds);\n if (isOnLane) {\n depsOnLane.push(dep);\n }\n })\n );\n if (!depsOnLane.length) {\n return;\n }\n if (!includeDeps) {\n throw new BitError(`unable to merge ${compId.toString()}.\nit has (in version ${remoteVersion.toString()}) the following dependencies which were not included in the pattern. consider adding \"--include-deps\" flag\n${depsOnLane.map((d) => d.toString()).join('\\n')}`);\n }\n depsToAdd.push(...depsOnLane);\n });\n });\n if (depsToAdd.length) {\n const depsUniq = BitIds.uniqFromArray(depsToAdd);\n depsUniq.forEach((id) => {\n const fromStatus = allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(id));\n if (!fromStatus) {\n throw new Error(`filterComponentsStatus: unable to find ${id.toString()} in component-status`);\n }\n filteredComponentStatus.push(fromStatus);\n });\n }\n return filteredComponentStatus;\n}\n\nfunction squashSnaps(allComponentsStatus: ComponentMergeStatus[], laneName: string, consumer: Consumer) {\n const succeededComponents = allComponentsStatus.filter((c) => !c.unmergedMessage);\n succeededComponents.forEach(({ id, divergeData, componentFromModel }) => {\n if (!divergeData) {\n throw new Error(`unable to squash. divergeData is missing from ${id.toString()}`);\n }\n if (divergeData.isDiverged()) {\n throw new BitError(`unable to squash because ${id.toString()} is diverged in history.\nconsider switching to ${laneName} first, merging this lane, then switching back to this lane and merging ${laneName}`);\n }\n if (divergeData.isLocalAhead()) {\n // nothing to do. current is ahead, nothing to merge. (it was probably filtered out already as a \"failedComponent\")\n return;\n }\n if (!divergeData.isRemoteAhead()) {\n // nothing to do. current and remote are the same, nothing to merge. (it was probably filtered out already as a \"failedComponent\")\n return;\n }\n // remote is ahead and was not diverge.\n const remoteSnaps = divergeData.snapsOnRemoteOnly;\n if (remoteSnaps.length === 0) {\n throw new Error(`remote is ahead but it has no snaps. it's impossible`);\n }\n if (remoteSnaps.length === 1) {\n // nothing to squash. it has only one commit.\n return;\n }\n if (!componentFromModel) {\n throw new Error('unable to squash, the componentFromModel is missing');\n }\n\n // do the squash.\n if (divergeData.commonSnapBeforeDiverge) {\n componentFromModel.addAsOnlyParent(divergeData.commonSnapBeforeDiverge);\n } else {\n // there is no commonSnapBeforeDiverge. the local has no snaps, all are remote, no need for parents. keep only head.\n componentFromModel.parents.forEach((ref) => componentFromModel.removeParent(ref));\n }\n const squashedSnaps = remoteSnaps.filter((snap) => !snap.isEqual(componentFromModel.hash()));\n componentFromModel.setSquashed(squashedSnaps);\n consumer.scope.objects.add(componentFromModel);\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA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