@teambit/merging 1.0.676 → 1.0.678
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/index.d.ts +4 -4
- package/dist/index.js +12 -72
- package/dist/index.js.map +1 -1
- package/dist/merge-cmd.d.ts +3 -19
- package/dist/merge-cmd.js +6 -121
- package/dist/merge-cmd.js.map +1 -1
- package/dist/merge-status-provider.d.ts +1 -1
- package/dist/merge-status-provider.js +4 -4
- package/dist/merge-status-provider.js.map +1 -1
- package/dist/merging.main.runtime.d.ts +3 -43
- package/dist/merging.main.runtime.js +10 -12
- package/dist/merging.main.runtime.js.map +1 -1
- package/package.json +28 -35
- package/dist/merge-files.d.ts +0 -31
- package/dist/merge-files.js +0 -86
- package/dist/merge-files.js.map +0 -1
- package/dist/merge-version/index.d.ts +0 -2
- package/dist/merge-version/index.js +0 -63
- package/dist/merge-version/index.js.map +0 -1
- package/dist/merge-version/merge-version.d.ts +0 -25
- package/dist/merge-version/merge-version.js +0 -76
- package/dist/merge-version/merge-version.js.map +0 -1
- package/dist/merge-version/three-way-merge.d.ts +0 -65
- package/dist/merge-version/three-way-merge.js +0 -254
- package/dist/merge-version/three-way-merge.js.map +0 -1
- package/merge-version/index.ts +0 -8
- package/merge-version/merge-version.ts +0 -41
- package/merge-version/three-way-merge.ts +0 -245
- /package/dist/{preview-1753993326673.js → preview-1754005301803.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_component","_legacy","_lodash","_configMerger","_mergeVersion","_dependencyResolver","_builder","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","compIsAlreadyMergedMsg","exports","MergeStatusProvider","constructor","scope","logger","importer","options","workspace","currentLane","otherLane","getStatus","bitIds","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","shouldImportHistoryOfOtherLane","shouldSquash","toImport","map","compStatus","divergeData","versionsToImport","commonSnapBeforeDiverge","snapsOnTargetOnly","compact","v","changeVersion","toString","flat","reason","legacyScope","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","toComponentIds","configMerger","ComponentConfigMerger","extensions","mergeStrategy","configMergeResult","merge","dataMergeResult","mergeExtensionsData","mergeResults","threeWayMerge","currentExtensions","baseExtensions","otherExtensions","shouldMergeAspectsData","conflictedAspects","aspectsToSkip","DependencyResolverAspect","BuilderAspect","currentExtension","includes","stringId","baseExtension","findExtension","idWithoutVersion","otherExtension","extensionId","isEqual","returnUnmerged","msg","unmergedLegitimately","componentStatus","unchangedMessage","unchangedLegitimately","consumer","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","getRef","existingBitMapId","bitMap","getComponentIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","head","shouldBeRemoved","getCurrentId","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","componentMap","getComponentIfExist","isLocallyRemoved","getCurrentComponent","loadComponent","getConsumerComponent","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","undefined","componentModificationStatus","getComponentStatusById","modified","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","sourceHead","NoCommonSnap","resolveUnrelated","message","handleNoCommonSnap","detachHead","commonSnapId","commonSnapComp","isDiverged","isSourceAhead","handleTargetAheadAsDiverged","mainHead","returnAccordingToOurs","headToSaveInLane","unrelatedHead","unrelatedLaneId","resolvedUnrelated","strategy","headOnCurrentLane","returnAccordingToTheirs","resolvedRef","unrelatedHeadRef","currentVersionRef","otherVersionRef","hasResolvedFromMain","hashToCompare","divergeDataFromMain","hasResolvedLocally","getHeadRegardlessOfLane","hasResolvedRemotely","refToSaveInLane"],"sources":["merge-status-provider.ts"],"sourcesContent":["import type { Workspace } from '@teambit/workspace';\nimport mapSeries from 'p-map-series';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { LaneId } from '@teambit/lane-id';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport type { SnapsDistance } from '@teambit/component.snap-distance';\nimport { getDivergeData } from '@teambit/component.snap-distance';\nimport type { Lane, ModelComponent, Version, Ref } from '@teambit/objects';\nimport { NoCommonSnap, Tmp } from '@teambit/legacy.scope';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport type { ImporterMain } from '@teambit/importer';\nimport type { Logger } from '@teambit/logger';\nimport { compact, isEqual } from 'lodash';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport type { ScopeMain } from '@teambit/scope';\nimport type { MergeStrategy } from './merge-version';\nimport { threeWayMerge } from './merge-version';\nimport type { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\nimport type { ExtensionDataList } from '@teambit/legacy.extension-data';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { BuilderAspect } from '@teambit/builder';\n\nexport type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n mergeStrategy: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n handleTargetAheadAsDiverged?: boolean;\n detachHead?: boolean;\n shouldMergeAspectsData?: boolean;\n};\n\ntype ConflictedDataAspects = { [extId: string]: string }; // extId => reason\n\nexport type DataMergeResult = {\n conflictedAspects?: ConflictedDataAspects;\n};\n\nexport const compIsAlreadyMergedMsg = 'component is already merged';\nexport class MergeStatusProvider {\n constructor(\n private scope: ScopeMain,\n private logger: Logger,\n private importer: ImporterMain,\n private options: MergeStatusProviderOptions,\n private workspace?: Workspace,\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 ) {}\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.scope.legacyScope.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.scope.legacyScope);\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.scope.legacyScope.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 unknown 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 = this.workspace?.listIds() || this.currentLane?.toComponentIds() || [];\n const configMerger = new ComponentConfigMerger(\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 this.options.mergeStrategy\n );\n const configMergeResult = configMerger.merge();\n\n const dataMergeResult = this.mergeExtensionsData(\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions\n );\n\n const mergeResults = await threeWayMerge({\n scope: this.scope.legacyScope,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n });\n return {\n currentComponent,\n id,\n mergeResults,\n divergeData,\n configMergeResult,\n dataMergeResult,\n };\n }\n\n private mergeExtensionsData(\n currentExtensions: ExtensionDataList,\n baseExtensions: ExtensionDataList,\n otherExtensions: ExtensionDataList\n ): DataMergeResult {\n if (!this.options.shouldMergeAspectsData) {\n return {};\n }\n const conflictedAspects: { [extId: string]: string } = {}; // extId => reason\n // these aspects handled separately\n const aspectsToSkip = [DependencyResolverAspect.id, BuilderAspect.id];\n currentExtensions.forEach((currentExtension) => {\n if (aspectsToSkip.includes(currentExtension.stringId)) {\n return;\n }\n const baseExtension = baseExtensions.findExtension(currentExtension.idWithoutVersion, true);\n const otherExtension = otherExtensions.findExtension(currentExtension.idWithoutVersion, true);\n if (!otherExtension) {\n conflictedAspects[currentExtension.stringId] = 'missing in other';\n return;\n }\n // check whether the version is different.\n if (currentExtension.extensionId?.version !== otherExtension.extensionId?.version) {\n if (baseExtension?.extensionId?.version === otherExtension.extensionId?.version) {\n // ext version has changed in current. we're good.\n return;\n }\n conflictedAspects[currentExtension.stringId] =\n `version changed. base: ${baseExtension?.extensionId?.version}, other: ${otherExtension.extensionId?.version}`;\n return;\n }\n if (isEqual(currentExtension.data, otherExtension.data)) return;\n if (!baseExtension) {\n conflictedAspects[currentExtension.stringId] = 'no base-version. conflicted in data';\n return;\n }\n if (isEqual(baseExtension.data, otherExtension.data)) {\n return; // changed in current. leave it.\n }\n if (isEqual(baseExtension.data, currentExtension.data)) {\n // changed in other. copy it.\n currentExtension.data = otherExtension.data;\n return;\n }\n // changed in both. conflict.\n conflictedAspects[currentExtension.stringId] = 'conflicted in data since base-version';\n });\n otherExtensions.forEach((otherExtension) => {\n if (!currentExtensions.findExtension(otherExtension.idWithoutVersion, true)) {\n conflictedAspects[otherExtension.stringId] = 'missing in current';\n }\n });\n\n return { conflictedAspects };\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 // eslint-disable-next-line complexity\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 this.scope.legacyScope.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 = this.scope.legacyScope.objects.unmergedComponents.getEntry(id);\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 = this.scope.legacyScope.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, this.scope.legacyScope.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 // (unless this component does not exist on main, in which case, we don't want to merge it).\n const shouldMerge = idOnCurrentLane || (componentOnOther.shouldRemoveFromMain() && modelComponent.head);\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 componentMap = consumer?.bitMap.getComponentIfExist(currentId, { ignoreVersion: true });\n const isLocallyRemoved = componentMap?.isRemoved();\n if (isLocallyRemoved) {\n return this.returnUnmerged(\n id,\n `component is locally deleted, please snap and export first or undo by bit recover`\n );\n }\n const getCurrentComponent = () => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (existingBitMapId) return consumer!.loadComponent(existingBitMapId);\n return this.scope.legacyScope.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 if (!consumer || !this.workspace) return undefined;\n const componentModificationStatus = await this.workspace.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 sourceHead: this.workspace ? undefined : modelComponent.getRef(currentId.version as string), // not sure if needs to check for this.workspace\n targetHead: otherLaneHead,\n throws: false,\n });\n if (divergeData.err) {\n if (!(divergeData.err instanceof NoCommonSnap) || !this.options?.resolveUnrelated) {\n return this.returnUnmerged(id, `unable to traverse history. error: ${divergeData.err.message}`);\n }\n return this.handleNoCommonSnap(\n modelComponent,\n id,\n otherLaneHead,\n currentComponent,\n componentOnOther,\n divergeData\n );\n }\n if (this.options.detachHead && divergeData.commonSnapBeforeDiverge) {\n // just override with the model data\n const commonSnapId = id.changeVersion(divergeData.commonSnapBeforeDiverge.toString());\n const commonSnapComp = await this.scope.legacyScope.getConsumerComponent(commonSnapId);\n return {\n ...componentStatus,\n currentComponent: commonSnapComp,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isSourceAhead()) {\n // component is ahead nothing to merge.\n return this.returnUnmerged(id, compIsAlreadyMergedMsg, true);\n }\n if (!divergeData.isTargetAhead()) {\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, compIsAlreadyMergedMsg, true);\n }\n // target is ahead.\n if (!this.options.handleTargetAheadAsDiverged || !divergeData.commonSnapBeforeDiverge) {\n // just override with the model data\n return {\n ...componentStatus,\n currentComponent,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n // target is ahead and we want to treat it as diverged, continue.\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 repo = this.scope.legacyScope.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":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,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;EAA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BAAyBmG,gBAAgB,kEAC3C,CAAC;EACH;AACF;AAAC7J,OAAA,CAAAC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_component","_legacy","_lodash","_configMerger","_componentModules","_dependencyResolver","_builder","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","compIsAlreadyMergedMsg","exports","MergeStatusProvider","constructor","scope","logger","importer","options","workspace","currentLane","otherLane","getStatus","bitIds","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","shouldImportHistoryOfOtherLane","shouldSquash","toImport","map","compStatus","divergeData","versionsToImport","commonSnapBeforeDiverge","snapsOnTargetOnly","compact","v","changeVersion","toString","flat","reason","legacyScope","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","toComponentIds","configMerger","ComponentConfigMerger","extensions","mergeStrategy","configMergeResult","merge","dataMergeResult","mergeExtensionsData","mergeResults","threeWayMerge","currentExtensions","baseExtensions","otherExtensions","shouldMergeAspectsData","conflictedAspects","aspectsToSkip","DependencyResolverAspect","BuilderAspect","currentExtension","includes","stringId","baseExtension","findExtension","idWithoutVersion","otherExtension","extensionId","isEqual","returnUnmerged","msg","unmergedLegitimately","componentStatus","unchangedMessage","unchangedLegitimately","consumer","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","getRef","existingBitMapId","bitMap","getComponentIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","head","shouldBeRemoved","getCurrentId","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","componentMap","getComponentIfExist","isLocallyRemoved","getCurrentComponent","loadComponent","getConsumerComponent","isTargetNotAhead","isTargetAhead","shouldIgnore","isModified","undefined","componentModificationStatus","getComponentStatusById","modified","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","sourceHead","NoCommonSnap","resolveUnrelated","message","handleNoCommonSnap","detachHead","commonSnapId","commonSnapComp","isDiverged","isSourceAhead","handleTargetAheadAsDiverged","mainHead","returnAccordingToOurs","headToSaveInLane","unrelatedHead","unrelatedLaneId","resolvedUnrelated","strategy","headOnCurrentLane","returnAccordingToTheirs","resolvedRef","unrelatedHeadRef","currentVersionRef","otherVersionRef","hasResolvedFromMain","hashToCompare","divergeDataFromMain","hasResolvedLocally","getHeadRegardlessOfLane","hasResolvedRemotely","refToSaveInLane"],"sources":["merge-status-provider.ts"],"sourcesContent":["import type { Workspace } from '@teambit/workspace';\nimport mapSeries from 'p-map-series';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { LaneId } from '@teambit/lane-id';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport type { SnapsDistance } from '@teambit/component.snap-distance';\nimport { getDivergeData } from '@teambit/component.snap-distance';\nimport type { Lane, ModelComponent, Version, Ref } from '@teambit/objects';\nimport { NoCommonSnap, Tmp } from '@teambit/legacy.scope';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport type { ImporterMain } from '@teambit/importer';\nimport type { Logger } from '@teambit/logger';\nimport { compact, isEqual } from 'lodash';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport type { ScopeMain } from '@teambit/scope';\nimport type { MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { threeWayMerge } from '@teambit/component.modules.merge-helper';\nimport type { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\nimport type { ExtensionDataList } from '@teambit/legacy.extension-data';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { BuilderAspect } from '@teambit/builder';\n\nexport type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n mergeStrategy: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n handleTargetAheadAsDiverged?: boolean;\n detachHead?: boolean;\n shouldMergeAspectsData?: boolean;\n};\n\ntype ConflictedDataAspects = { [extId: string]: string }; // extId => reason\n\nexport type DataMergeResult = {\n conflictedAspects?: ConflictedDataAspects;\n};\n\nexport const compIsAlreadyMergedMsg = 'component is already merged';\nexport class MergeStatusProvider {\n constructor(\n private scope: ScopeMain,\n private logger: Logger,\n private importer: ImporterMain,\n private options: MergeStatusProviderOptions,\n private workspace?: Workspace,\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 ) {}\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.scope.legacyScope.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.scope.legacyScope);\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.scope.legacyScope.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 unknown 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 = this.workspace?.listIds() || this.currentLane?.toComponentIds() || [];\n const configMerger = new ComponentConfigMerger(\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 this.options.mergeStrategy\n );\n const configMergeResult = configMerger.merge();\n\n const dataMergeResult = this.mergeExtensionsData(\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions\n );\n\n const mergeResults = await threeWayMerge({\n scope: this.scope.legacyScope,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n });\n return {\n currentComponent,\n id,\n mergeResults,\n divergeData,\n configMergeResult,\n dataMergeResult,\n };\n }\n\n private mergeExtensionsData(\n currentExtensions: ExtensionDataList,\n baseExtensions: ExtensionDataList,\n otherExtensions: ExtensionDataList\n ): DataMergeResult {\n if (!this.options.shouldMergeAspectsData) {\n return {};\n }\n const conflictedAspects: { [extId: string]: string } = {}; // extId => reason\n // these aspects handled separately\n const aspectsToSkip = [DependencyResolverAspect.id, BuilderAspect.id];\n currentExtensions.forEach((currentExtension) => {\n if (aspectsToSkip.includes(currentExtension.stringId)) {\n return;\n }\n const baseExtension = baseExtensions.findExtension(currentExtension.idWithoutVersion, true);\n const otherExtension = otherExtensions.findExtension(currentExtension.idWithoutVersion, true);\n if (!otherExtension) {\n conflictedAspects[currentExtension.stringId] = 'missing in other';\n return;\n }\n // check whether the version is different.\n if (currentExtension.extensionId?.version !== otherExtension.extensionId?.version) {\n if (baseExtension?.extensionId?.version === otherExtension.extensionId?.version) {\n // ext version has changed in current. we're good.\n return;\n }\n conflictedAspects[currentExtension.stringId] =\n `version changed. base: ${baseExtension?.extensionId?.version}, other: ${otherExtension.extensionId?.version}`;\n return;\n }\n if (isEqual(currentExtension.data, otherExtension.data)) return;\n if (!baseExtension) {\n conflictedAspects[currentExtension.stringId] = 'no base-version. conflicted in data';\n return;\n }\n if (isEqual(baseExtension.data, otherExtension.data)) {\n return; // changed in current. leave it.\n }\n if (isEqual(baseExtension.data, currentExtension.data)) {\n // changed in other. copy it.\n currentExtension.data = otherExtension.data;\n return;\n }\n // changed in both. conflict.\n conflictedAspects[currentExtension.stringId] = 'conflicted in data since base-version';\n });\n otherExtensions.forEach((otherExtension) => {\n if (!currentExtensions.findExtension(otherExtension.idWithoutVersion, true)) {\n conflictedAspects[otherExtension.stringId] = 'missing in current';\n }\n });\n\n return { conflictedAspects };\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 // eslint-disable-next-line complexity\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 this.scope.legacyScope.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 = this.scope.legacyScope.objects.unmergedComponents.getEntry(id);\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 = this.scope.legacyScope.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, this.scope.legacyScope.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 // (unless this component does not exist on main, in which case, we don't want to merge it).\n const shouldMerge = idOnCurrentLane || (componentOnOther.shouldRemoveFromMain() && modelComponent.head);\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 componentMap = consumer?.bitMap.getComponentIfExist(currentId, { ignoreVersion: true });\n const isLocallyRemoved = componentMap?.isRemoved();\n if (isLocallyRemoved) {\n return this.returnUnmerged(\n id,\n `component is locally deleted, please snap and export first or undo by bit recover`\n );\n }\n const getCurrentComponent = () => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (existingBitMapId) return consumer!.loadComponent(existingBitMapId);\n return this.scope.legacyScope.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 if (!consumer || !this.workspace) return undefined;\n const componentModificationStatus = await this.workspace.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 sourceHead: this.workspace ? undefined : modelComponent.getRef(currentId.version as string), // not sure if needs to check for this.workspace\n targetHead: otherLaneHead,\n throws: false,\n });\n if (divergeData.err) {\n if (!(divergeData.err instanceof NoCommonSnap) || !this.options?.resolveUnrelated) {\n return this.returnUnmerged(id, `unable to traverse history. error: ${divergeData.err.message}`);\n }\n return this.handleNoCommonSnap(\n modelComponent,\n id,\n otherLaneHead,\n currentComponent,\n componentOnOther,\n divergeData\n );\n }\n if (this.options.detachHead && divergeData.commonSnapBeforeDiverge) {\n // just override with the model data\n const commonSnapId = id.changeVersion(divergeData.commonSnapBeforeDiverge.toString());\n const commonSnapComp = await this.scope.legacyScope.getConsumerComponent(commonSnapId);\n return {\n ...componentStatus,\n currentComponent: commonSnapComp,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isSourceAhead()) {\n // component is ahead nothing to merge.\n return this.returnUnmerged(id, compIsAlreadyMergedMsg, true);\n }\n if (!divergeData.isTargetAhead()) {\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, compIsAlreadyMergedMsg, true);\n }\n // target is ahead.\n if (!this.options.handleTargetAheadAsDiverged || !divergeData.commonSnapBeforeDiverge) {\n // just override with the model data\n return {\n ...componentStatus,\n currentComponent,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n // target is ahead and we want to treat it as diverged, continue.\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 repo = this.scope.legacyScope.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":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAA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,GAAGoB,iBAAiB,GAAGC,eAAe;IACzF,MAAMF,gBAAgB,GAAGnB,gBAAgB,KAAK,MAAM,GAAGqB,eAAe,GAAGD,iBAAiB;IAC1F,IAAIpB,gBAAgB,KAAK,MAAM,EAAE;MAC/B,OAAOU,qBAAqB,CAACkB,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACvK,SAAS,EAAE+D,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAIqF,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACxK,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACb,yBAAyBmG,gBAAgB,kEAC3C,CAAC;EACH;AACF;AAAC7J,OAAA,CAAAC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CLIMain } from '@teambit/cli';
|
|
2
|
-
import type { Workspace
|
|
2
|
+
import type { Workspace } from '@teambit/workspace';
|
|
3
3
|
import type { Consumer } from '@teambit/legacy.consumer';
|
|
4
4
|
import { ComponentsList } from '@teambit/legacy.component-list';
|
|
5
5
|
import type { SnappingMain } from '@teambit/snapping';
|
|
@@ -9,18 +9,16 @@ import type { Ref, Lane, ModelComponent } from '@teambit/objects';
|
|
|
9
9
|
import type { ConfigMain } from '@teambit/config';
|
|
10
10
|
import type { RemoveMain } from '@teambit/remove';
|
|
11
11
|
import type { ComponentWriterMain } from '@teambit/component-writer';
|
|
12
|
-
import type { ConsumerComponent } from '@teambit/legacy.consumer-component';
|
|
13
12
|
import type { ImporterMain } from '@teambit/importer';
|
|
14
13
|
import type { Logger, LoggerMain } from '@teambit/logger';
|
|
15
14
|
import type { ApplyVersionWithComps, CheckoutMain, ComponentStatusBase } from '@teambit/checkout';
|
|
16
|
-
import type { ConfigMergerMain, ConfigMergeResult
|
|
15
|
+
import type { ConfigMergerMain, ConfigMergeResult } from '@teambit/config-merger';
|
|
17
16
|
import type { SnapsDistance } from '@teambit/component.snap-distance';
|
|
18
17
|
import type { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
19
18
|
import type { InstallMain } from '@teambit/install';
|
|
20
19
|
import type { ScopeMain } from '@teambit/scope';
|
|
21
20
|
import type { DataMergeResult, MergeStatusProviderOptions } from './merge-status-provider';
|
|
22
|
-
import type { MergeStrategy, MergeResultsThreeWay } from '
|
|
23
|
-
import { FileStatus } from './merge-version';
|
|
21
|
+
import type { MergeStrategy, MergeResultsThreeWay, ApplyVersionResults } from '@teambit/component.modules.merge-helper';
|
|
24
22
|
import type { ConfigStoreMain } from '@teambit/config-store';
|
|
25
23
|
import type { ApplicationMain } from '@teambit/application';
|
|
26
24
|
type ResolveUnrelatedData = {
|
|
@@ -49,44 +47,6 @@ export type ComponentMergeStatusBeforeMergeAttempt = ComponentStatusBase & {
|
|
|
49
47
|
modelComponent: ModelComponent;
|
|
50
48
|
};
|
|
51
49
|
};
|
|
52
|
-
export type FailedComponents = {
|
|
53
|
-
id: ComponentID;
|
|
54
|
-
unchangedMessage: string;
|
|
55
|
-
unchangedLegitimately?: boolean;
|
|
56
|
-
};
|
|
57
|
-
export type FilesStatus = {
|
|
58
|
-
[fileName: string]: keyof typeof FileStatus;
|
|
59
|
-
};
|
|
60
|
-
export type MergeSnapResults = {
|
|
61
|
-
snappedComponents: ConsumerComponent[];
|
|
62
|
-
autoSnappedResults: AutoTagResult[];
|
|
63
|
-
removedComponents?: ComponentIdList;
|
|
64
|
-
exportedIds?: ComponentID[];
|
|
65
|
-
} | null;
|
|
66
|
-
export type ApplyVersionResult = {
|
|
67
|
-
id: ComponentID;
|
|
68
|
-
filesStatus: FilesStatus;
|
|
69
|
-
};
|
|
70
|
-
export type ApplyVersionResults = {
|
|
71
|
-
components?: ApplyVersionResult[];
|
|
72
|
-
version?: string;
|
|
73
|
-
failedComponents?: FailedComponents[];
|
|
74
|
-
removedComponents?: ComponentID[];
|
|
75
|
-
addedComponents?: ComponentID[];
|
|
76
|
-
newComponents?: ComponentID[];
|
|
77
|
-
resolvedComponents?: ConsumerComponent[];
|
|
78
|
-
abortedComponents?: ApplyVersionResult[];
|
|
79
|
-
mergeSnapResults?: MergeSnapResults;
|
|
80
|
-
mergeSnapError?: Error;
|
|
81
|
-
leftUnresolvedConflicts?: boolean;
|
|
82
|
-
verbose?: boolean;
|
|
83
|
-
newFromLane?: string[];
|
|
84
|
-
newFromLaneAdded?: boolean;
|
|
85
|
-
installationError?: Error;
|
|
86
|
-
compilationError?: Error;
|
|
87
|
-
workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult;
|
|
88
|
-
gitBranchWarning?: string;
|
|
89
|
-
};
|
|
90
50
|
export declare class MergingMain {
|
|
91
51
|
private workspace;
|
|
92
52
|
private scope;
|
|
@@ -179,9 +179,9 @@ function _mergeStatusProvider() {
|
|
|
179
179
|
};
|
|
180
180
|
return data;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const data = require("
|
|
184
|
-
|
|
182
|
+
function _componentModules() {
|
|
183
|
+
const data = require("@teambit/component.modules.merge-helper");
|
|
184
|
+
_componentModules = function () {
|
|
185
185
|
return data;
|
|
186
186
|
};
|
|
187
187
|
return data;
|
|
@@ -206,8 +206,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
206
206
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
207
207
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
208
208
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
209
|
-
// fileName is PathLinux. TS doesn't let anything else in the keys other than string and number
|
|
210
|
-
|
|
211
209
|
class MergingMain {
|
|
212
210
|
constructor(workspace, scope, install, snapping, checkout, logger, componentWriter, importer, config, remove, configMerger, depResolver, application) {
|
|
213
211
|
this.workspace = workspace;
|
|
@@ -286,7 +284,7 @@ class MergingMain {
|
|
|
286
284
|
const legacyScope = this.scope.legacyScope;
|
|
287
285
|
const componentWithConflict = allComponentsStatus.find(component => component.mergeResults && component.mergeResults.hasConflicts);
|
|
288
286
|
if (componentWithConflict && !mergeStrategy) {
|
|
289
|
-
mergeStrategy = await (0,
|
|
287
|
+
mergeStrategy = await (0, _componentModules().getMergeStrategyInteractive)();
|
|
290
288
|
}
|
|
291
289
|
const failedComponents = allComponentsStatus.filter(componentStatus => componentStatus.unchangedMessage).filter(componentStatus => !componentStatus.shouldBeRemoved).map(componentStatus => ({
|
|
292
290
|
id: componentStatus.id,
|
|
@@ -518,10 +516,10 @@ class MergingMain {
|
|
|
518
516
|
const markAllFilesAsUnchanged = () => {
|
|
519
517
|
if (!currentComponent) throw new Error(`applyVersion expect to get currentComponent for ${id.toString()}`);
|
|
520
518
|
currentComponent.files.forEach(file => {
|
|
521
|
-
filesStatus[(0, _toolboxPath().pathNormalizeToLinux)(file.relative)] =
|
|
519
|
+
filesStatus[(0, _toolboxPath().pathNormalizeToLinux)(file.relative)] = _componentModules().FileStatus.unchanged;
|
|
522
520
|
});
|
|
523
521
|
};
|
|
524
|
-
if (mergeResults && mergeResults.hasConflicts && mergeStrategy ===
|
|
522
|
+
if (mergeResults && mergeResults.hasConflicts && mergeStrategy === _componentModules().MergeOptions.ours) {
|
|
525
523
|
markAllFilesAsUnchanged();
|
|
526
524
|
legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);
|
|
527
525
|
return {
|
|
@@ -537,9 +535,9 @@ class MergingMain {
|
|
|
537
535
|
return handleResolveUnrelated();
|
|
538
536
|
}
|
|
539
537
|
const remoteId = id.changeVersion(remoteHead.toString());
|
|
540
|
-
const idToLoad = !mergeResults || mergeStrategy ===
|
|
538
|
+
const idToLoad = !mergeResults || mergeStrategy === _componentModules().MergeOptions.theirs ? remoteId : id;
|
|
541
539
|
const legacyComponent = this.workspace ? await this.workspace.consumer.loadComponentFromModelImportIfNeeded(idToLoad) : await legacyScope.getConsumerComponent(idToLoad); // when loading from the scope, we import all needed components first, so it should be fine. otherwise, change the code to import it here
|
|
542
|
-
if (mergeResults && mergeStrategy ===
|
|
540
|
+
if (mergeResults && mergeStrategy === _componentModules().MergeOptions.theirs) {
|
|
543
541
|
// in this case, we don't want to update .bitmap with the version of the remote. we want to keep the same version
|
|
544
542
|
legacyComponent.version = id.version;
|
|
545
543
|
}
|
|
@@ -550,7 +548,7 @@ class MergingMain {
|
|
|
550
548
|
const {
|
|
551
549
|
filesStatus: modifiedStatus,
|
|
552
550
|
modifiedFiles
|
|
553
|
-
} = (0,
|
|
551
|
+
} = (0, _componentModules().applyModifiedVersion)(files, mergeResults, mergeStrategy);
|
|
554
552
|
legacyComponent.files = modifiedFiles;
|
|
555
553
|
filesStatus = _objectSpread(_objectSpread({}, filesStatus), modifiedStatus);
|
|
556
554
|
}
|
|
@@ -567,7 +565,7 @@ class MergingMain {
|
|
|
567
565
|
// if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents
|
|
568
566
|
// otherwise, update the head of the current lane or main
|
|
569
567
|
if (mergeResults) {
|
|
570
|
-
if (mergeResults.hasConflicts && mergeStrategy ===
|
|
568
|
+
if (mergeResults.hasConflicts && mergeStrategy === _componentModules().MergeOptions.manual) {
|
|
571
569
|
unmergedComponent.unmergedPaths = mergeResults.modifiedFiles.filter(f => f.conflict).map(f => f.filePath);
|
|
572
570
|
}
|
|
573
571
|
legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);
|