@teambit/merging 1.0.107 → 1.0.108
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/config-merge-result.ts +126 -0
- package/config-merger.ts +568 -0
- package/dist/config-merger.d.ts +2 -2
- package/dist/config-merger.js +12 -18
- package/dist/config-merger.js.map +1 -1
- package/dist/merge-cmd.js +8 -8
- package/dist/merge-cmd.js.map +1 -1
- package/dist/merge-status-provider.d.ts +4 -4
- package/dist/merge-status-provider.js +11 -19
- package/dist/merge-status-provider.js.map +1 -1
- package/dist/merging.main.runtime.d.ts +8 -8
- package/dist/merging.main.runtime.js +11 -20
- package/dist/merging.main.runtime.js.map +1 -1
- package/index.ts +15 -0
- package/merge-cmd.ts +349 -0
- package/merge-status-provider.ts +424 -0
- package/merging.aspect.ts +5 -0
- package/merging.main.runtime.ts +826 -0
- package/package.json +23 -33
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
- /package/dist/{preview-1703590665075.js → preview-1703647408454.js} +0 -0
|
@@ -87,18 +87,17 @@ class MergeStatusProvider {
|
|
|
87
87
|
this.options = options;
|
|
88
88
|
}
|
|
89
89
|
async getStatus(bitIds) {
|
|
90
|
-
var _this$options, _this$otherLane, _this$otherLane2, _this$currentLane, _this$otherLane3;
|
|
91
90
|
if (!this.currentLane && this.otherLane) {
|
|
92
91
|
await this.importer.importObjectsFromMainIfExist(this.otherLane.toBitIds().toVersionLatest());
|
|
93
92
|
}
|
|
94
93
|
const componentStatusBeforeMergeAttempt = await (0, _pMapSeries().default)(bitIds, id => this.getComponentStatusBeforeMergeAttempt(id));
|
|
95
94
|
// whether or not we need to import the gap between the common-snap and the other lane.
|
|
96
95
|
// the common-snap itself we need anyway in order to get the files hash/content for checking conflicts.
|
|
97
|
-
const shouldImportHistoryOfOtherLane = !
|
|
96
|
+
const shouldImportHistoryOfOtherLane = !this.options?.shouldSquash && (
|
|
98
97
|
// when squashing, no need for all history, only the head is going to be pushed
|
|
99
98
|
!this.currentLane ||
|
|
100
99
|
// on main. we need all history in order to push each component to its remote
|
|
101
|
-
this.currentLane.scope !==
|
|
100
|
+
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
|
|
102
101
|
const toImport = componentStatusBeforeMergeAttempt.map(compStatus => {
|
|
103
102
|
if (!compStatus.divergeData) return [];
|
|
104
103
|
const versionsToImport = [compStatus.divergeData.commonSnapBeforeDiverge];
|
|
@@ -107,7 +106,7 @@ class MergeStatusProvider {
|
|
|
107
106
|
}
|
|
108
107
|
return (0, _lodash().compact)(versionsToImport).map(v => compStatus.id.changeVersion(v.toString()));
|
|
109
108
|
}).flat();
|
|
110
|
-
const reason = shouldImportHistoryOfOtherLane ? `for filling the gap between the common-snap and the head of ${
|
|
109
|
+
const reason = shouldImportHistoryOfOtherLane ? `for filling the gap between the common-snap and the head of ${this.otherLane?.id() || 'main'}` : `for getting the common-snap between ${this.currentLane?.id() || 'main'} and ${this.otherLane?.id() || 'main'}`;
|
|
111
110
|
await this.workspace.consumer.scope.scopeImporter.importWithoutDeps(_componentId().ComponentIdList.fromArray(toImport), {
|
|
112
111
|
lane: this.otherLane,
|
|
113
112
|
cache: true,
|
|
@@ -132,7 +131,6 @@ class MergeStatusProvider {
|
|
|
132
131
|
return results;
|
|
133
132
|
}
|
|
134
133
|
async getComponentMergeStatus(componentMergeStatusBeforeMergeAttempt) {
|
|
135
|
-
var _this$currentLane2;
|
|
136
134
|
const {
|
|
137
135
|
id,
|
|
138
136
|
divergeData,
|
|
@@ -156,7 +154,7 @@ current: ${currentId.version}
|
|
|
156
154
|
other: ${otherLaneHead.toString()}`);
|
|
157
155
|
const baseComponent = await modelComponent.loadVersion(baseSnap.toString(), repo);
|
|
158
156
|
const otherComponent = await modelComponent.loadVersion(otherLaneHead.toString(), repo);
|
|
159
|
-
const currentLaneName =
|
|
157
|
+
const currentLaneName = this.currentLane?.toLaneId().toString() || 'main';
|
|
160
158
|
const otherLaneName = this.otherLane ? this.otherLane.toLaneId().toString() : _laneId().DEFAULT_LANE;
|
|
161
159
|
const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;
|
|
162
160
|
const otherLabel = `${otherLaneHead.toString()} (${otherLaneName === currentLaneName ? 'incoming' : otherLaneName})`;
|
|
@@ -188,7 +186,6 @@ other: ${otherLaneHead.toString()}`);
|
|
|
188
186
|
return componentStatus;
|
|
189
187
|
}
|
|
190
188
|
async getComponentStatusBeforeMergeAttempt(id) {
|
|
191
|
-
var _this$currentLane3, _this$options2;
|
|
192
189
|
const consumer = this.workspace.consumer;
|
|
193
190
|
const componentStatus = {
|
|
194
191
|
id
|
|
@@ -208,7 +205,7 @@ other: ${otherLaneHead.toString()}`);
|
|
|
208
205
|
ignoreVersion: true
|
|
209
206
|
});
|
|
210
207
|
const componentOnOther = await modelComponent.loadVersion(version, consumer.scope.objects);
|
|
211
|
-
const idOnCurrentLane =
|
|
208
|
+
const idOnCurrentLane = this.currentLane?.getComponent(id);
|
|
212
209
|
if (componentOnOther.isRemoved()) {
|
|
213
210
|
// if exist in current lane, we want the current lane to get the soft-remove update.
|
|
214
211
|
// or if it was removed with --update-main, we want to merge it so then main will get the update.
|
|
@@ -286,7 +283,7 @@ other: ${otherLaneHead.toString()}`);
|
|
|
286
283
|
return 'config';
|
|
287
284
|
};
|
|
288
285
|
const modifiedType = await isModified();
|
|
289
|
-
if (modifiedType === 'config' && !
|
|
286
|
+
if (modifiedType === 'config' && !this.options?.ignoreConfigChanges) {
|
|
290
287
|
return this.returnUnmerged(id, `component has config changes, please snap/tag it first. alternatively, use --ignore-config-changes flag to bypass`);
|
|
291
288
|
}
|
|
292
289
|
if (modifiedType === 'code') {
|
|
@@ -302,8 +299,7 @@ other: ${otherLaneHead.toString()}`);
|
|
|
302
299
|
throws: false
|
|
303
300
|
});
|
|
304
301
|
if (divergeData.err) {
|
|
305
|
-
|
|
306
|
-
if (!(divergeData.err instanceof _noCommonSnap().NoCommonSnap) || !((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.resolveUnrelated)) {
|
|
302
|
+
if (!(divergeData.err instanceof _noCommonSnap().NoCommonSnap) || !this.options?.resolveUnrelated) {
|
|
307
303
|
return this.returnUnmerged(id, `unable to traverse ${currentComponent.id.toString()} history. error: ${divergeData.err.message}`);
|
|
308
304
|
}
|
|
309
305
|
return this.handleNoCommonSnap(modelComponent, id, otherLaneHead, currentComponent, componentOnOther, divergeData);
|
|
@@ -401,24 +397,20 @@ it was probably created in each lane separately and it also exists on main. plea
|
|
|
401
397
|
const refToSaveInLane = hasResolvedLocally ? currentVersionRef : otherVersionRef;
|
|
402
398
|
const unrelatedHeadRef = hasResolvedLocally ? otherVersionRef : currentVersionRef;
|
|
403
399
|
if (resolveUnrelated === 'ours') {
|
|
404
|
-
|
|
405
|
-
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, (_this$currentLane4 = this.currentLane) === null || _this$currentLane4 === void 0 ? void 0 : _this$currentLane4.toLaneId());
|
|
400
|
+
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId());
|
|
406
401
|
}
|
|
407
402
|
if (resolveUnrelated === 'theirs') {
|
|
408
|
-
|
|
409
|
-
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, (_this$currentLane5 = this.currentLane) === null || _this$currentLane5 === void 0 ? void 0 : _this$currentLane5.toLaneId());
|
|
403
|
+
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId());
|
|
410
404
|
}
|
|
411
405
|
throw new Error(`unsupported strategy "${resolveUnrelated}" of resolve-unrelated. supported strategies are: [ours, theirs]`);
|
|
412
406
|
}
|
|
413
407
|
const refToSaveInLane = resolveUnrelated === 'ours' ? currentVersionRef : otherVersionRef;
|
|
414
408
|
const unrelatedHeadRef = resolveUnrelated === 'ours' ? otherVersionRef : currentVersionRef;
|
|
415
409
|
if (resolveUnrelated === 'ours') {
|
|
416
|
-
|
|
417
|
-
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, (_this$otherLane4 = this.otherLane) === null || _this$otherLane4 === void 0 ? void 0 : _this$otherLane4.toLaneId());
|
|
410
|
+
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.otherLane?.toLaneId());
|
|
418
411
|
}
|
|
419
412
|
if (resolveUnrelated === 'theirs') {
|
|
420
|
-
|
|
421
|
-
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, (_this$currentLane6 = this.currentLane) === null || _this$currentLane6 === void 0 ? void 0 : _this$currentLane6.toLaneId());
|
|
413
|
+
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId());
|
|
422
414
|
}
|
|
423
415
|
throw new Error(`unsupported strategy "${resolveUnrelated}" of resolve-unrelated. supported strategies are: [ours, theirs]`);
|
|
424
416
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_getDivergeData","_repositories","_lodash","_threeWayMerge","_noCommonSnap","_configMerger","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","MergeStatusProvider","constructor","workspace","logger","importer","currentLane","otherLane","options","getStatus","bitIds","_this$options","_this$otherLane","_this$otherLane2","_this$currentLane","_this$otherLane3","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","shouldImportHistoryOfOtherLane","shouldSquash","scope","toImport","map","compStatus","divergeData","versionsToImport","commonSnapBeforeDiverge","snapsOnTargetOnly","compact","v","changeVersion","toString","flat","reason","consumer","scopeImporter","importWithoutDeps","ComponentIdList","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","unchangedMessage","unchangedLegitimately","_this$currentLane3","_this$options2","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","fullName","getRef","existingBitMapId","bitMap","getComponentIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","shouldBeRemoved","getCurrentId","head","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","getCurrentComponent","loadComponent","loadExtensions","getConsumerComponent","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","componentModificationStatus","getComponentStatusById","modified","undefined","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","_this$options3","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 { ComponentID, ComponentIdList } from '@teambit/component-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 type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n};\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?: MergeStatusProviderOptions\n ) {}\n\n async getStatus(\n bitIds: ComponentID[] // 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.options?.shouldSquash && // when squashing, no need for all history, only the head is going to be pushed\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(ComponentIdList.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(\n id: ComponentID,\n msg: string,\n unmergedLegitimately = false\n ): ComponentMergeStatusBeforeMergeAttempt {\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n componentStatus.unchangedMessage = msg;\n componentStatus.unchangedLegitimately = unmergedLegitimately;\n return componentStatus;\n }\n\n private async getComponentStatusBeforeMergeAttempt(\n id: ComponentID // 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.fullName);\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.getComponentIdIfExist(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, { loadExtensions: true });\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 main. in this case, we don't care what happens on main, we want the component to stay deleted on\n // this lane. (even when main is ahead, we don't want to merge it).\n // 2. 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 // 3. other is not ahead. in this case, just ignore this component, no point to merge it, we want it removed.\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 // option #2 and #3 above\n : true; // it's main. option #1 above.\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: ComponentID,\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,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,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,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,eAAA;EAAA,MAAAR,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gBAAiB,kEAC5C,CAAC;EACH;AACF;AAAC8B,OAAA,CAAA3K,mBAAA,GAAAA,mBAAA"}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_getDivergeData","_repositories","_lodash","_threeWayMerge","_noCommonSnap","_configMerger","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","MergeStatusProvider","constructor","workspace","logger","importer","currentLane","otherLane","options","getStatus","bitIds","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","shouldImportHistoryOfOtherLane","shouldSquash","scope","toImport","map","compStatus","divergeData","versionsToImport","commonSnapBeforeDiverge","snapsOnTargetOnly","compact","v","changeVersion","toString","flat","reason","consumer","scopeImporter","importWithoutDeps","ComponentIdList","fromArray","lane","cache","includeVersionHistory","compStatusNotNeedMerge","c","mergeProps","compStatusNeedMerge","getComponentsStatusNeedMerge","tmp","Tmp","componentsStatus","Promise","all","getComponentMergeStatus","clear","err","results","componentMergeStatusBeforeMergeAttempt","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","unchangedMessage","unchangedLegitimately","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","fullName","getRef","existingBitMapId","bitMap","getComponentIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","shouldBeRemoved","getCurrentId","head","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","getCurrentComponent","loadComponent","loadExtensions","getConsumerComponent","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","componentModificationStatus","getComponentStatusById","modified","undefined","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","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","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 { ComponentID, ComponentIdList } from '@teambit/component-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 type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n};\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?: MergeStatusProviderOptions\n ) {}\n\n async getStatus(\n bitIds: ComponentID[] // 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.options?.shouldSquash && // when squashing, no need for all history, only the head is going to be pushed\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(ComponentIdList.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(\n id: ComponentID,\n msg: string,\n unmergedLegitimately = false\n ): ComponentMergeStatusBeforeMergeAttempt {\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n componentStatus.unchangedMessage = msg;\n componentStatus.unchangedLegitimately = unmergedLegitimately;\n return componentStatus;\n }\n\n private async getComponentStatusBeforeMergeAttempt(\n id: ComponentID // 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.fullName);\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.getComponentIdIfExist(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, { loadExtensions: true });\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 main. in this case, we don't care what happens on main, we want the component to stay deleted on\n // this lane. (even when main is ahead, we don't want to merge it).\n // 2. 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 // 3. other is not ahead. in this case, just ignore this component, no point to merge it, we want it removed.\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 // option #2 and #3 above\n : true; // it's main. option #1 above.\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: ComponentID,\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,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CA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GH,kBAAkB,GAAGN,iBAAiB,GAAGC,eAAe;MAChF,MAAMF,gBAAgB,GAAGO,kBAAkB,GAAGL,eAAe,GAAGD,iBAAiB;MACjF,IAAIhB,gBAAgB,KAAK,MAAM,EAAE;QAC/B,OAAOM,qBAAqB,CAACmB,eAAe,EAAEV,gBAAgB,EAAE,IAAI,CAAC9I,WAAW,EAAEkE,QAAQ,CAAC,CAAW,CAAC;MACzG;MACA,IAAI6D,gBAAgB,KAAK,QAAQ,EAAE;QACjC,OAAOa,uBAAuB,CAACY,eAAe,EAAEV,gBAAgB,EAAE,IAAI,CAAC9I,WAAW,EAAEkE,QAAQ,CAAC,CAAW,CAAC;MAC3G;MACA,MAAM,IAAId,KAAK,CACZ,yBAAwB2E,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;MAC/B,OAAOM,qBAAqB,CAACmB,eAAe,EAAEV,gBAAgB,EAAE,IAAI,CAAC7I,SAAS,EAAEiE,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAI6D,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOa,uBAAuB,CAACY,eAAe,EAAEV,gBAAgB,EAAE,IAAI,CAAC9I,WAAW,EAAEkE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACZ,yBAAwB2E,gBAAiB,kEAC5C,CAAC;EACH;AACF;AAAC0B,OAAA,CAAA9J,mBAAA,GAAAA,mBAAA"}
|
|
@@ -22,26 +22,26 @@ import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-di
|
|
|
22
22
|
import { InstallMain } from '@teambit/install';
|
|
23
23
|
import { ConfigMergeResult } from './config-merge-result';
|
|
24
24
|
import { MergeStatusProviderOptions } from './merge-status-provider';
|
|
25
|
-
|
|
25
|
+
type ResolveUnrelatedData = {
|
|
26
26
|
strategy: MergeStrategy;
|
|
27
27
|
headOnCurrentLane: Ref;
|
|
28
28
|
unrelatedHead: Ref;
|
|
29
29
|
unrelatedLaneId: LaneId;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type WorkspaceDepsUpdates = {
|
|
32
32
|
[pkgName: string]: [string, string];
|
|
33
33
|
};
|
|
34
|
-
export
|
|
34
|
+
export type WorkspaceDepsConflicts = Record<WorkspacePolicyConfigKeysNames, Array<{
|
|
35
35
|
name: string;
|
|
36
36
|
version: string;
|
|
37
37
|
}>>;
|
|
38
|
-
export
|
|
38
|
+
export type ComponentMergeStatus = ComponentStatusBase & {
|
|
39
39
|
mergeResults?: MergeResultsThreeWay | null;
|
|
40
40
|
divergeData?: SnapsDistance;
|
|
41
41
|
resolvedUnrelated?: ResolveUnrelatedData;
|
|
42
42
|
configMergeResult?: ConfigMergeResult;
|
|
43
43
|
};
|
|
44
|
-
export
|
|
44
|
+
export type ComponentMergeStatusBeforeMergeAttempt = ComponentStatusBase & {
|
|
45
45
|
divergeData?: SnapsDistance;
|
|
46
46
|
resolvedUnrelated?: ResolveUnrelatedData;
|
|
47
47
|
mergeProps?: {
|
|
@@ -50,12 +50,12 @@ export declare type ComponentMergeStatusBeforeMergeAttempt = ComponentStatusBase
|
|
|
50
50
|
modelComponent: ModelComponent;
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
|
-
export
|
|
53
|
+
export type FailedComponents = {
|
|
54
54
|
id: ComponentID;
|
|
55
55
|
unchangedMessage: string;
|
|
56
56
|
unchangedLegitimately?: boolean;
|
|
57
57
|
};
|
|
58
|
-
export
|
|
58
|
+
export type ApplyVersionResults = {
|
|
59
59
|
components?: ApplyVersionResult[];
|
|
60
60
|
version?: string;
|
|
61
61
|
failedComponents?: FailedComponents[];
|
|
@@ -129,7 +129,7 @@ export declare class MergingMain {
|
|
|
129
129
|
private tagAllLaneComponent;
|
|
130
130
|
private getIdsForUnmerged;
|
|
131
131
|
private getComponentsToMerge;
|
|
132
|
-
static slots:
|
|
132
|
+
static slots: any[];
|
|
133
133
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
134
134
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
135
135
|
static provider([cli, workspace, snapping, checkout, install, loggerMain, compWriter, importer, config, remove, globalConfig,]: [
|
|
@@ -292,7 +292,6 @@ class MergingMain {
|
|
|
292
292
|
build,
|
|
293
293
|
skipDependencyInstallation
|
|
294
294
|
}) {
|
|
295
|
-
var _mergeSnapResults;
|
|
296
295
|
const consumer = this.workspace.consumer;
|
|
297
296
|
const componentWithConflict = allComponentsStatus.find(component => component.mergeResults && component.mergeResults.hasConflicts);
|
|
298
297
|
if (componentWithConflict && !mergeStrategy) {
|
|
@@ -322,10 +321,7 @@ class MergingMain {
|
|
|
322
321
|
await (0, _deleteComponentFiles().default)(consumer, compBitIdsToRemove);
|
|
323
322
|
await consumer.cleanFromBitMap(compBitIdsToRemove);
|
|
324
323
|
}
|
|
325
|
-
const componentsHasConfigMergeConflicts = allComponentsStatus.some(c =>
|
|
326
|
-
var _c$configMergeResult;
|
|
327
|
-
return (_c$configMergeResult = c.configMergeResult) === null || _c$configMergeResult === void 0 ? void 0 : _c$configMergeResult.hasConflicts();
|
|
328
|
-
});
|
|
324
|
+
const componentsHasConfigMergeConflicts = allComponentsStatus.some(c => c.configMergeResult?.hasConflicts());
|
|
329
325
|
const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';
|
|
330
326
|
if (!skipDependencyInstallation && !leftUnresolvedConflicts && !componentsHasConfigMergeConflicts) {
|
|
331
327
|
try {
|
|
@@ -374,7 +370,7 @@ class MergingMain {
|
|
|
374
370
|
return {
|
|
375
371
|
components: componentsResults.map(c => c.applyVersionResult),
|
|
376
372
|
failedComponents,
|
|
377
|
-
removedComponents: [...componentIdsToRemove, ...(
|
|
373
|
+
removedComponents: [...componentIdsToRemove, ...(mergeSnapResults?.removedComponents || [])],
|
|
378
374
|
mergeSnapResults,
|
|
379
375
|
mergeSnapError,
|
|
380
376
|
leftUnresolvedConflicts,
|
|
@@ -406,8 +402,7 @@ class MergingMain {
|
|
|
406
402
|
const nonConflictDeps = {};
|
|
407
403
|
const nonConflictSources = {}; // for logging/debugging purposes
|
|
408
404
|
allConfigMerge.forEach(configMerge => {
|
|
409
|
-
|
|
410
|
-
const mergedConfig = (_configMerge$getDepsR = configMerge.getDepsResolverResult()) === null || _configMerge$getDepsR === void 0 ? void 0 : _configMerge$getDepsR.mergedConfig;
|
|
405
|
+
const mergedConfig = configMerge.getDepsResolverResult()?.mergedConfig;
|
|
411
406
|
if (!mergedConfig || mergedConfig === '-') return;
|
|
412
407
|
const mergedConfigPolicy = mergedConfig.policy || {};
|
|
413
408
|
_constants().DEPENDENCIES_FIELDS.forEach(depField => {
|
|
@@ -429,8 +424,7 @@ class MergingMain {
|
|
|
429
424
|
const conflictDeps = {};
|
|
430
425
|
const conflictDepsSources = {}; // for logging/debugging purposes
|
|
431
426
|
allConfigMerge.forEach(configMerge => {
|
|
432
|
-
|
|
433
|
-
const mergedConfigConflict = (_configMerge$getDepsR2 = configMerge.getDepsResolverResult()) === null || _configMerge$getDepsR2 === void 0 ? void 0 : _configMerge$getDepsR2.conflict;
|
|
427
|
+
const mergedConfigConflict = configMerge.getDepsResolverResult()?.conflict;
|
|
434
428
|
if (!mergedConfigConflict) return;
|
|
435
429
|
_constants().DEPENDENCIES_FIELDS.forEach(depField => {
|
|
436
430
|
if (!mergedConfigConflict[depField]) return;
|
|
@@ -452,7 +446,7 @@ class MergingMain {
|
|
|
452
446
|
const workspaceConfig = this.config.workspaceConfig;
|
|
453
447
|
if (!workspaceConfig) throw new Error(`updateWorkspaceJsoncWithDepsIfNeeded unable to get workspace config`);
|
|
454
448
|
const depResolver = workspaceConfig.extensions.findCoreExtension(_dependencyResolver().DependencyResolverAspect.id);
|
|
455
|
-
const policy = depResolver
|
|
449
|
+
const policy = depResolver?.config.policy;
|
|
456
450
|
if (!policy) {
|
|
457
451
|
return {};
|
|
458
452
|
}
|
|
@@ -465,8 +459,7 @@ class MergingMain {
|
|
|
465
459
|
return;
|
|
466
460
|
}
|
|
467
461
|
_constants().DEPENDENCIES_FIELDS.forEach(depField => {
|
|
468
|
-
|
|
469
|
-
if (!((_policy$depField = policy[depField]) !== null && _policy$depField !== void 0 && _policy$depField[pkgName])) return; // doesn't exists in the workspace.json
|
|
462
|
+
if (!policy[depField]?.[pkgName]) return; // doesn't exists in the workspace.json
|
|
470
463
|
const currentVer = policy[depField][pkgName];
|
|
471
464
|
const newVer = nonConflictDeps[pkgName][0];
|
|
472
465
|
if (currentVer === newVer) return;
|
|
@@ -491,8 +484,7 @@ class MergingMain {
|
|
|
491
484
|
const conflictRaw = conflictDeps[pkgName][0];
|
|
492
485
|
const [, currentVal, otherVal] = conflictRaw.split('::');
|
|
493
486
|
WS_DEPS_FIELDS.forEach(depField => {
|
|
494
|
-
|
|
495
|
-
if (!((_policy$depField2 = policy[depField]) !== null && _policy$depField2 !== void 0 && _policy$depField2[pkgName])) return;
|
|
487
|
+
if (!policy[depField]?.[pkgName]) return;
|
|
496
488
|
const currentVerInWsJson = policy[depField][pkgName];
|
|
497
489
|
if (!currentVerInWsJson) return;
|
|
498
490
|
// the version is coming from the workspace.jsonc
|
|
@@ -515,11 +507,10 @@ class MergingMain {
|
|
|
515
507
|
});
|
|
516
508
|
if (conflictPackagesToRemoveFromConfigMerge.length) {
|
|
517
509
|
allResults.forEach(result => {
|
|
518
|
-
if (result
|
|
510
|
+
if (result?.conflict) {
|
|
519
511
|
_constants().DEPENDENCIES_FIELDS.forEach(depField => {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
result.conflict[depField] = (_result$conflict2 = result.conflict) === null || _result$conflict2 === void 0 ? void 0 : _result$conflict2[depField].filter(dep => !conflictPackagesToRemoveFromConfigMerge.includes(dep.name));
|
|
512
|
+
if (!result.conflict?.[depField]) return;
|
|
513
|
+
result.conflict[depField] = result.conflict?.[depField].filter(dep => !conflictPackagesToRemoveFromConfigMerge.includes(dep.name));
|
|
523
514
|
if (!result.conflict[depField].length) delete result.conflict[depField];
|
|
524
515
|
});
|
|
525
516
|
if ((0, _lodash().isEmpty)(result.conflict)) result.conflict = undefined;
|
|
@@ -653,7 +644,7 @@ class MergingMain {
|
|
|
653
644
|
component: currentComponent || undefined
|
|
654
645
|
};
|
|
655
646
|
}
|
|
656
|
-
if (
|
|
647
|
+
if (resolvedUnrelated?.strategy === 'ours') {
|
|
657
648
|
markAllFilesAsUnchanged();
|
|
658
649
|
return handleResolveUnrelated();
|
|
659
650
|
}
|