@teambit/merging 1.0.510 → 1.0.512
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/artifacts/__bit_junit.xml +1 -1
- package/dist/merge-status-provider.d.ts +1 -1
- package/dist/merge-status-provider.js.map +1 -1
- package/dist/merge-version/three-way-merge.d.ts +1 -1
- package/dist/merge-version/three-way-merge.js.map +1 -1
- package/dist/merging.main.runtime.d.ts +1 -1
- package/dist/merging.main.runtime.js.map +1 -1
- package/merge-version/three-way-merge.ts +1 -1
- package/package.json +33 -33
- package/artifacts/schema.json +0 -11577
- /package/dist/{preview-1736705249371.js → preview-1736824735631.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="0" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.component/merging@1.0.
|
|
3
|
+
<testsuite name="teambit.component/merging@1.0.512" tests="0" failures="0" errors="0" skipped="0"/>
|
|
4
4
|
</testsuites>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Workspace } from '@teambit/workspace';
|
|
2
2
|
import { ComponentID } from '@teambit/component-id';
|
|
3
|
-
import { Lane } from '@teambit/
|
|
3
|
+
import { Lane } from '@teambit/objects';
|
|
4
4
|
import { ImporterMain } from '@teambit/importer';
|
|
5
5
|
import { Logger } from '@teambit/logger';
|
|
6
6
|
import { ScopeMain } from '@teambit/scope';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_component","_legacy","_lodash","_configMerger","_mergeVersion","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","mergeResults","threeWayMerge","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 { Workspace } from '@teambit/workspace';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { DEFAULT_LANE, LaneId } from '@teambit/lane-id';\nimport { getDivergeData, SnapsDistance } from '@teambit/component.snap-distance';\nimport { Lane, ModelComponent, Version, Ref } from '@teambit/scope.objects';\nimport { NoCommonSnap, Tmp } from '@teambit/legacy.scope';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { ImporterMain } from '@teambit/importer';\nimport { Logger } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport { ScopeMain } from '@teambit/scope';\nimport { threeWayMerge, MergeStrategy } from './merge-version';\nimport { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\n\nexport type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n mergeStrategy: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n handleTargetAheadAsDiverged?: boolean;\n detachHead?: boolean;\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 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 };\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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,kBAAkB,GAAGJ,eAAe,GAAGD,iBAAiB;MACjF,IAAIpB,gBAAgB,KAAK,MAAM,EAAE;QAC/B,OAAOU,qBAAqB,CAACkB,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACrJ,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;MACzG;MACA,IAAIkE,gBAAgB,KAAK,QAAQ,EAAE;QACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACrJ,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;MAC3G;MACA,MAAM,IAAId,KAAK,CACb,yBAAyBgF,gBAAgB,kEAC3C,CAAC;IACH;IAEA,MAAM4B,eAAe,GAAG5B,gBAAgB,KAAK,MAAM,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,CAACpJ,SAAS,EAAE+D,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAIkE,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACrJ,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACb,yBAAyBgF,gBAAgB,kEAC3C,CAAC;EACH;AACF;AAAC1I,OAAA,CAAAC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_componentId","_laneId","_component","_legacy","_lodash","_configMerger","_mergeVersion","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","mergeResults","threeWayMerge","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 { Workspace } from '@teambit/workspace';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { DEFAULT_LANE, LaneId } from '@teambit/lane-id';\nimport { getDivergeData, SnapsDistance } from '@teambit/component.snap-distance';\nimport { Lane, ModelComponent, Version, Ref } from '@teambit/objects';\nimport { NoCommonSnap, Tmp } from '@teambit/legacy.scope';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { ImporterMain } from '@teambit/importer';\nimport { Logger } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport { ScopeMain } from '@teambit/scope';\nimport { threeWayMerge, MergeStrategy } from './merge-version';\nimport { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\n\nexport type MergeStatusProviderOptions = {\n resolveUnrelated?: MergeStrategy;\n mergeStrategy: MergeStrategy;\n ignoreConfigChanges?: boolean;\n shouldSquash?: boolean;\n handleTargetAheadAsDiverged?: boolean;\n detachHead?: boolean;\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 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 };\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;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,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;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,cAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,aAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAS,cAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,aAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+D,SAAAC,uBAAAS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e,GAAGH,kBAAkB,GAAGL,iBAAiB,GAAGC,eAAe;MAChF,MAAMF,gBAAgB,GAAGM,kBAAkB,GAAGJ,eAAe,GAAGD,iBAAiB;MACjF,IAAIpB,gBAAgB,KAAK,MAAM,EAAE;QAC/B,OAAOU,qBAAqB,CAACkB,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACrJ,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;MACzG;MACA,IAAIkE,gBAAgB,KAAK,QAAQ,EAAE;QACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACrJ,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;MAC3G;MACA,MAAM,IAAId,KAAK,CACb,yBAAyBgF,gBAAgB,kEAC3C,CAAC;IACH;IAEA,MAAM4B,eAAe,GAAG5B,gBAAgB,KAAK,MAAM,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,CAACpJ,SAAS,EAAE+D,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAIkE,gBAAgB,KAAK,QAAQ,EAAE;MACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACrJ,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACb,yBAAyBgF,gBAAgB,kEAC3C,CAAC;EACH;AACF;AAAC1I,OAAA,CAAAC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Version, SourceFileModel } from '@teambit/
|
|
1
|
+
import { Version, SourceFileModel } from '@teambit/objects';
|
|
2
2
|
import { PathLinux } from '@teambit/toolbox.path.path';
|
|
3
3
|
import { ConsumerComponent as Component } from '@teambit/legacy.consumer-component';
|
|
4
4
|
import { SourceFile } from '@teambit/component.sources';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bitError","data","require","_toolboxCrypto","_toolboxPath","eol","_interopRequireWildcard","_mergeFiles","_component","_legacy","_lodash","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","threeWayMerge","scope","otherComponent","otherLabel","currentComponent","currentLabel","baseComponent","baseFiles","files","otherFiles","currentFiles","cloneFilesWithSharedDir","forEach","fsFile","contents","lf","results","addFiles","removeFiles","remainDeletedFiles","deletedConflictFiles","modifiedFiles","unModifiedFiles","overrideFiles","updatedFiles","hasConflicts","getFileResult","baseFile","otherFile","filePath","pathNormalizeToLinux","relative","fsFileHash","sha1","push","baseFileHash","file","hash","otherFileHash","content","load","objects","label","output","conflict","Promise","all","map","relativePath","find","fsFilesPaths","baseFilesPaths","isOtherSameAsBase","Error","deletedFromFs","filter","includes","deletedAndModified","addedOnOther","SourceFile","loadFromSourceFileModel","isEmpty","conflictResults","getMergeResults","conflictResult","modifiedFile","BitError","isBinaryConflict","tmp","Tmp","conflictResultsP","fsFilePathP","save","writeFile","toString","baseFilePathP","otherFilePathP","fsFilePath","baseFilePath","otherFilePath","mergeFilesParams","currentFile","path","mergeFiles"],"sources":["three-way-merge.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { Source, Version, SourceFileModel } from '@teambit/scope.objects';\nimport { sha1 } from '@teambit/toolbox.crypto.sha1';\nimport { PathLinux, pathNormalizeToLinux, PathOsBased } from '@teambit/toolbox.path.path';\nimport * as eol from '@teambit/toolbox.string.eol';\nimport { mergeFiles, MergeFileParams, MergeFileResult } from '../merge-files';\nimport { ConsumerComponent as Component } from '@teambit/legacy.consumer-component';\nimport { SourceFile } from '@teambit/component.sources';\nimport { Tmp, Scope } from '@teambit/legacy.scope';\nimport { isEmpty } from 'lodash';\n\nexport type MergeResultsThreeWay = {\n addFiles: Array<{\n filePath: PathLinux;\n fsFile: SourceFile;\n }>;\n removeFiles: Array<{\n filePath: PathLinux;\n }>;\n remainDeletedFiles: Array<{\n filePath: PathLinux;\n }>;\n deletedConflictFiles: Array<{\n filePath: PathLinux;\n fsFile?: SourceFile;\n }>;\n modifiedFiles: Array<{\n filePath: PathLinux;\n fsFile: SourceFile;\n baseFile?: SourceFileModel;\n otherFile: SourceFileModel;\n output: string | null | undefined;\n conflict: string | null | undefined;\n isBinaryConflict?: boolean;\n }>;\n unModifiedFiles: Array<{\n filePath: PathLinux;\n fsFile: SourceFile;\n }>;\n overrideFiles: Array<{\n filePath: PathLinux;\n fsFile: SourceFile;\n }>;\n updatedFiles: Array<{\n filePath: PathLinux;\n otherFile: SourceFileModel;\n content: Buffer;\n }>;\n hasConflicts: boolean;\n};\n\n/**\n * to do the actual merge we use git, specifically `merge-file` command, so we try to use the same\n * terminology as git. From the command help:\n * `git merge-file <current-file> <base-file> <other-file>\n * git merge-file incorporates all changes that lead from the <base-file> to <other-file> into\n * <current-file>. The result ordinarily goes into <current-file>.`\n *\n * see checkout-version.getBaseVersion() for a case when a component is modified and then the base-file is not the\n * common file before other-file and current-file.\n * otherwise, Git terminology pretty much reflects what we do here. current-file is the one that is currently written\n * to the filesystem. other-file is the one the user wants to checkout to. base-file is the original file where both:\n * base-file and other-file were originated from.\n */\nexport async function threeWayMerge({\n scope,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n}: {\n scope: Scope;\n otherComponent: Version;\n otherLabel: string;\n currentComponent: Component;\n currentLabel: string;\n baseComponent: Version;\n}): Promise<MergeResultsThreeWay> {\n // baseFiles and currentFiles come from the model, therefore their paths include the\n // sharedOriginallyDir. fsFiles come from the Fs, therefore their paths don't include the\n // sharedOriginallyDir.\n // option 1) strip sharedOriginallyDir from baseFiles and currentFiles. the problem is that the\n // sharedDir can be different if the dependencies were changes for example, as a result, it won't\n // be possible to compare between the files as the paths are different.\n // in the previous it was implemented this way and caused a bug, which now has an e2e-test to\n // block it. see https://github.com/teambit/bit/pull/2070 PR.\n // option 2) add sharedOriginallyDir to the fsFiles. we must go with this option.\n // one thing we have to change is the end-of-line, it should be set as LF, same way we do before\n // saving the file as an object.\n const baseFiles: SourceFileModel[] = baseComponent.files;\n const otherFiles: SourceFileModel[] = otherComponent.files;\n const currentFiles: SourceFile[] = currentComponent.cloneFilesWithSharedDir();\n currentFiles.forEach((fsFile) => {\n fsFile.contents = eol.lf(fsFile.contents) as Buffer;\n });\n const results: MergeResultsThreeWay = {\n addFiles: [],\n removeFiles: [],\n remainDeletedFiles: [],\n deletedConflictFiles: [],\n modifiedFiles: [],\n unModifiedFiles: [],\n overrideFiles: [],\n updatedFiles: [],\n hasConflicts: false,\n };\n const getFileResult = async (fsFile: SourceFile, baseFile?: SourceFileModel, otherFile?: SourceFileModel) => {\n const filePath: PathLinux = pathNormalizeToLinux(fsFile.relative);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const fsFileHash = sha1(fsFile.contents);\n if (!otherFile) {\n // if !otherFile && !baseFile, the file was created after the last tag, no need to do any\n // calculation, the file should be added\n if (!baseFile) {\n results.addFiles.push({ filePath, fsFile });\n return;\n }\n const baseFileHash = baseFile.file.hash;\n if (fsFileHash === baseFileHash) {\n results.removeFiles.push({ filePath });\n return;\n }\n results.deletedConflictFiles.push({ filePath });\n return;\n }\n const otherFileHash = otherFile.file.hash;\n if (fsFileHash === otherFileHash) {\n // if fs === other, no need to take any action (regardless the base)\n results.unModifiedFiles.push({ filePath, fsFile });\n return;\n }\n if (baseFile && fsFileHash === baseFile.file.hash) {\n // the file has no local modification.\n // the file currently in the fs, is not the same as the file we want to write (other).\n // but no need to check whether it has conflicts because we always want to write the other.\n const content = (await otherFile.file.load(scope.objects)) as Source;\n results.updatedFiles.push({ filePath, otherFile, content: content.contents });\n return;\n }\n // it was changed in both, there is a chance for conflict. (regardless the base)\n fsFile.label = currentLabel;\n // @ts-ignore it's a hack to pass the data, version is not a valid attribute.\n otherFile.label = otherLabel;\n results.modifiedFiles.push({ filePath, fsFile, baseFile, otherFile, output: null, conflict: null });\n };\n\n await Promise.all(\n currentFiles.map(async (fsFile) => {\n const relativePath = pathNormalizeToLinux(fsFile.relative);\n const baseFile = baseFiles.find((file) => file.relativePath === relativePath);\n const otherFile = otherFiles.find((file) => file.relativePath === relativePath);\n await getFileResult(fsFile, baseFile, otherFile);\n })\n );\n const fsFilesPaths = currentFiles.map((fsFile) => pathNormalizeToLinux(fsFile.relative));\n const baseFilesPaths = baseFiles.map((baseFile) => baseFile.relativePath);\n const isOtherSameAsBase = (otherFile: SourceFileModel) => {\n const baseFile = baseFiles.find((file) => file.relativePath === otherFile.relativePath);\n if (!baseFile) throw new Error('isOtherSameAsBase expect the base to be there');\n return baseFile.file.hash === otherFile.file.hash;\n };\n const deletedFromFs = otherFiles.filter(\n (otherFile) =>\n !fsFilesPaths.includes(otherFile.relativePath) &&\n baseFilesPaths.includes(otherFile.relativePath) &&\n isOtherSameAsBase(otherFile)\n );\n const deletedAndModified = otherFiles.filter(\n (otherFile) =>\n !fsFilesPaths.includes(otherFile.relativePath) &&\n baseFilesPaths.includes(otherFile.relativePath) &&\n !isOtherSameAsBase(otherFile)\n );\n const addedOnOther = otherFiles.filter(\n (otherFile) => !fsFilesPaths.includes(otherFile.relativePath) && !baseFilesPaths.includes(otherFile.relativePath)\n );\n deletedFromFs.forEach((file) => results.remainDeletedFiles.push({ filePath: file.relativePath }));\n deletedAndModified.forEach((file) => results.deletedConflictFiles.push({ filePath: file.relativePath }));\n\n await Promise.all(\n addedOnOther.map(async (file) => {\n const fsFile = await SourceFile.loadFromSourceFileModel(file, scope.objects);\n results.addFiles.push({ filePath: file.relativePath, fsFile });\n })\n );\n await Promise.all(\n deletedAndModified.map(async (file) => {\n const fsFile = await SourceFile.loadFromSourceFileModel(file, scope.objects);\n results.deletedConflictFiles.push({ filePath: file.relativePath, fsFile });\n })\n );\n if (isEmpty(results.modifiedFiles)) return results;\n\n const conflictResults = await getMergeResults(scope, results.modifiedFiles);\n conflictResults.forEach((conflictResult: MergeFileResult) => {\n const modifiedFile = results.modifiedFiles.find((file) => file.filePath === conflictResult.filePath);\n if (!modifiedFile) throw new BitError(`unable to find ${conflictResult.filePath} in modified files array`);\n modifiedFile.output = conflictResult.output;\n modifiedFile.conflict = conflictResult.conflict;\n modifiedFile.isBinaryConflict = conflictResult.isBinaryConflict;\n if (conflictResult.conflict || conflictResult.isBinaryConflict) results.hasConflicts = true;\n });\n\n return results;\n}\n\nasync function getMergeResults(\n scope: Scope,\n modifiedFiles: MergeResultsThreeWay['modifiedFiles']\n): Promise<MergeFileResult[]> {\n const tmp = new Tmp(scope);\n const conflictResultsP = modifiedFiles.map(async (modifiedFile) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const fsFilePathP = tmp.save(modifiedFile.fsFile.contents);\n const writeFile = async (file: SourceFileModel): Promise<PathOsBased> => {\n const content = await file.file.load(scope.objects);\n // @ts-ignore\n return tmp.save(content.contents.toString());\n };\n const baseFilePathP = modifiedFile.baseFile ? writeFile(modifiedFile.baseFile) : tmp.save('');\n const otherFilePathP = writeFile(modifiedFile.otherFile);\n const [fsFilePath, baseFilePath, otherFilePath] = await Promise.all([fsFilePathP, baseFilePathP, otherFilePathP]);\n const mergeFilesParams: MergeFileParams = {\n filePath: modifiedFile.filePath,\n currentFile: {\n label: modifiedFile.fsFile.label,\n path: fsFilePath,\n },\n baseFile: {\n path: baseFilePath,\n },\n otherFile: {\n // @ts-ignore\n label: modifiedFile.otherFile.label,\n path: otherFilePath,\n },\n };\n return mergeFiles(mergeFilesParams);\n });\n return Promise.all(conflictResultsP);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CA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AAMI,gBAAiC,GAAG;MACxCnD,QAAQ,EAAEoC,YAAY,CAACpC,QAAQ;MAC/BoD,WAAW,EAAE;QACXvC,KAAK,EAAEuB,YAAY,CAACpD,MAAM,CAAC6B,KAAK;QAChCwC,IAAI,EAAEL;MACR,CAAC;MACDlD,QAAQ,EAAE;QACRuD,IAAI,EAAEJ;MACR,CAAC;MACDlD,SAAS,EAAE;QACT;QACAc,KAAK,EAAEuB,YAAY,CAACrC,SAAS,CAACc,KAAK;QACnCwC,IAAI,EAAEH;MACR;IACF,CAAC;IACD,OAAO,IAAAI,wBAAU,EAACH,gBAAgB,CAAC;EACrC,CAAC,CAAC;EACF,OAAOnC,OAAO,CAACC,GAAG,CAACwB,gBAAgB,CAAC;AACtC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_bitError","data","require","_toolboxCrypto","_toolboxPath","eol","_interopRequireWildcard","_mergeFiles","_component","_legacy","_lodash","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","threeWayMerge","scope","otherComponent","otherLabel","currentComponent","currentLabel","baseComponent","baseFiles","files","otherFiles","currentFiles","cloneFilesWithSharedDir","forEach","fsFile","contents","lf","results","addFiles","removeFiles","remainDeletedFiles","deletedConflictFiles","modifiedFiles","unModifiedFiles","overrideFiles","updatedFiles","hasConflicts","getFileResult","baseFile","otherFile","filePath","pathNormalizeToLinux","relative","fsFileHash","sha1","push","baseFileHash","file","hash","otherFileHash","content","load","objects","label","output","conflict","Promise","all","map","relativePath","find","fsFilesPaths","baseFilesPaths","isOtherSameAsBase","Error","deletedFromFs","filter","includes","deletedAndModified","addedOnOther","SourceFile","loadFromSourceFileModel","isEmpty","conflictResults","getMergeResults","conflictResult","modifiedFile","BitError","isBinaryConflict","tmp","Tmp","conflictResultsP","fsFilePathP","save","writeFile","toString","baseFilePathP","otherFilePathP","fsFilePath","baseFilePath","otherFilePath","mergeFilesParams","currentFile","path","mergeFiles"],"sources":["three-way-merge.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { Source, Version, SourceFileModel } from '@teambit/objects';\nimport { sha1 } from '@teambit/toolbox.crypto.sha1';\nimport { PathLinux, pathNormalizeToLinux, PathOsBased } from '@teambit/toolbox.path.path';\nimport * as eol from '@teambit/toolbox.string.eol';\nimport { mergeFiles, MergeFileParams, MergeFileResult } from '../merge-files';\nimport { ConsumerComponent as Component } from '@teambit/legacy.consumer-component';\nimport { SourceFile } from '@teambit/component.sources';\nimport { Tmp, Scope } from '@teambit/legacy.scope';\nimport { isEmpty } from 'lodash';\n\nexport type MergeResultsThreeWay = {\n addFiles: Array<{\n filePath: PathLinux;\n fsFile: SourceFile;\n }>;\n removeFiles: Array<{\n filePath: PathLinux;\n }>;\n remainDeletedFiles: Array<{\n filePath: PathLinux;\n }>;\n deletedConflictFiles: Array<{\n filePath: PathLinux;\n fsFile?: SourceFile;\n }>;\n modifiedFiles: Array<{\n filePath: PathLinux;\n fsFile: SourceFile;\n baseFile?: SourceFileModel;\n otherFile: SourceFileModel;\n output: string | null | undefined;\n conflict: string | null | undefined;\n isBinaryConflict?: boolean;\n }>;\n unModifiedFiles: Array<{\n filePath: PathLinux;\n fsFile: SourceFile;\n }>;\n overrideFiles: Array<{\n filePath: PathLinux;\n fsFile: SourceFile;\n }>;\n updatedFiles: Array<{\n filePath: PathLinux;\n otherFile: SourceFileModel;\n content: Buffer;\n }>;\n hasConflicts: boolean;\n};\n\n/**\n * to do the actual merge we use git, specifically `merge-file` command, so we try to use the same\n * terminology as git. From the command help:\n * `git merge-file <current-file> <base-file> <other-file>\n * git merge-file incorporates all changes that lead from the <base-file> to <other-file> into\n * <current-file>. The result ordinarily goes into <current-file>.`\n *\n * see checkout-version.getBaseVersion() for a case when a component is modified and then the base-file is not the\n * common file before other-file and current-file.\n * otherwise, Git terminology pretty much reflects what we do here. current-file is the one that is currently written\n * to the filesystem. other-file is the one the user wants to checkout to. base-file is the original file where both:\n * base-file and other-file were originated from.\n */\nexport async function threeWayMerge({\n scope,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n}: {\n scope: Scope;\n otherComponent: Version;\n otherLabel: string;\n currentComponent: Component;\n currentLabel: string;\n baseComponent: Version;\n}): Promise<MergeResultsThreeWay> {\n // baseFiles and currentFiles come from the model, therefore their paths include the\n // sharedOriginallyDir. fsFiles come from the Fs, therefore their paths don't include the\n // sharedOriginallyDir.\n // option 1) strip sharedOriginallyDir from baseFiles and currentFiles. the problem is that the\n // sharedDir can be different if the dependencies were changes for example, as a result, it won't\n // be possible to compare between the files as the paths are different.\n // in the previous it was implemented this way and caused a bug, which now has an e2e-test to\n // block it. see https://github.com/teambit/bit/pull/2070 PR.\n // option 2) add sharedOriginallyDir to the fsFiles. we must go with this option.\n // one thing we have to change is the end-of-line, it should be set as LF, same way we do before\n // saving the file as an object.\n const baseFiles: SourceFileModel[] = baseComponent.files;\n const otherFiles: SourceFileModel[] = otherComponent.files;\n const currentFiles: SourceFile[] = currentComponent.cloneFilesWithSharedDir();\n currentFiles.forEach((fsFile) => {\n fsFile.contents = eol.lf(fsFile.contents) as Buffer;\n });\n const results: MergeResultsThreeWay = {\n addFiles: [],\n removeFiles: [],\n remainDeletedFiles: [],\n deletedConflictFiles: [],\n modifiedFiles: [],\n unModifiedFiles: [],\n overrideFiles: [],\n updatedFiles: [],\n hasConflicts: false,\n };\n const getFileResult = async (fsFile: SourceFile, baseFile?: SourceFileModel, otherFile?: SourceFileModel) => {\n const filePath: PathLinux = pathNormalizeToLinux(fsFile.relative);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const fsFileHash = sha1(fsFile.contents);\n if (!otherFile) {\n // if !otherFile && !baseFile, the file was created after the last tag, no need to do any\n // calculation, the file should be added\n if (!baseFile) {\n results.addFiles.push({ filePath, fsFile });\n return;\n }\n const baseFileHash = baseFile.file.hash;\n if (fsFileHash === baseFileHash) {\n results.removeFiles.push({ filePath });\n return;\n }\n results.deletedConflictFiles.push({ filePath });\n return;\n }\n const otherFileHash = otherFile.file.hash;\n if (fsFileHash === otherFileHash) {\n // if fs === other, no need to take any action (regardless the base)\n results.unModifiedFiles.push({ filePath, fsFile });\n return;\n }\n if (baseFile && fsFileHash === baseFile.file.hash) {\n // the file has no local modification.\n // the file currently in the fs, is not the same as the file we want to write (other).\n // but no need to check whether it has conflicts because we always want to write the other.\n const content = (await otherFile.file.load(scope.objects)) as Source;\n results.updatedFiles.push({ filePath, otherFile, content: content.contents });\n return;\n }\n // it was changed in both, there is a chance for conflict. (regardless the base)\n fsFile.label = currentLabel;\n // @ts-ignore it's a hack to pass the data, version is not a valid attribute.\n otherFile.label = otherLabel;\n results.modifiedFiles.push({ filePath, fsFile, baseFile, otherFile, output: null, conflict: null });\n };\n\n await Promise.all(\n currentFiles.map(async (fsFile) => {\n const relativePath = pathNormalizeToLinux(fsFile.relative);\n const baseFile = baseFiles.find((file) => file.relativePath === relativePath);\n const otherFile = otherFiles.find((file) => file.relativePath === relativePath);\n await getFileResult(fsFile, baseFile, otherFile);\n })\n );\n const fsFilesPaths = currentFiles.map((fsFile) => pathNormalizeToLinux(fsFile.relative));\n const baseFilesPaths = baseFiles.map((baseFile) => baseFile.relativePath);\n const isOtherSameAsBase = (otherFile: SourceFileModel) => {\n const baseFile = baseFiles.find((file) => file.relativePath === otherFile.relativePath);\n if (!baseFile) throw new Error('isOtherSameAsBase expect the base to be there');\n return baseFile.file.hash === otherFile.file.hash;\n };\n const deletedFromFs = otherFiles.filter(\n (otherFile) =>\n !fsFilesPaths.includes(otherFile.relativePath) &&\n baseFilesPaths.includes(otherFile.relativePath) &&\n isOtherSameAsBase(otherFile)\n );\n const deletedAndModified = otherFiles.filter(\n (otherFile) =>\n !fsFilesPaths.includes(otherFile.relativePath) &&\n baseFilesPaths.includes(otherFile.relativePath) &&\n !isOtherSameAsBase(otherFile)\n );\n const addedOnOther = otherFiles.filter(\n (otherFile) => !fsFilesPaths.includes(otherFile.relativePath) && !baseFilesPaths.includes(otherFile.relativePath)\n );\n deletedFromFs.forEach((file) => results.remainDeletedFiles.push({ filePath: file.relativePath }));\n deletedAndModified.forEach((file) => results.deletedConflictFiles.push({ filePath: file.relativePath }));\n\n await Promise.all(\n addedOnOther.map(async (file) => {\n const fsFile = await SourceFile.loadFromSourceFileModel(file, scope.objects);\n results.addFiles.push({ filePath: file.relativePath, fsFile });\n })\n );\n await Promise.all(\n deletedAndModified.map(async (file) => {\n const fsFile = await SourceFile.loadFromSourceFileModel(file, scope.objects);\n results.deletedConflictFiles.push({ filePath: file.relativePath, fsFile });\n })\n );\n if (isEmpty(results.modifiedFiles)) return results;\n\n const conflictResults = await getMergeResults(scope, results.modifiedFiles);\n conflictResults.forEach((conflictResult: MergeFileResult) => {\n const modifiedFile = results.modifiedFiles.find((file) => file.filePath === conflictResult.filePath);\n if (!modifiedFile) throw new BitError(`unable to find ${conflictResult.filePath} in modified files array`);\n modifiedFile.output = conflictResult.output;\n modifiedFile.conflict = conflictResult.conflict;\n modifiedFile.isBinaryConflict = conflictResult.isBinaryConflict;\n if (conflictResult.conflict || conflictResult.isBinaryConflict) results.hasConflicts = true;\n });\n\n return results;\n}\n\nasync function getMergeResults(\n scope: Scope,\n modifiedFiles: MergeResultsThreeWay['modifiedFiles']\n): Promise<MergeFileResult[]> {\n const tmp = new Tmp(scope);\n const conflictResultsP = modifiedFiles.map(async (modifiedFile) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const fsFilePathP = tmp.save(modifiedFile.fsFile.contents);\n const writeFile = async (file: SourceFileModel): Promise<PathOsBased> => {\n const content = await file.file.load(scope.objects);\n // @ts-ignore\n return tmp.save(content.contents.toString());\n };\n const baseFilePathP = modifiedFile.baseFile ? writeFile(modifiedFile.baseFile) : tmp.save('');\n const otherFilePathP = writeFile(modifiedFile.otherFile);\n const [fsFilePath, baseFilePath, otherFilePath] = await Promise.all([fsFilePathP, baseFilePathP, otherFilePathP]);\n const mergeFilesParams: MergeFileParams = {\n filePath: modifiedFile.filePath,\n currentFile: {\n label: modifiedFile.fsFile.label,\n path: fsFilePath,\n },\n baseFile: {\n path: baseFilePath,\n },\n otherFile: {\n // @ts-ignore\n label: modifiedFile.otherFile.label,\n path: otherFilePath,\n },\n };\n return mergeFiles(mergeFilesParams);\n });\n return Promise.all(conflictResultsP);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,eAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAK,uBAAA,CAAAJ,OAAA;EAAAG,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,YAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,WAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,WAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,QAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,OAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,QAAA;EAAA,MAAAT,IAAA,GAAA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MC,aAAa,GAAGV,YAAY,CAACtC,QAAQ,GAAG8C,SAAS,CAACR,YAAY,CAACtC,QAAQ,CAAC,GAAGyC,GAAG,CAACI,IAAI,CAAC,EAAE,CAAC;IAC7F,MAAMI,cAAc,GAAGH,SAAS,CAACR,YAAY,CAACrC,SAAS,CAAC;IACxD,MAAM,CAACiD,UAAU,EAAEC,YAAY,EAAEC,aAAa,CAAC,GAAG,MAAMlC,OAAO,CAACC,GAAG,CAAC,CAACyB,WAAW,EAAEI,aAAa,EAAEC,cAAc,CAAC,CAAC;IACjH,MAAMI,gBAAiC,GAAG;MACxCnD,QAAQ,EAAEoC,YAAY,CAACpC,QAAQ;MAC/BoD,WAAW,EAAE;QACXvC,KAAK,EAAEuB,YAAY,CAACpD,MAAM,CAAC6B,KAAK;QAChCwC,IAAI,EAAEL;MACR,CAAC;MACDlD,QAAQ,EAAE;QACRuD,IAAI,EAAEJ;MACR,CAAC;MACDlD,SAAS,EAAE;QACT;QACAc,KAAK,EAAEuB,YAAY,CAACrC,SAAS,CAACc,KAAK;QACnCwC,IAAI,EAAEH;MACR;IACF,CAAC;IACD,OAAO,IAAAI,wBAAU,EAACH,gBAAgB,CAAC;EACrC,CAAC,CAAC;EACF,OAAOnC,OAAO,CAACC,GAAG,CAACwB,gBAAgB,CAAC;AACtC","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ import { ComponentsList } from '@teambit/legacy.component-list';
|
|
|
5
5
|
import { SnappingMain } from '@teambit/snapping';
|
|
6
6
|
import { ComponentID, ComponentIdList } from '@teambit/component-id';
|
|
7
7
|
import { LaneId } from '@teambit/lane-id';
|
|
8
|
-
import { Ref, Lane, ModelComponent } from '@teambit/
|
|
8
|
+
import { Ref, Lane, ModelComponent } from '@teambit/objects';
|
|
9
9
|
import { ConfigMain } from '@teambit/config';
|
|
10
10
|
import { RemoveMain } from '@teambit/remove';
|
|
11
11
|
import { ComponentWriterMain } from '@teambit/component-writer';
|