@teambit/merging 0.0.459 → 0.0.461
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/config-merger.d.ts +1 -1
- package/dist/config-merger.js +8 -8
- package/dist/config-merger.js.map +1 -1
- package/dist/merge-cmd.d.ts +4 -0
- package/dist/merge-cmd.js +19 -8
- package/dist/merge-cmd.js.map +1 -1
- package/dist/merge-status-provider.js +43 -19
- package/dist/merge-status-provider.js.map +1 -1
- package/dist/merging.main.runtime.js +1 -4
- package/dist/merging.main.runtime.js.map +1 -1
- package/package.json +16 -16
- /package/dist/{preview-1693279117198.js → preview-1693538278577.js} +0 -0
|
@@ -95,19 +95,30 @@ class MergeStatusProvider {
|
|
|
95
95
|
this.options = options;
|
|
96
96
|
}
|
|
97
97
|
async getStatus(bitIds) {
|
|
98
|
+
var _this$otherLane, _this$otherLane2, _this$currentLane, _this$otherLane3;
|
|
98
99
|
if (!this.currentLane && this.otherLane) {
|
|
99
100
|
await this.importer.importObjectsFromMainIfExist(this.otherLane.toBitIds().toVersionLatest());
|
|
100
101
|
}
|
|
101
102
|
const componentStatusBeforeMergeAttempt = await (0, _pMapSeries().default)(bitIds, id => this.getComponentStatusBeforeMergeAttempt(id));
|
|
103
|
+
// whether or not we need to import the gap between the common-snap and the other lane.
|
|
104
|
+
// the common-snap itself we need anyway in order to get the files hash/content for checking conflicts.
|
|
105
|
+
const shouldImportHistoryOfOtherLane = !this.currentLane ||
|
|
106
|
+
// on main. we need all history in order to push each component to its remote
|
|
107
|
+
this.currentLane.scope !== ((_this$otherLane = this.otherLane) === null || _this$otherLane === void 0 ? void 0 : _this$otherLane.scope); // on lane, but the other lane is from a different scope. we need all history in order to push to the current lane's scope
|
|
102
108
|
const toImport = componentStatusBeforeMergeAttempt.map(compStatus => {
|
|
103
109
|
if (!compStatus.divergeData) return [];
|
|
104
|
-
const versionsToImport =
|
|
105
|
-
|
|
110
|
+
const versionsToImport = [compStatus.divergeData.commonSnapBeforeDiverge];
|
|
111
|
+
if (shouldImportHistoryOfOtherLane) {
|
|
112
|
+
versionsToImport.push(...compStatus.divergeData.snapsOnTargetOnly);
|
|
113
|
+
}
|
|
114
|
+
return (0, _lodash().compact)(versionsToImport).map(v => compStatus.id.changeVersion(v.toString()));
|
|
106
115
|
}).flat();
|
|
116
|
+
const reason = shouldImportHistoryOfOtherLane ? `for filling the gap between the common-snap and the head of ${((_this$otherLane2 = this.otherLane) === null || _this$otherLane2 === void 0 ? void 0 : _this$otherLane2.id()) || 'main'}` : `for getting the common-snap between ${((_this$currentLane = this.currentLane) === null || _this$currentLane === void 0 ? void 0 : _this$currentLane.id()) || 'main'} and ${((_this$otherLane3 = this.otherLane) === null || _this$otherLane3 === void 0 ? void 0 : _this$otherLane3.id()) || 'main'}`;
|
|
107
117
|
await this.workspace.consumer.scope.scopeImporter.importWithoutDeps(_bitId().BitIds.fromArray(toImport), {
|
|
108
118
|
lane: this.otherLane,
|
|
109
119
|
cache: true,
|
|
110
|
-
includeVersionHistory: false
|
|
120
|
+
includeVersionHistory: false,
|
|
121
|
+
reason
|
|
111
122
|
});
|
|
112
123
|
const compStatusNotNeedMerge = componentStatusBeforeMergeAttempt.filter(c => !c.mergeProps);
|
|
113
124
|
const compStatusNeedMerge = componentStatusBeforeMergeAttempt.filter(c => c.mergeProps);
|
|
@@ -127,7 +138,7 @@ class MergeStatusProvider {
|
|
|
127
138
|
return results;
|
|
128
139
|
}
|
|
129
140
|
async getComponentMergeStatus(componentMergeStatusBeforeMergeAttempt) {
|
|
130
|
-
var _this$
|
|
141
|
+
var _this$currentLane2;
|
|
131
142
|
const {
|
|
132
143
|
id,
|
|
133
144
|
divergeData,
|
|
@@ -151,7 +162,7 @@ current: ${currentId.version}
|
|
|
151
162
|
other: ${otherLaneHead.toString()}`);
|
|
152
163
|
const baseComponent = await modelComponent.loadVersion(baseSnap.toString(), repo);
|
|
153
164
|
const otherComponent = await modelComponent.loadVersion(otherLaneHead.toString(), repo);
|
|
154
|
-
const currentLaneName = ((_this$
|
|
165
|
+
const currentLaneName = ((_this$currentLane2 = this.currentLane) === null || _this$currentLane2 === void 0 ? void 0 : _this$currentLane2.toLaneId().toString()) || 'main';
|
|
155
166
|
const otherLaneName = this.otherLane ? this.otherLane.toLaneId().toString() : _laneId().DEFAULT_LANE;
|
|
156
167
|
const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;
|
|
157
168
|
const otherLabel = `${otherLaneHead.toString()} (${otherLaneName === currentLaneName ? 'incoming' : otherLaneName})`;
|
|
@@ -183,7 +194,7 @@ other: ${otherLaneHead.toString()}`);
|
|
|
183
194
|
return componentStatus;
|
|
184
195
|
}
|
|
185
196
|
async getComponentStatusBeforeMergeAttempt(id) {
|
|
186
|
-
var _this$
|
|
197
|
+
var _this$currentLane3, _this$options;
|
|
187
198
|
const consumer = this.workspace.consumer;
|
|
188
199
|
const componentStatus = {
|
|
189
200
|
id
|
|
@@ -203,7 +214,7 @@ other: ${otherLaneHead.toString()}`);
|
|
|
203
214
|
ignoreVersion: true
|
|
204
215
|
});
|
|
205
216
|
const componentOnOther = await modelComponent.loadVersion(version, consumer.scope.objects);
|
|
206
|
-
const idOnCurrentLane = (_this$
|
|
217
|
+
const idOnCurrentLane = (_this$currentLane3 = this.currentLane) === null || _this$currentLane3 === void 0 ? void 0 : _this$currentLane3.getComponent(id);
|
|
207
218
|
if (componentOnOther.isRemoved()) {
|
|
208
219
|
// if exist in current lane, we want the current lane to get the soft-remove update.
|
|
209
220
|
// or if it was removed with --update-main, we want to merge it so then main will get the update.
|
|
@@ -254,15 +265,25 @@ other: ${otherLaneHead.toString()}`);
|
|
|
254
265
|
// it is possible that it is diverged, in which case, still continue with the merge, and later on, the
|
|
255
266
|
// merge-config will show a config conflict of the remove aspect.
|
|
256
267
|
// 2. other is not ahead. in this case, just ignore this component, no point to merge it, we want it removed.
|
|
257
|
-
// 3. there are errors when calculating the divergeData, e.g. no snap in common.
|
|
258
|
-
//
|
|
268
|
+
// 3. there are errors when calculating the divergeData, e.g. no snap in common.
|
|
269
|
+
// here we need to differentiate between two cases:
|
|
270
|
+
// 3.1. the "otherLane" is main. in this case, we probably noticed that our component by accident got created
|
|
271
|
+
// with the same name of an existing component on main and therefore we removed it. so we want to keep this
|
|
272
|
+
// component removed during merges and we don't care about merging it.
|
|
273
|
+
// 3.2. the "otherLane" is a lane. in this case, it's possible that although it was removed in this lane, it's
|
|
274
|
+
// needed and is used by other components of the other other lane, so in order for this merge to work
|
|
275
|
+
// (and not throw error about deps from other lane), it needs the option to merge (user can decide whether to
|
|
276
|
+
// exclude it or to use --resolve-unrelated)
|
|
259
277
|
const divergeData = await (0, _getDivergeData().getDivergeData)({
|
|
260
278
|
repo,
|
|
261
279
|
modelComponent,
|
|
262
280
|
targetHead: otherLaneHead,
|
|
263
281
|
throws: false
|
|
264
282
|
});
|
|
265
|
-
|
|
283
|
+
const isTargetNotAhead = !divergeData.err && !divergeData.isTargetAhead();
|
|
284
|
+
const shouldIgnore = this.otherLane ? isTargetNotAhead // options 3.2 above. if they're not related - don't ignore.
|
|
285
|
+
: isTargetNotAhead || divergeData.err; // it's main. options 3.1 above. even if they're not related - still ignore.
|
|
286
|
+
if (shouldIgnore) {
|
|
266
287
|
return this.returnUnmerged(id, `component has been removed`, true);
|
|
267
288
|
}
|
|
268
289
|
}
|
|
@@ -328,9 +349,12 @@ other: ${otherLaneHead.toString()}`);
|
|
|
328
349
|
});
|
|
329
350
|
}
|
|
330
351
|
async handleNoCommonSnap(modelComponent, id, otherLaneHead, currentComponent, componentOnOther, divergeData) {
|
|
331
|
-
|
|
352
|
+
let {
|
|
332
353
|
resolveUnrelated
|
|
333
354
|
} = this.options || {};
|
|
355
|
+
if (currentComponent.isRemoved()) {
|
|
356
|
+
resolveUnrelated = 'theirs';
|
|
357
|
+
}
|
|
334
358
|
if (!resolveUnrelated) throw new Error(`handleNoCommonSnap expects resolveUnrelated to be set`);
|
|
335
359
|
const consumer = this.workspace.consumer;
|
|
336
360
|
const repo = consumer.scope.objects;
|
|
@@ -388,24 +412,24 @@ it was probably created in each lane separately and it also exists on main. plea
|
|
|
388
412
|
const refToSaveInLane = hasResolvedLocally ? currentVersionRef : otherVersionRef;
|
|
389
413
|
const unrelatedHeadRef = hasResolvedLocally ? otherVersionRef : currentVersionRef;
|
|
390
414
|
if (resolveUnrelated === 'ours') {
|
|
391
|
-
var _this$
|
|
392
|
-
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, (_this$
|
|
415
|
+
var _this$currentLane4;
|
|
416
|
+
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, (_this$currentLane4 = this.currentLane) === null || _this$currentLane4 === void 0 ? void 0 : _this$currentLane4.toLaneId());
|
|
393
417
|
}
|
|
394
418
|
if (resolveUnrelated === 'theirs') {
|
|
395
|
-
var _this$
|
|
396
|
-
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, (_this$
|
|
419
|
+
var _this$currentLane5;
|
|
420
|
+
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, (_this$currentLane5 = this.currentLane) === null || _this$currentLane5 === void 0 ? void 0 : _this$currentLane5.toLaneId());
|
|
397
421
|
}
|
|
398
422
|
throw new Error(`unsupported strategy "${resolveUnrelated}" of resolve-unrelated. supported strategies are: [ours, theirs]`);
|
|
399
423
|
}
|
|
400
424
|
const refToSaveInLane = resolveUnrelated === 'ours' ? currentVersionRef : otherVersionRef;
|
|
401
425
|
const unrelatedHeadRef = resolveUnrelated === 'ours' ? otherVersionRef : currentVersionRef;
|
|
402
426
|
if (resolveUnrelated === 'ours') {
|
|
403
|
-
var _this$
|
|
404
|
-
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, (_this$
|
|
427
|
+
var _this$otherLane4;
|
|
428
|
+
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, (_this$otherLane4 = this.otherLane) === null || _this$otherLane4 === void 0 ? void 0 : _this$otherLane4.toLaneId());
|
|
405
429
|
}
|
|
406
430
|
if (resolveUnrelated === 'theirs') {
|
|
407
|
-
var _this$
|
|
408
|
-
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, (_this$
|
|
431
|
+
var _this$currentLane6;
|
|
432
|
+
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, (_this$currentLane6 = this.currentLane) === null || _this$currentLane6 === void 0 ? void 0 : _this$currentLane6.toLaneId());
|
|
409
433
|
}
|
|
410
434
|
throw new Error(`unsupported strategy "${resolveUnrelated}" of resolve-unrelated. supported strategies are: [ours, theirs]`);
|
|
411
435
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_bitId","_laneId","_getDivergeData","_repositories","_lodash","_threeWayMerge","_noCommonSnap","_configMerger","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","MergeStatusProvider","constructor","workspace","logger","importer","currentLane","otherLane","options","getStatus","bitIds","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","toImport","map","compStatus","divergeData","versionsToImport","compact","snapsOnTargetOnly","commonSnapBeforeDiverge","v","changeVersion","toString","flat","consumer","scope","scopeImporter","importWithoutDeps","BitIds","fromArray","lane","cache","includeVersionHistory","compStatusNotNeedMerge","c","mergeProps","compStatusNeedMerge","getComponentsStatusNeedMerge","tmp","Tmp","componentsStatus","Promise","all","getComponentMergeStatus","clear","err","results","componentMergeStatusBeforeMergeAttempt","_this$currentLane","currentComponent","Error","otherLaneHead","currentId","modelComponent","repo","objects","baseSnap","debug","toStringWithoutVersion","version","baseComponent","loadVersion","otherComponent","currentLaneName","toLaneId","otherLaneName","DEFAULT_LANE","currentLabel","otherLabel","workspaceIds","listIds","configMerger","ConfigMerger","extensions","configMergeResult","merge","mergeResults","threeWayMerge","returnUnmerged","msg","unmergedLegitimately","componentStatus","unmergedMessage","_this$currentLane2","_this$options","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","name","getRef","existingBitMapId","bitMap","getBitIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","shouldBeRemoved","getCurrentId","head","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","isTargetAhead","isModified","componentModificationStatus","getComponentStatusById","modified","undefined","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","_this$options2","NoCommonSnap","resolveUnrelated","message","handleNoCommonSnap","isDiverged","isSourceAhead","mainHead","returnAccordingToOurs","headToSaveInLane","unrelatedHead","unrelatedLaneId","resolvedUnrelated","strategy","headOnCurrentLane","returnAccordingToTheirs","resolvedRef","unrelatedHeadRef","currentVersionRef","otherVersionRef","hasResolvedFromMain","hashToCompare","divergeDataFromMain","sourceHead","hasResolvedLocally","getHeadRegardlessOfLane","hasResolvedRemotely","refToSaveInLane","_this$currentLane3","_this$currentLane4","_this$otherLane","_this$currentLane5","exports"],"sources":["merge-status-provider.ts"],"sourcesContent":["import { Workspace } from '@teambit/workspace';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport mapSeries from 'p-map-series';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { DEFAULT_LANE, LaneId } from '@teambit/lane-id';\nimport { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data';\nimport { Lane, ModelComponent, Version } from '@teambit/legacy/dist/scope/models';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { ImporterMain } from '@teambit/importer';\nimport { Logger } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport threeWayMerge from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';\nimport { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';\nimport { ConfigMerger } from './config-merger';\nimport { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\n\nexport class MergeStatusProvider {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private importer: ImporterMain,\n private currentLane?: Lane, // currently checked out lane. if on main, then it's undefined.\n private otherLane?: Lane, // the lane we want to merged to our lane. (undefined if it's \"main\").\n private options?: { resolveUnrelated?: MergeStrategy; ignoreConfigChanges?: boolean }\n ) {}\n\n async getStatus(\n bitIds: BitId[] // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatus[]> {\n if (!this.currentLane && this.otherLane) {\n await this.importer.importObjectsFromMainIfExist(this.otherLane.toBitIds().toVersionLatest());\n }\n const componentStatusBeforeMergeAttempt = await mapSeries(bitIds, (id) =>\n this.getComponentStatusBeforeMergeAttempt(id)\n );\n const toImport = componentStatusBeforeMergeAttempt\n .map((compStatus) => {\n if (!compStatus.divergeData) return [];\n const versionsToImport = compact([\n ...compStatus.divergeData.snapsOnTargetOnly,\n compStatus.divergeData.commonSnapBeforeDiverge,\n ]);\n return versionsToImport.map((v) => compStatus.id.changeVersion(v.toString()));\n })\n .flat();\n\n await this.workspace.consumer.scope.scopeImporter.importWithoutDeps(BitIds.fromArray(toImport), {\n lane: this.otherLane,\n cache: true,\n includeVersionHistory: false,\n });\n\n const compStatusNotNeedMerge = componentStatusBeforeMergeAttempt.filter(\n (c) => !c.mergeProps\n ) as ComponentMergeStatus[];\n const compStatusNeedMerge = componentStatusBeforeMergeAttempt.filter((c) => c.mergeProps);\n\n const getComponentsStatusNeedMerge = async (): Promise<ComponentMergeStatus[]> => {\n const tmp = new Tmp(this.workspace.consumer.scope);\n try {\n const componentsStatus = await Promise.all(\n compStatusNeedMerge.map((compStatus) => this.getComponentMergeStatus(compStatus))\n );\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n const results = await getComponentsStatusNeedMerge();\n\n results.push(...compStatusNotNeedMerge);\n return results;\n }\n\n private async getComponentMergeStatus(\n componentMergeStatusBeforeMergeAttempt: ComponentMergeStatusBeforeMergeAttempt\n ) {\n const { id, divergeData, currentComponent, mergeProps } = componentMergeStatusBeforeMergeAttempt;\n if (!mergeProps) throw new Error(`getDivergedMergeStatus, mergeProps is missing for ${id.toString()}`);\n const { otherLaneHead, currentId, modelComponent } = mergeProps;\n const repo = this.workspace.consumer.scope.objects;\n if (!divergeData) throw new Error(`getDivergedMergeStatus, divergeData is missing for ${id.toString()}`);\n if (!currentComponent) throw new Error(`getDivergedMergeStatus, currentComponent is missing for ${id.toString()}`);\n\n const baseSnap = divergeData.commonSnapBeforeDiverge as Ref; // must be set when isTrueMerge\n this.logger.debug(`merging snaps details:\nid: ${id.toStringWithoutVersion()}\nbase: ${baseSnap.toString()}\ncurrent: ${currentId.version}\nother: ${otherLaneHead.toString()}`);\n const baseComponent: Version = await modelComponent.loadVersion(baseSnap.toString(), repo);\n const otherComponent: Version = await modelComponent.loadVersion(otherLaneHead.toString(), repo);\n\n const currentLaneName = this.currentLane?.toLaneId().toString() || 'main';\n const otherLaneName = this.otherLane ? this.otherLane.toLaneId().toString() : DEFAULT_LANE;\n const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;\n const otherLabel = `${otherLaneHead.toString()} (${\n otherLaneName === currentLaneName ? 'incoming' : otherLaneName\n })`;\n const workspaceIds = await this.workspace.listIds();\n const configMerger = new ConfigMerger(\n id.toStringWithoutVersion(),\n workspaceIds,\n this.otherLane,\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions,\n currentLabel,\n otherLabel,\n this.logger\n );\n const configMergeResult = configMerger.merge();\n\n const mergeResults = await threeWayMerge({\n consumer: this.workspace.consumer,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n });\n return { currentComponent, id, mergeResults, divergeData, configMergeResult };\n }\n\n private returnUnmerged(id: BitId, msg: string, unmergedLegitimately = false): ComponentMergeStatusBeforeMergeAttempt {\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n componentStatus.unmergedMessage = msg;\n componentStatus.unmergedLegitimately = unmergedLegitimately;\n return componentStatus;\n }\n\n private async getComponentStatusBeforeMergeAttempt(\n id: BitId // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n const modelComponent = await consumer.scope.getModelComponentIfExist(id);\n if (!modelComponent) {\n return this.returnUnmerged(\n id,\n `component ${id.toString()} is on the lane/main but its objects were not found, please re-import the lane`\n );\n }\n const unmerged = consumer.scope.objects.unmergedComponents.getEntry(id.name);\n if (unmerged) {\n return this.returnUnmerged(\n id,\n `component ${id.toStringWithoutVersion()} is in during-merge state a previous merge, please snap/tag it first (or use bit merge --resolve/--abort/ bit lane merge-abort)`\n );\n }\n const repo = consumer.scope.objects;\n const version = id.version as string;\n const otherLaneHead = modelComponent.getRef(version);\n const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, { ignoreVersion: true });\n const componentOnOther: Version = await modelComponent.loadVersion(version, consumer.scope.objects);\n const idOnCurrentLane = this.currentLane?.getComponent(id);\n\n if (componentOnOther.isRemoved()) {\n // if exist in current lane, we want the current lane to get the soft-remove update.\n // or if it was removed with --update-main, we want to merge it so then main will get the update.\n const shouldMerge = idOnCurrentLane || componentOnOther.shouldRemoveFromMain();\n if (shouldMerge) {\n // remove the component from the workspace if exist.\n componentStatus.shouldBeRemoved = true;\n } else {\n // on main, don't merge soft-removed components unless it's marked with removeOnMain.\n // on lane, if it's not part of the current lane, don't merge it.\n return this.returnUnmerged(id, `component has been removed`, true);\n }\n }\n const getCurrentId = () => {\n if (existingBitMapId) return existingBitMapId;\n if (this.currentLane) {\n if (!idOnCurrentLane) return null;\n return idOnCurrentLane.id.changeVersion(idOnCurrentLane.head.toString());\n }\n // it's on main\n const head = modelComponent.getHeadAsTagIfExist();\n if (head) {\n return id.changeVersion(head);\n }\n return null;\n };\n const currentId = getCurrentId();\n if (!currentId) {\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n return { ...componentStatus, componentFromModel: componentOnOther, divergeData };\n }\n const getCurrentComponent = () => {\n if (existingBitMapId) return consumer.loadComponent(existingBitMapId);\n return consumer.scope.getConsumerComponent(currentId);\n };\n const currentComponent = await getCurrentComponent();\n if (currentComponent.isRemoved()) {\n // we have a few options:\n // 1. other is ahead. in this case, other recovered the component. so we can continue with the merge.\n // it is possible that it is diverged, in which case, still continue with the merge, and later on, the\n // merge-config will show a config conflict of the remove aspect.\n // 2. other is not ahead. in this case, just ignore this component, no point to merge it, we want it removed.\n // 3. there are errors when calculating the divergeData, e.g. no snap in common. in such cases, we assume\n // there are issues with this component, and is better not to merge it.\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n if (divergeData.err || !divergeData.isTargetAhead()) {\n return this.returnUnmerged(id, `component has been removed`, true);\n }\n }\n\n const isModified = async (): Promise<undefined | 'code' | 'config'> => {\n const componentModificationStatus = await consumer.getComponentStatusById(currentComponent.id);\n if (!componentModificationStatus.modified) return undefined;\n if (!existingBitMapId) return undefined;\n const baseComponent = await modelComponent.loadVersion(\n existingBitMapId.version as string,\n consumer.scope.objects\n );\n const isSourceCodeModified = await consumer.isComponentSourceCodeModified(baseComponent, currentComponent);\n if (isSourceCodeModified) return 'code';\n return 'config';\n };\n\n const modifiedType = await isModified();\n if (modifiedType === 'config' && !this.options?.ignoreConfigChanges) {\n return this.returnUnmerged(\n id,\n `component has config changes, please snap/tag it first. alternatively, use --ignore-config-changes flag to bypass`\n );\n }\n if (modifiedType === 'code') {\n return this.returnUnmerged(id, `component is modified, please snap/tag it first`);\n }\n\n if (!otherLaneHead) {\n throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);\n }\n const divergeData = await getDivergeData({\n repo,\n modelComponent,\n targetHead: otherLaneHead,\n throws: false,\n });\n if (divergeData.err) {\n if (!(divergeData.err instanceof NoCommonSnap) || !this.options?.resolveUnrelated) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. error: ${divergeData.err.message}`\n );\n }\n return this.handleNoCommonSnap(\n modelComponent,\n id,\n otherLaneHead,\n currentComponent,\n componentOnOther,\n divergeData\n );\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isSourceAhead()) {\n // do nothing!\n return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is ahead, nothing to merge`, true);\n }\n if (divergeData.isTargetAhead()) {\n // just override with the model data\n return {\n ...componentStatus,\n currentComponent,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n // we know that localHead and remoteHead are set, so if none of them is ahead they must be equal\n return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is already merged`, true);\n }\n\n // it's diverged and needs merge operation\n const mergeProps = {\n otherLaneHead,\n currentId,\n modelComponent,\n };\n\n return { ...componentStatus, currentComponent, mergeProps, divergeData };\n }\n\n private async handleNoCommonSnap(\n modelComponent: ModelComponent,\n id: BitId,\n otherLaneHead: Ref,\n currentComponent: ConsumerComponent,\n componentOnOther?: Version,\n divergeData?: SnapsDistance\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n const { resolveUnrelated } = this.options || {};\n if (!resolveUnrelated) throw new Error(`handleNoCommonSnap expects resolveUnrelated to be set`);\n const consumer = this.workspace.consumer;\n const repo = consumer.scope.objects;\n const mainHead = modelComponent.head;\n\n const returnAccordingToOurs = (\n headToSaveInLane: Ref,\n unrelatedHead: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n return {\n currentComponent,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'ours',\n headOnCurrentLane: headToSaveInLane,\n unrelatedHead,\n unrelatedLaneId,\n },\n };\n };\n const returnAccordingToTheirs = (\n resolvedRef: Ref,\n unrelatedHeadRef: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n // just override with the model data\n return {\n currentComponent,\n componentFromModel: componentOnOther,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'theirs',\n headOnCurrentLane: resolvedRef,\n unrelatedHead: unrelatedHeadRef,\n unrelatedLaneId,\n },\n };\n };\n\n const currentVersionRef = modelComponent.getRef(currentComponent.id.version as string);\n if (!currentVersionRef)\n throw new Error(\n `handleNoCommonSnap, unable to get ref of current version \"${\n currentComponent.id.version\n }\" for \"${id.toString()}\"`\n );\n const otherVersionRef = modelComponent.getRef(id.version as string);\n if (!otherVersionRef)\n throw new Error(`handleNoCommonSnap, unable to get ref of other version \"${id.version}\" for \"${id.toString()}\"`);\n\n if (mainHead) {\n const hasResolvedFromMain = async (hashToCompare: Ref | null) => {\n const divergeDataFromMain = await getDivergeData({\n repo,\n modelComponent,\n sourceHead: hashToCompare,\n targetHead: mainHead,\n throws: false,\n });\n if (!divergeDataFromMain.err) return true;\n return !(divergeDataFromMain.err instanceof NoCommonSnap);\n };\n const hasResolvedLocally = await hasResolvedFromMain(modelComponent.getHeadRegardlessOfLane() as Ref);\n const hasResolvedRemotely = await hasResolvedFromMain(otherLaneHead);\n if (!hasResolvedLocally && !hasResolvedRemotely) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. the main-head ${mainHead.toString()} doesn't appear in both lanes.\nit was probably created in each lane separately and it also exists on main. please merge main first to one of these lanes`\n );\n }\n const refToSaveInLane = hasResolvedLocally ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = hasResolvedLocally ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n\n const refToSaveInLane = resolveUnrelated === 'ours' ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = resolveUnrelated === 'ours' ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.otherLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,cAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,aAAA,YAAAA,CA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AW,CAAC;MAC3G;MACA,MAAM,IAAId,KAAK,CACZ,yBAAwB0E,gBAAiB,kEAC5C,CAAC;IACH;IAEA,MAAMyB,eAAe,GAAGzB,gBAAgB,KAAK,MAAM,GAAGgB,iBAAiB,GAAGC,eAAe;IACzF,MAAMF,gBAAgB,GAAGf,gBAAgB,KAAK,MAAM,GAAGiB,eAAe,GAAGD,iBAAiB;IAC1F,IAAIhB,gBAAgB,KAAK,MAAM,EAAE;MAAA,IAAA4B,eAAA;MAC/B,OAAOtB,qBAAqB,CAACmB,eAAe,EAAEV,gBAAgB,GAAAa,eAAA,GAAE,IAAI,CAACvJ,SAAS,cAAAuJ,eAAA,uBAAdA,eAAA,CAAgBxF,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAI4D,gBAAgB,KAAK,QAAQ,EAAE;MAAA,IAAA6B,kBAAA;MACjC,OAAOhB,uBAAuB,CAACY,eAAe,EAAEV,gBAAgB,GAAAc,kBAAA,GAAE,IAAI,CAACzJ,WAAW,cAAAyJ,kBAAA,uBAAhBA,kBAAA,CAAkBzF,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACZ,yBAAwB0E,gBAAiB,kEAC5C,CAAC;EACH;AACF;AAAC8B,OAAA,CAAA/J,mBAAA,GAAAA,mBAAA"}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_bitId","_laneId","_getDivergeData","_repositories","_lodash","_threeWayMerge","_noCommonSnap","_configMerger","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","MergeStatusProvider","constructor","workspace","logger","importer","currentLane","otherLane","options","getStatus","bitIds","_this$otherLane","_this$otherLane2","_this$currentLane","_this$otherLane3","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","shouldImportHistoryOfOtherLane","scope","toImport","map","compStatus","divergeData","versionsToImport","commonSnapBeforeDiverge","snapsOnTargetOnly","compact","v","changeVersion","toString","flat","reason","consumer","scopeImporter","importWithoutDeps","BitIds","fromArray","lane","cache","includeVersionHistory","compStatusNotNeedMerge","c","mergeProps","compStatusNeedMerge","getComponentsStatusNeedMerge","tmp","Tmp","componentsStatus","Promise","all","getComponentMergeStatus","clear","err","results","componentMergeStatusBeforeMergeAttempt","_this$currentLane2","currentComponent","Error","otherLaneHead","currentId","modelComponent","repo","objects","baseSnap","debug","toStringWithoutVersion","version","baseComponent","loadVersion","otherComponent","currentLaneName","toLaneId","otherLaneName","DEFAULT_LANE","currentLabel","otherLabel","workspaceIds","listIds","configMerger","ConfigMerger","extensions","configMergeResult","merge","mergeResults","threeWayMerge","returnUnmerged","msg","unmergedLegitimately","componentStatus","unmergedMessage","_this$currentLane3","_this$options","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","name","getRef","existingBitMapId","bitMap","getBitIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","shouldBeRemoved","getCurrentId","head","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","componentModificationStatus","getComponentStatusById","modified","undefined","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","_this$options2","NoCommonSnap","resolveUnrelated","message","handleNoCommonSnap","isDiverged","isSourceAhead","mainHead","returnAccordingToOurs","headToSaveInLane","unrelatedHead","unrelatedLaneId","resolvedUnrelated","strategy","headOnCurrentLane","returnAccordingToTheirs","resolvedRef","unrelatedHeadRef","currentVersionRef","otherVersionRef","hasResolvedFromMain","hashToCompare","divergeDataFromMain","sourceHead","hasResolvedLocally","getHeadRegardlessOfLane","hasResolvedRemotely","refToSaveInLane","_this$currentLane4","_this$currentLane5","_this$otherLane4","_this$currentLane6","exports"],"sources":["merge-status-provider.ts"],"sourcesContent":["import { Workspace } from '@teambit/workspace';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport mapSeries from 'p-map-series';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { DEFAULT_LANE, LaneId } from '@teambit/lane-id';\nimport { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data';\nimport { Lane, ModelComponent, Version } from '@teambit/legacy/dist/scope/models';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { ImporterMain } from '@teambit/importer';\nimport { Logger } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport threeWayMerge from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';\nimport { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';\nimport { ConfigMerger } from './config-merger';\nimport { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\n\nexport class MergeStatusProvider {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private importer: ImporterMain,\n private currentLane?: Lane, // currently checked out lane. if on main, then it's undefined.\n private otherLane?: Lane, // the lane we want to merged to our lane. (undefined if it's \"main\").\n private options?: { resolveUnrelated?: MergeStrategy; ignoreConfigChanges?: boolean }\n ) {}\n\n async getStatus(\n bitIds: BitId[] // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatus[]> {\n if (!this.currentLane && this.otherLane) {\n await this.importer.importObjectsFromMainIfExist(this.otherLane.toBitIds().toVersionLatest());\n }\n const componentStatusBeforeMergeAttempt = await mapSeries(bitIds, (id) =>\n this.getComponentStatusBeforeMergeAttempt(id)\n );\n // whether or not we need to import the gap between the common-snap and the other lane.\n // the common-snap itself we need anyway in order to get the files hash/content for checking conflicts.\n const shouldImportHistoryOfOtherLane =\n !this.currentLane || // on main. we need all history in order to push each component to its remote\n this.currentLane.scope !== this.otherLane?.scope; // on lane, but the other lane is from a different scope. we need all history in order to push to the current lane's scope\n const toImport = componentStatusBeforeMergeAttempt\n .map((compStatus) => {\n if (!compStatus.divergeData) return [];\n const versionsToImport = [compStatus.divergeData.commonSnapBeforeDiverge];\n if (shouldImportHistoryOfOtherLane) {\n versionsToImport.push(...compStatus.divergeData.snapsOnTargetOnly);\n }\n return compact(versionsToImport).map((v) => compStatus.id.changeVersion(v.toString()));\n })\n .flat();\n const reason = shouldImportHistoryOfOtherLane\n ? `for filling the gap between the common-snap and the head of ${this.otherLane?.id() || 'main'}`\n : `for getting the common-snap between ${this.currentLane?.id() || 'main'} and ${this.otherLane?.id() || 'main'}`;\n await this.workspace.consumer.scope.scopeImporter.importWithoutDeps(BitIds.fromArray(toImport), {\n lane: this.otherLane,\n cache: true,\n includeVersionHistory: false,\n reason,\n });\n\n const compStatusNotNeedMerge = componentStatusBeforeMergeAttempt.filter(\n (c) => !c.mergeProps\n ) as ComponentMergeStatus[];\n const compStatusNeedMerge = componentStatusBeforeMergeAttempt.filter((c) => c.mergeProps);\n\n const getComponentsStatusNeedMerge = async (): Promise<ComponentMergeStatus[]> => {\n const tmp = new Tmp(this.workspace.consumer.scope);\n try {\n const componentsStatus = await Promise.all(\n compStatusNeedMerge.map((compStatus) => this.getComponentMergeStatus(compStatus))\n );\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n const results = await getComponentsStatusNeedMerge();\n\n results.push(...compStatusNotNeedMerge);\n return results;\n }\n\n private async getComponentMergeStatus(\n componentMergeStatusBeforeMergeAttempt: ComponentMergeStatusBeforeMergeAttempt\n ) {\n const { id, divergeData, currentComponent, mergeProps } = componentMergeStatusBeforeMergeAttempt;\n if (!mergeProps) throw new Error(`getDivergedMergeStatus, mergeProps is missing for ${id.toString()}`);\n const { otherLaneHead, currentId, modelComponent } = mergeProps;\n const repo = this.workspace.consumer.scope.objects;\n if (!divergeData) throw new Error(`getDivergedMergeStatus, divergeData is missing for ${id.toString()}`);\n if (!currentComponent) throw new Error(`getDivergedMergeStatus, currentComponent is missing for ${id.toString()}`);\n\n const baseSnap = divergeData.commonSnapBeforeDiverge as Ref; // must be set when isTrueMerge\n this.logger.debug(`merging snaps details:\nid: ${id.toStringWithoutVersion()}\nbase: ${baseSnap.toString()}\ncurrent: ${currentId.version}\nother: ${otherLaneHead.toString()}`);\n const baseComponent: Version = await modelComponent.loadVersion(baseSnap.toString(), repo);\n const otherComponent: Version = await modelComponent.loadVersion(otherLaneHead.toString(), repo);\n\n const currentLaneName = this.currentLane?.toLaneId().toString() || 'main';\n const otherLaneName = this.otherLane ? this.otherLane.toLaneId().toString() : DEFAULT_LANE;\n const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;\n const otherLabel = `${otherLaneHead.toString()} (${\n otherLaneName === currentLaneName ? 'incoming' : otherLaneName\n })`;\n const workspaceIds = await this.workspace.listIds();\n const configMerger = new ConfigMerger(\n id.toStringWithoutVersion(),\n workspaceIds,\n this.otherLane,\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions,\n currentLabel,\n otherLabel,\n this.logger\n );\n const configMergeResult = configMerger.merge();\n\n const mergeResults = await threeWayMerge({\n consumer: this.workspace.consumer,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n });\n return { currentComponent, id, mergeResults, divergeData, configMergeResult };\n }\n\n private returnUnmerged(id: BitId, msg: string, unmergedLegitimately = false): ComponentMergeStatusBeforeMergeAttempt {\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n componentStatus.unmergedMessage = msg;\n componentStatus.unmergedLegitimately = unmergedLegitimately;\n return componentStatus;\n }\n\n private async getComponentStatusBeforeMergeAttempt(\n id: BitId // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n const modelComponent = await consumer.scope.getModelComponentIfExist(id);\n if (!modelComponent) {\n return this.returnUnmerged(\n id,\n `component ${id.toString()} is on the lane/main but its objects were not found, please re-import the lane`\n );\n }\n const unmerged = consumer.scope.objects.unmergedComponents.getEntry(id.name);\n if (unmerged) {\n return this.returnUnmerged(\n id,\n `component ${id.toStringWithoutVersion()} is in during-merge state a previous merge, please snap/tag it first (or use bit merge --resolve/--abort/ bit lane merge-abort)`\n );\n }\n const repo = consumer.scope.objects;\n const version = id.version as string;\n const otherLaneHead = modelComponent.getRef(version);\n const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, { ignoreVersion: true });\n const componentOnOther: Version = await modelComponent.loadVersion(version, consumer.scope.objects);\n const idOnCurrentLane = this.currentLane?.getComponent(id);\n\n if (componentOnOther.isRemoved()) {\n // if exist in current lane, we want the current lane to get the soft-remove update.\n // or if it was removed with --update-main, we want to merge it so then main will get the update.\n const shouldMerge = idOnCurrentLane || componentOnOther.shouldRemoveFromMain();\n if (shouldMerge) {\n // remove the component from the workspace if exist.\n componentStatus.shouldBeRemoved = true;\n } else {\n // on main, don't merge soft-removed components unless it's marked with removeOnMain.\n // on lane, if it's not part of the current lane, don't merge it.\n return this.returnUnmerged(id, `component has been removed`, true);\n }\n }\n const getCurrentId = () => {\n if (existingBitMapId) return existingBitMapId;\n if (this.currentLane) {\n if (!idOnCurrentLane) return null;\n return idOnCurrentLane.id.changeVersion(idOnCurrentLane.head.toString());\n }\n // it's on main\n const head = modelComponent.getHeadAsTagIfExist();\n if (head) {\n return id.changeVersion(head);\n }\n return null;\n };\n const currentId = getCurrentId();\n if (!currentId) {\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n return { ...componentStatus, componentFromModel: componentOnOther, divergeData };\n }\n const getCurrentComponent = () => {\n if (existingBitMapId) return consumer.loadComponent(existingBitMapId);\n return consumer.scope.getConsumerComponent(currentId);\n };\n const currentComponent = await getCurrentComponent();\n if (currentComponent.isRemoved()) {\n // we have a few options:\n // 1. other is ahead. in this case, other recovered the component. so we can continue with the merge.\n // it is possible that it is diverged, in which case, still continue with the merge, and later on, the\n // merge-config will show a config conflict of the remove aspect.\n // 2. other is not ahead. in this case, just ignore this component, no point to merge it, we want it removed.\n // 3. there are errors when calculating the divergeData, e.g. no snap in common.\n // here we need to differentiate between two cases:\n // 3.1. the \"otherLane\" is main. in this case, we probably noticed that our component by accident got created\n // with the same name of an existing component on main and therefore we removed it. so we want to keep this\n // component removed during merges and we don't care about merging it.\n // 3.2. the \"otherLane\" is a lane. in this case, it's possible that although it was removed in this lane, it's\n // needed and is used by other components of the other other lane, so in order for this merge to work\n // (and not throw error about deps from other lane), it needs the option to merge (user can decide whether to\n // exclude it or to use --resolve-unrelated)\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n const isTargetNotAhead = !divergeData.err && !divergeData.isTargetAhead();\n const shouldIgnore = this.otherLane\n ? isTargetNotAhead // options 3.2 above. if they're not related - don't ignore.\n : isTargetNotAhead || divergeData.err; // it's main. options 3.1 above. even if they're not related - still ignore.\n if (shouldIgnore) {\n return this.returnUnmerged(id, `component has been removed`, true);\n }\n }\n\n const isModified = async (): Promise<undefined | 'code' | 'config'> => {\n const componentModificationStatus = await consumer.getComponentStatusById(currentComponent.id);\n if (!componentModificationStatus.modified) return undefined;\n if (!existingBitMapId) return undefined;\n const baseComponent = await modelComponent.loadVersion(\n existingBitMapId.version as string,\n consumer.scope.objects\n );\n const isSourceCodeModified = await consumer.isComponentSourceCodeModified(baseComponent, currentComponent);\n if (isSourceCodeModified) return 'code';\n return 'config';\n };\n\n const modifiedType = await isModified();\n if (modifiedType === 'config' && !this.options?.ignoreConfigChanges) {\n return this.returnUnmerged(\n id,\n `component has config changes, please snap/tag it first. alternatively, use --ignore-config-changes flag to bypass`\n );\n }\n if (modifiedType === 'code') {\n return this.returnUnmerged(id, `component is modified, please snap/tag it first`);\n }\n\n if (!otherLaneHead) {\n throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);\n }\n const divergeData = await getDivergeData({\n repo,\n modelComponent,\n targetHead: otherLaneHead,\n throws: false,\n });\n if (divergeData.err) {\n if (!(divergeData.err instanceof NoCommonSnap) || !this.options?.resolveUnrelated) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. error: ${divergeData.err.message}`\n );\n }\n return this.handleNoCommonSnap(\n modelComponent,\n id,\n otherLaneHead,\n currentComponent,\n componentOnOther,\n divergeData\n );\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isSourceAhead()) {\n // do nothing!\n return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is ahead, nothing to merge`, true);\n }\n if (divergeData.isTargetAhead()) {\n // just override with the model data\n return {\n ...componentStatus,\n currentComponent,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n // we know that localHead and remoteHead are set, so if none of them is ahead they must be equal\n return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is already merged`, true);\n }\n\n // it's diverged and needs merge operation\n const mergeProps = {\n otherLaneHead,\n currentId,\n modelComponent,\n };\n\n return { ...componentStatus, currentComponent, mergeProps, divergeData };\n }\n\n private async handleNoCommonSnap(\n modelComponent: ModelComponent,\n id: BitId,\n otherLaneHead: Ref,\n currentComponent: ConsumerComponent,\n componentOnOther?: Version,\n divergeData?: SnapsDistance\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n let { resolveUnrelated } = this.options || {};\n if (currentComponent.isRemoved()) {\n resolveUnrelated = 'theirs';\n }\n if (!resolveUnrelated) throw new Error(`handleNoCommonSnap expects resolveUnrelated to be set`);\n const consumer = this.workspace.consumer;\n const repo = consumer.scope.objects;\n const mainHead = modelComponent.head;\n\n const returnAccordingToOurs = (\n headToSaveInLane: Ref,\n unrelatedHead: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n return {\n currentComponent,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'ours',\n headOnCurrentLane: headToSaveInLane,\n unrelatedHead,\n unrelatedLaneId,\n },\n };\n };\n const returnAccordingToTheirs = (\n resolvedRef: Ref,\n unrelatedHeadRef: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n // just override with the model data\n return {\n currentComponent,\n componentFromModel: componentOnOther,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'theirs',\n headOnCurrentLane: resolvedRef,\n unrelatedHead: unrelatedHeadRef,\n unrelatedLaneId,\n },\n };\n };\n\n const currentVersionRef = modelComponent.getRef(currentComponent.id.version as string);\n if (!currentVersionRef)\n throw new Error(\n `handleNoCommonSnap, unable to get ref of current version \"${\n currentComponent.id.version\n }\" for \"${id.toString()}\"`\n );\n const otherVersionRef = modelComponent.getRef(id.version as string);\n if (!otherVersionRef)\n throw new Error(`handleNoCommonSnap, unable to get ref of other version \"${id.version}\" for \"${id.toString()}\"`);\n\n if (mainHead) {\n const hasResolvedFromMain = async (hashToCompare: Ref | null) => {\n const divergeDataFromMain = await getDivergeData({\n repo,\n modelComponent,\n sourceHead: hashToCompare,\n targetHead: mainHead,\n throws: false,\n });\n if (!divergeDataFromMain.err) return true;\n return !(divergeDataFromMain.err instanceof NoCommonSnap);\n };\n const hasResolvedLocally = await hasResolvedFromMain(modelComponent.getHeadRegardlessOfLane() as Ref);\n const hasResolvedRemotely = await hasResolvedFromMain(otherLaneHead);\n if (!hasResolvedLocally && !hasResolvedRemotely) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. the main-head ${mainHead.toString()} doesn't appear in both lanes.\nit was probably created in each lane separately and it also exists on main. please merge main first to one of these lanes`\n );\n }\n const refToSaveInLane = hasResolvedLocally ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = hasResolvedLocally ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n\n const refToSaveInLane = resolveUnrelated === 'ours' ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = resolveUnrelated === 'ours' ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.otherLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AA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zF,MAAMF,gBAAgB,GAAGf,gBAAgB,KAAK,MAAM,GAAGiB,eAAe,GAAGD,iBAAiB;IAC1F,IAAIhB,gBAAgB,KAAK,MAAM,EAAE;MAAA,IAAA4B,gBAAA;MAC/B,OAAOtB,qBAAqB,CAACmB,eAAe,EAAEV,gBAAgB,GAAAa,gBAAA,GAAE,IAAI,CAAC/J,SAAS,cAAA+J,gBAAA,uBAAdA,gBAAA,CAAgB1F,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAI8D,gBAAgB,KAAK,QAAQ,EAAE;MAAA,IAAA6B,kBAAA;MACjC,OAAOhB,uBAAuB,CAACY,eAAe,EAAEV,gBAAgB,GAAAc,kBAAA,GAAE,IAAI,CAACjK,WAAW,cAAAiK,kBAAA,uBAAhBA,kBAAA,CAAkB3F,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACZ,yBAAwB4E,gBAAiB,kEAC5C,CAAC;EACH;AACF;AAAC8B,OAAA,CAAAvK,mBAAA,GAAAA,mBAAA"}
|
|
@@ -660,10 +660,7 @@ class MergingMain {
|
|
|
660
660
|
legacyComponent.version = id.version;
|
|
661
661
|
}
|
|
662
662
|
const files = legacyComponent.files;
|
|
663
|
-
|
|
664
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
665
|
-
filesStatus[(0, _utils().pathNormalizeToLinux)(file.relative)] = _mergeVersion().FileStatus.updated;
|
|
666
|
-
});
|
|
663
|
+
(0, _checkout().updateFileStatus)(files, filesStatus, currentComponent || undefined);
|
|
667
664
|
if (mergeResults) {
|
|
668
665
|
// update files according to the merge results
|
|
669
666
|
const {
|