@teambit/merging 1.0.667 → 1.0.668
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/merge-cmd.d.ts +6 -6
- package/dist/merge-cmd.js.map +1 -1
- package/dist/merge-files.d.ts +1 -1
- package/dist/merge-files.js.map +1 -1
- package/dist/merge-status-provider.d.ts +8 -8
- package/dist/merge-status-provider.js.map +1 -1
- package/dist/merge-version/three-way-merge.d.ts +4 -4
- package/dist/merge-version/three-way-merge.js.map +1 -1
- package/dist/merging.main.runtime.d.ts +22 -21
- package/dist/merging.main.runtime.js.map +1 -1
- package/merge-version/three-way-merge.ts +8 -5
- package/package.json +27 -27
- /package/dist/{preview-1753809186996.js → preview-1753833698619.js} +0 -0
package/dist/merge-cmd.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
-
import { ComponentID } from '@teambit/component-id';
|
|
3
|
-
import { ConfigMergeResult, WorkspaceConfigUpdateResult } from '@teambit/config-merger';
|
|
4
|
-
import { MergeStrategy } from './merge-version';
|
|
5
|
-
import { ApplyVersionResults, MergingMain, ApplyVersionResult } from './merging.main.runtime';
|
|
6
|
-
import { ConfigStoreMain } from '@teambit/config-store';
|
|
1
|
+
import type { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import type { ComponentID } from '@teambit/component-id';
|
|
3
|
+
import type { ConfigMergeResult, WorkspaceConfigUpdateResult } from '@teambit/config-merger';
|
|
4
|
+
import type { MergeStrategy } from './merge-version';
|
|
5
|
+
import type { ApplyVersionResults, MergingMain, ApplyVersionResult } from './merging.main.runtime';
|
|
6
|
+
import type { ConfigStoreMain } from '@teambit/config-store';
|
|
7
7
|
export declare class MergeCmd implements Command {
|
|
8
8
|
private merging;
|
|
9
9
|
private configStore;
|
package/dist/merge-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","_legacy","_bitError","_mergeVersion","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MergeCmd","constructor","merging","configStore","name","description","COMPONENT_PATTERN_HELP","report","pattern","ours","theirs","manual","autoMergeResolve","abort","resolve","build","noSnap","verbose","message","skipDependencyInstallation","getConfigBoolean","CFG_FORCE_LOCAL_BUILD","Boolean","BitError","components","failedComponents","version","resolvedComponents","abortedComponents","mergeSnapResults","mergeSnapError","merge","title","componentsStr","map","c","id","toStringWithoutVersion","join","chalk","underline","green","mergeReport","exports","removedComponents","leftUnresolvedConflicts","configMergeResults","workspaceConfigUpdateResult","getSuccessOutput","length","bold","fileChangesReport","applyVersionReport","componentsWithConflicts","getConflictSummary","suggestion","conflictSummary","conflictSummaryReport","conflictedComponents","conflictStr","yellow","configMergeWithConflicts","filter","hasConflicts","getConfigMergeConflictSummary","comps","compIdStr","MergeConfigFilename","getSnapsOutput","snappedComponents","autoSnappedResults","outputComponents","component","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutVersion","autoTagComp","a","AUTO_SNAPPED_MSG","getFailureOutput","body","compact","failedComponent","white","unchangedMessage","getSummary","merged","unchangedLegitimately","f","autoSnapped","getConflictStr","ws","workspaceDepsConflicts","mergeConfig","mergedStr","unchangedLegitimatelyStr","autoSnappedStr","removedStr","getRemovedOutput","getWorkspaceConfigUpdateOutput","workspaceConfigConflictWriteError","workspaceDepsUpdates","workspaceDepsUnchanged","getWorkspaceConflictsOutput","red","getWorkspaceUnchangedDepsOutput","keys","pkgName","getWorkspaceDepsOutput","from","to","addName","showVersion","tab","fileChanges","files","filesStatus","file","FileStatus","unchanged","note","cyan","FILE_CHANGES_CHECKOUT_MSG","conflictedFiles","installationErrorOutput","installationError","subTitle","compilationErrorOutput","compilationError","getAddedOutput","addedComponents"],"sources":["merge-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ComponentID } from '@teambit/component-id';\nimport { compact } from 'lodash';\nimport {\n COMPONENT_PATTERN_HELP,\n AUTO_SNAPPED_MSG,\n MergeConfigFilename,\n FILE_CHANGES_CHECKOUT_MSG,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy.constants';\nimport { ConfigMergeResult, WorkspaceConfigUpdateResult, WorkspaceDepsUpdates } from '@teambit/config-merger';\nimport { BitError } from '@teambit/bit-error';\nimport { FileStatus, MergeStrategy } from './merge-version';\nimport { ApplyVersionResults, MergingMain, ApplyVersionResult } from './merging.main.runtime';\nimport { ConfigStoreMain } from '@teambit/config-store';\n\nexport class MergeCmd implements Command {\n name = 'merge [component-pattern]';\n description = 'merge changes of the remote head into local - auto-snaps all merged components';\n helpUrl = 'reference/components/merging-changes';\n group = 'version-control';\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n extendedDescription = `merge changes of the remote head into local when they are diverged. when on a lane, merge the remote head of the lane into the local\nand creates snaps for merged components that have diverged, on the lane.\nif no ids are specified, all pending-merge components will be merged. (run \"bit status\" to list them).\noptionally use '--abort' to revert the last merge. to revert a lane merge, use \"bit lane merge-abort\" command.`;\n alias = '';\n options = [\n ['', 'ours', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, keep the local modification'],\n [\n '',\n 'theirs',\n 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, override the local modification with the specified version',\n ],\n [\n '',\n 'manual',\n 'same as \"--auto-merge-resolve manual\". in case of merge conflict, write the files with the conflict markers',\n ],\n [\n 'r',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of a conflict, resolve according to the strategy: [ours, theirs, manual]',\n ],\n ['', 'abort', 'in case of an unresolved merge, revert to pre-merge state'],\n ['', 'resolve', 'mark an unresolved merge as resolved and create a new snap with the changes'],\n ['', 'no-snap', 'do not auto snap even if the merge completed without conflicts'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['', 'verbose', 'show details of components that were not merged successfully'],\n ['x', 'skip-dependency-installation', 'do not install new dependencies resulting from the merge'],\n ['m', 'message <message>', 'override the default message for the auto snap'],\n ] as CommandOptions;\n loader = true;\n\n constructor(\n private merging: MergingMain,\n private configStore: ConfigStoreMain\n ) {}\n\n async report(\n [pattern]: [string],\n {\n ours = false,\n theirs = false,\n manual = false,\n autoMergeResolve,\n abort = false,\n resolve = false,\n build = false,\n noSnap = false,\n verbose = false,\n message,\n skipDependencyInstallation = false,\n }: {\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n autoMergeResolve?: MergeStrategy;\n abort?: boolean;\n resolve?: boolean;\n build?: boolean;\n noSnap?: boolean;\n verbose?: boolean;\n message: string;\n skipDependencyInstallation?: boolean;\n }\n ) {\n build = this.configStore.getConfigBoolean(CFG_FORCE_LOCAL_BUILD) || Boolean(build);\n if (ours || theirs) {\n throw new BitError('the \"--ours\" and \"--theirs\" flags are deprecated. use \"--auto-merge-resolve\" instead');\n }\n if (\n autoMergeResolve &&\n autoMergeResolve !== 'ours' &&\n autoMergeResolve !== 'theirs' &&\n autoMergeResolve !== 'manual'\n ) {\n throw new BitError('--auto-merge-resolve must be one of the following: [ours, theirs, manual]');\n }\n if (manual) autoMergeResolve = 'manual';\n if (abort && resolve) throw new BitError('unable to use \"abort\" and \"resolve\" flags together');\n if (noSnap && message) throw new BitError('unable to use \"noSnap\" and \"message\" flags together');\n const {\n components,\n failedComponents,\n version,\n resolvedComponents,\n abortedComponents,\n mergeSnapResults,\n mergeSnapError,\n }: ApplyVersionResults = await this.merging.merge(\n pattern,\n autoMergeResolve as any,\n abort,\n resolve,\n noSnap,\n message,\n build,\n skipDependencyInstallation\n );\n if (resolvedComponents) {\n const title = 'successfully resolved component(s)\\n';\n const componentsStr = resolvedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n if (abortedComponents) {\n const title = 'successfully aborted the merge of the following component(s)\\n';\n const componentsStr = abortedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n\n return mergeReport({\n components,\n failedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n verbose,\n });\n }\n}\n\nexport function mergeReport({\n components,\n failedComponents,\n removedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n leftUnresolvedConflicts,\n verbose,\n configMergeResults,\n workspaceConfigUpdateResult,\n}: ApplyVersionResults & { configMergeResults?: ConfigMergeResult[] }): string {\n const getSuccessOutput = () => {\n if (!components || !components.length) return '';\n const title = `successfully merged ${components.length} components${\n version ? `from version ${chalk.bold(version)}` : ''\n }\\n`;\n const fileChangesReport = applyVersionReport(components);\n\n return chalk.bold(title) + fileChangesReport;\n };\n\n let componentsWithConflicts = 0;\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = `files with conflicts summary\\n`;\n const suggestion = `\\n\\nmerge process not completed due to the conflicts above. fix conflicts manually and then run \"bit install\".\nonce ready, snap/tag the components to complete the merge.`;\n const conflictSummary = conflictSummaryReport(components);\n componentsWithConflicts = conflictSummary.conflictedComponents;\n return chalk.underline(title) + conflictSummary.conflictStr + chalk.yellow(suggestion);\n };\n\n const configMergeWithConflicts = configMergeResults?.filter((c) => c.hasConflicts()) || [];\n const getConfigMergeConflictSummary = () => {\n if (!configMergeWithConflicts.length) return '';\n const comps = configMergeWithConflicts.map((c) => c.compIdStr).join('\\n');\n const title = `components with config-merge conflicts\\n`;\n const suggestion = `\\nconflicts were found while trying to merge the config. fix them manually by editing the ${MergeConfigFilename} file in the workspace root.\nonce ready, snap/tag the components to complete the merge.`;\n return chalk.underline(title) + comps + chalk.yellow(suggestion);\n };\n\n const getSnapsOutput = () => {\n if (mergeSnapError) {\n return `${chalk.bold(\n 'snapping merged components failed with the following error, please fix the issues and snap manually'\n )}\n${mergeSnapError.message}\n`;\n }\n if (!mergeSnapResults || !mergeSnapResults.snappedComponents) return '';\n const { snappedComponents, autoSnappedResults } = mergeSnapResults;\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoSnappedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_SNAPPED_MSG}: ${autoTagComp.join(', ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n return `${chalk.underline(\n 'merge-snapped components'\n )}\\n(${'components snapped as a result of the merge'})\\n${outputComponents(snappedComponents)}`;\n };\n\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = '\\nmerge skipped for the following component(s)';\n const body = compact(\n failedComponents.map((failedComponent) => {\n // all failures here are \"unchangedLegitimately\". otherwise, it would have been thrown as an error\n if (!verbose) return null;\n return `${chalk.bold(failedComponent.id.toString())} - ${chalk.white(failedComponent.unchangedMessage)}`;\n })\n ).join('\\n');\n if (!body) {\n return `${chalk.bold(`\\nmerge skipped legitimately for ${failedComponents.length} component(s)`)}\n(use --verbose to list them next time)`;\n }\n return `${chalk.underline(title)}\\n${body}`;\n };\n\n const getSummary = () => {\n const merged = components?.length || 0;\n const unchangedLegitimately = failedComponents?.filter((f) => f.unchangedLegitimately).length || 0;\n const autoSnapped =\n (mergeSnapResults?.snappedComponents.length || 0) + (mergeSnapResults?.autoSnappedResults.length || 0);\n const getConflictStr = () => {\n const comps = componentsWithConflicts ? `${componentsWithConflicts} components` : '';\n const ws = workspaceConfigUpdateResult?.workspaceDepsConflicts ? 'workspace.jsonc file' : '';\n const mergeConfig = configMergeWithConflicts.length ? `${MergeConfigFilename} file` : '';\n return compact([comps, ws, mergeConfig]).join(', ');\n };\n\n const title = chalk.bold.underline('Merge Summary');\n const mergedStr = `\\nTotal Merged: ${chalk.bold(merged.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(unchangedLegitimately.toString())}`;\n const autoSnappedStr = `\\nTotal Snapped: ${chalk.bold(autoSnapped.toString())}`;\n const removedStr = `\\nTotal Removed: ${chalk.bold(removedComponents?.length.toString() || '0')}`;\n const conflictStr = `\\nConflicts: ${chalk.bold(getConflictStr() || 'none')}`;\n\n return title + mergedStr + unchangedLegitimatelyStr + autoSnappedStr + removedStr + conflictStr;\n };\n\n return compact([\n getSuccessOutput(),\n getFailureOutput(),\n getRemovedOutput(removedComponents),\n getSnapsOutput(),\n getConfigMergeConflictSummary(),\n getWorkspaceConfigUpdateOutput(workspaceConfigUpdateResult),\n getConflictSummary(),\n getSummary(),\n ]).join('\\n\\n');\n}\n\nexport function getWorkspaceConfigUpdateOutput(workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult): string {\n if (!workspaceConfigUpdateResult) return '';\n const { workspaceConfigConflictWriteError, workspaceDepsConflicts, workspaceDepsUpdates, workspaceDepsUnchanged } =\n workspaceConfigUpdateResult;\n\n const getWorkspaceConflictsOutput = () => {\n if (!workspaceDepsConflicts && !workspaceConfigConflictWriteError) return '';\n if (workspaceConfigConflictWriteError) {\n return `${chalk.red(workspaceConfigConflictWriteError.message)}`;\n }\n return chalk.yellow('workspace.jsonc has conflicts, please edit the file and fix them');\n };\n\n const getWorkspaceUnchangedDepsOutput = () => {\n if (!workspaceDepsUnchanged) return '';\n const title = '\\nworkspace.jsonc was unable to update the following dependencies';\n const body = Object.keys(workspaceDepsUnchanged)\n .map((pkgName) => {\n return ` ${pkgName}: ${workspaceDepsUnchanged[pkgName]}`;\n })\n .join('\\n');\n\n return `${chalk.underline(title)}\\n${body}`;\n };\n\n return compact([\n getWorkspaceUnchangedDepsOutput(),\n getWorkspaceDepsOutput(workspaceDepsUpdates),\n getWorkspaceConflictsOutput(),\n ]).join('\\n\\n');\n}\n\nfunction getWorkspaceDepsOutput(workspaceDepsUpdates?: WorkspaceDepsUpdates): string {\n if (!workspaceDepsUpdates) return '';\n\n const title = '\\nworkspace.jsonc has been updated with the following dependencies';\n const body = Object.keys(workspaceDepsUpdates)\n .map((pkgName) => {\n const [from, to] = workspaceDepsUpdates[pkgName];\n return ` ${pkgName}: ${from} => ${to}`;\n })\n .join('\\n');\n\n return `${chalk.underline(title)}\\n${body}`;\n}\n\n/**\n * shows only the file-changes section.\n * if all files are \"unchanged\", it returns an empty string\n */\nexport function applyVersionReport(components: ApplyVersionResult[], addName = true, showVersion = false): string {\n const tab = addName ? '\\t' : '';\n const fileChanges = compact(\n components.map((component: ApplyVersionResult) => {\n const name = showVersion ? component.id.toString() : component.id.toStringWithoutVersion();\n const files = compact(\n Object.keys(component.filesStatus).map((file) => {\n if (component.filesStatus[file] === FileStatus.unchanged) return null;\n const note =\n component.filesStatus[file] === FileStatus.manual\n ? chalk.white('automatic merge failed. please fix conflicts manually and then run \"bit install\"')\n : '';\n return `${tab}${String(component.filesStatus[file])} ${chalk.bold(file)} ${note}`;\n })\n ).join('\\n');\n if (!files) return null;\n return `${addName ? name : ''}\\n${chalk.cyan(files)}`;\n })\n ).join('\\n\\n');\n if (!fileChanges) {\n return '';\n }\n const title = `\\n${FILE_CHANGES_CHECKOUT_MSG}\\n`;\n return chalk.underline(title) + fileChanges;\n}\n\nexport function conflictSummaryReport(components: ApplyVersionResult[]): {\n conflictedComponents: number;\n conflictedFiles: number;\n conflictStr: string;\n} {\n const tab = '\\t';\n let conflictedComponents = 0;\n let conflictedFiles = 0;\n const conflictStr = compact(\n components.map((component: ApplyVersionResult) => {\n const name = component.id.toStringWithoutVersion();\n const files = compact(\n Object.keys(component.filesStatus).map((file) => {\n if (component.filesStatus[file] === FileStatus.manual) {\n conflictedFiles += 1;\n return `${tab}${String(component.filesStatus[file])} ${chalk.bold(file)}`;\n }\n return null;\n })\n );\n if (!files.length) return null;\n conflictedComponents += 1;\n return `${name}\\n${chalk.cyan(files.join('\\n'))}`;\n })\n ).join('\\n');\n\n return { conflictedComponents, conflictedFiles, conflictStr };\n}\n\nexport function installationErrorOutput(installationError?: Error) {\n if (!installationError) return '';\n const title = chalk.underline('Installation Error');\n const subTitle = 'The following error was thrown by the package manager:';\n const body = chalk.red(installationError.message);\n const suggestion =\n 'Use \"bit install\" to complete the installation, remove the imported components using \"bit remove <comp id>\" or remove the missing dependencies from their source code';\n return `${title}\\n${subTitle}\\n${body}\\n${suggestion}`;\n}\n\nexport function compilationErrorOutput(compilationError?: Error) {\n if (!compilationError) return '';\n const title = chalk.underline('Compilation Error');\n const subTitle = 'The following error was thrown by the compiler';\n const body = chalk.red(compilationError.message);\n const suggestion = 'Please fix the issue and run \"bit compile\"';\n return `${title}\\n${subTitle}\\n${body}\\n${suggestion}`;\n}\n\nexport function getRemovedOutput(removedComponents?: ComponentID[]) {\n if (!removedComponents?.length) return '';\n const title = `the following ${removedComponents.length} component(s) have been removed`;\n const body = removedComponents.join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n}\n\nexport function getAddedOutput(addedComponents?: ComponentID[]) {\n if (!addedComponents?.length) return '';\n const title = `the following ${addedComponents.length} component(s) have been added`;\n const body = addedComponents.join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,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;AAQA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,O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,KAAK,CAAC,KAAKmD,IAAI,EAAE;AAC7C","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","_legacy","_bitError","_mergeVersion","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MergeCmd","constructor","merging","configStore","name","description","COMPONENT_PATTERN_HELP","report","pattern","ours","theirs","manual","autoMergeResolve","abort","resolve","build","noSnap","verbose","message","skipDependencyInstallation","getConfigBoolean","CFG_FORCE_LOCAL_BUILD","Boolean","BitError","components","failedComponents","version","resolvedComponents","abortedComponents","mergeSnapResults","mergeSnapError","merge","title","componentsStr","map","c","id","toStringWithoutVersion","join","chalk","underline","green","mergeReport","exports","removedComponents","leftUnresolvedConflicts","configMergeResults","workspaceConfigUpdateResult","getSuccessOutput","length","bold","fileChangesReport","applyVersionReport","componentsWithConflicts","getConflictSummary","suggestion","conflictSummary","conflictSummaryReport","conflictedComponents","conflictStr","yellow","configMergeWithConflicts","filter","hasConflicts","getConfigMergeConflictSummary","comps","compIdStr","MergeConfigFilename","getSnapsOutput","snappedComponents","autoSnappedResults","outputComponents","component","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutVersion","autoTagComp","a","AUTO_SNAPPED_MSG","getFailureOutput","body","compact","failedComponent","white","unchangedMessage","getSummary","merged","unchangedLegitimately","f","autoSnapped","getConflictStr","ws","workspaceDepsConflicts","mergeConfig","mergedStr","unchangedLegitimatelyStr","autoSnappedStr","removedStr","getRemovedOutput","getWorkspaceConfigUpdateOutput","workspaceConfigConflictWriteError","workspaceDepsUpdates","workspaceDepsUnchanged","getWorkspaceConflictsOutput","red","getWorkspaceUnchangedDepsOutput","keys","pkgName","getWorkspaceDepsOutput","from","to","addName","showVersion","tab","fileChanges","files","filesStatus","file","FileStatus","unchanged","note","cyan","FILE_CHANGES_CHECKOUT_MSG","conflictedFiles","installationErrorOutput","installationError","subTitle","compilationErrorOutput","compilationError","getAddedOutput","addedComponents"],"sources":["merge-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport type { ComponentID } from '@teambit/component-id';\nimport { compact } from 'lodash';\nimport {\n COMPONENT_PATTERN_HELP,\n AUTO_SNAPPED_MSG,\n MergeConfigFilename,\n FILE_CHANGES_CHECKOUT_MSG,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy.constants';\nimport type { ConfigMergeResult, WorkspaceConfigUpdateResult, WorkspaceDepsUpdates } from '@teambit/config-merger';\nimport { BitError } from '@teambit/bit-error';\nimport type { MergeStrategy } from './merge-version';\nimport { FileStatus } from './merge-version';\nimport type { ApplyVersionResults, MergingMain, ApplyVersionResult } from './merging.main.runtime';\nimport type { ConfigStoreMain } from '@teambit/config-store';\n\nexport class MergeCmd implements Command {\n name = 'merge [component-pattern]';\n description = 'merge changes of the remote head into local - auto-snaps all merged components';\n helpUrl = 'reference/components/merging-changes';\n group = 'version-control';\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n extendedDescription = `merge changes of the remote head into local when they are diverged. when on a lane, merge the remote head of the lane into the local\nand creates snaps for merged components that have diverged, on the lane.\nif no ids are specified, all pending-merge components will be merged. (run \"bit status\" to list them).\noptionally use '--abort' to revert the last merge. to revert a lane merge, use \"bit lane merge-abort\" command.`;\n alias = '';\n options = [\n ['', 'ours', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, keep the local modification'],\n [\n '',\n 'theirs',\n 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, override the local modification with the specified version',\n ],\n [\n '',\n 'manual',\n 'same as \"--auto-merge-resolve manual\". in case of merge conflict, write the files with the conflict markers',\n ],\n [\n 'r',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of a conflict, resolve according to the strategy: [ours, theirs, manual]',\n ],\n ['', 'abort', 'in case of an unresolved merge, revert to pre-merge state'],\n ['', 'resolve', 'mark an unresolved merge as resolved and create a new snap with the changes'],\n ['', 'no-snap', 'do not auto snap even if the merge completed without conflicts'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['', 'verbose', 'show details of components that were not merged successfully'],\n ['x', 'skip-dependency-installation', 'do not install new dependencies resulting from the merge'],\n ['m', 'message <message>', 'override the default message for the auto snap'],\n ] as CommandOptions;\n loader = true;\n\n constructor(\n private merging: MergingMain,\n private configStore: ConfigStoreMain\n ) {}\n\n async report(\n [pattern]: [string],\n {\n ours = false,\n theirs = false,\n manual = false,\n autoMergeResolve,\n abort = false,\n resolve = false,\n build = false,\n noSnap = false,\n verbose = false,\n message,\n skipDependencyInstallation = false,\n }: {\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n autoMergeResolve?: MergeStrategy;\n abort?: boolean;\n resolve?: boolean;\n build?: boolean;\n noSnap?: boolean;\n verbose?: boolean;\n message: string;\n skipDependencyInstallation?: boolean;\n }\n ) {\n build = this.configStore.getConfigBoolean(CFG_FORCE_LOCAL_BUILD) || Boolean(build);\n if (ours || theirs) {\n throw new BitError('the \"--ours\" and \"--theirs\" flags are deprecated. use \"--auto-merge-resolve\" instead');\n }\n if (\n autoMergeResolve &&\n autoMergeResolve !== 'ours' &&\n autoMergeResolve !== 'theirs' &&\n autoMergeResolve !== 'manual'\n ) {\n throw new BitError('--auto-merge-resolve must be one of the following: [ours, theirs, manual]');\n }\n if (manual) autoMergeResolve = 'manual';\n if (abort && resolve) throw new BitError('unable to use \"abort\" and \"resolve\" flags together');\n if (noSnap && message) throw new BitError('unable to use \"noSnap\" and \"message\" flags together');\n const {\n components,\n failedComponents,\n version,\n resolvedComponents,\n abortedComponents,\n mergeSnapResults,\n mergeSnapError,\n }: ApplyVersionResults = await this.merging.merge(\n pattern,\n autoMergeResolve as any,\n abort,\n resolve,\n noSnap,\n message,\n build,\n skipDependencyInstallation\n );\n if (resolvedComponents) {\n const title = 'successfully resolved component(s)\\n';\n const componentsStr = resolvedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n if (abortedComponents) {\n const title = 'successfully aborted the merge of the following component(s)\\n';\n const componentsStr = abortedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n\n return mergeReport({\n components,\n failedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n verbose,\n });\n }\n}\n\nexport function mergeReport({\n components,\n failedComponents,\n removedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n leftUnresolvedConflicts,\n verbose,\n configMergeResults,\n workspaceConfigUpdateResult,\n}: ApplyVersionResults & { configMergeResults?: ConfigMergeResult[] }): string {\n const getSuccessOutput = () => {\n if (!components || !components.length) return '';\n const title = `successfully merged ${components.length} components${\n version ? `from version ${chalk.bold(version)}` : ''\n }\\n`;\n const fileChangesReport = applyVersionReport(components);\n\n return chalk.bold(title) + fileChangesReport;\n };\n\n let componentsWithConflicts = 0;\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = `files with conflicts summary\\n`;\n const suggestion = `\\n\\nmerge process not completed due to the conflicts above. fix conflicts manually and then run \"bit install\".\nonce ready, snap/tag the components to complete the merge.`;\n const conflictSummary = conflictSummaryReport(components);\n componentsWithConflicts = conflictSummary.conflictedComponents;\n return chalk.underline(title) + conflictSummary.conflictStr + chalk.yellow(suggestion);\n };\n\n const configMergeWithConflicts = configMergeResults?.filter((c) => c.hasConflicts()) || [];\n const getConfigMergeConflictSummary = () => {\n if (!configMergeWithConflicts.length) return '';\n const comps = configMergeWithConflicts.map((c) => c.compIdStr).join('\\n');\n const title = `components with config-merge conflicts\\n`;\n const suggestion = `\\nconflicts were found while trying to merge the config. fix them manually by editing the ${MergeConfigFilename} file in the workspace root.\nonce ready, snap/tag the components to complete the merge.`;\n return chalk.underline(title) + comps + chalk.yellow(suggestion);\n };\n\n const getSnapsOutput = () => {\n if (mergeSnapError) {\n return `${chalk.bold(\n 'snapping merged components failed with the following error, please fix the issues and snap manually'\n )}\n${mergeSnapError.message}\n`;\n }\n if (!mergeSnapResults || !mergeSnapResults.snappedComponents) return '';\n const { snappedComponents, autoSnappedResults } = mergeSnapResults;\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoSnappedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_SNAPPED_MSG}: ${autoTagComp.join(', ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n return `${chalk.underline(\n 'merge-snapped components'\n )}\\n(${'components snapped as a result of the merge'})\\n${outputComponents(snappedComponents)}`;\n };\n\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = '\\nmerge skipped for the following component(s)';\n const body = compact(\n failedComponents.map((failedComponent) => {\n // all failures here are \"unchangedLegitimately\". otherwise, it would have been thrown as an error\n if (!verbose) return null;\n return `${chalk.bold(failedComponent.id.toString())} - ${chalk.white(failedComponent.unchangedMessage)}`;\n })\n ).join('\\n');\n if (!body) {\n return `${chalk.bold(`\\nmerge skipped legitimately for ${failedComponents.length} component(s)`)}\n(use --verbose to list them next time)`;\n }\n return `${chalk.underline(title)}\\n${body}`;\n };\n\n const getSummary = () => {\n const merged = components?.length || 0;\n const unchangedLegitimately = failedComponents?.filter((f) => f.unchangedLegitimately).length || 0;\n const autoSnapped =\n (mergeSnapResults?.snappedComponents.length || 0) + (mergeSnapResults?.autoSnappedResults.length || 0);\n const getConflictStr = () => {\n const comps = componentsWithConflicts ? `${componentsWithConflicts} components` : '';\n const ws = workspaceConfigUpdateResult?.workspaceDepsConflicts ? 'workspace.jsonc file' : '';\n const mergeConfig = configMergeWithConflicts.length ? `${MergeConfigFilename} file` : '';\n return compact([comps, ws, mergeConfig]).join(', ');\n };\n\n const title = chalk.bold.underline('Merge Summary');\n const mergedStr = `\\nTotal Merged: ${chalk.bold(merged.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(unchangedLegitimately.toString())}`;\n const autoSnappedStr = `\\nTotal Snapped: ${chalk.bold(autoSnapped.toString())}`;\n const removedStr = `\\nTotal Removed: ${chalk.bold(removedComponents?.length.toString() || '0')}`;\n const conflictStr = `\\nConflicts: ${chalk.bold(getConflictStr() || 'none')}`;\n\n return title + mergedStr + unchangedLegitimatelyStr + autoSnappedStr + removedStr + conflictStr;\n };\n\n return compact([\n getSuccessOutput(),\n getFailureOutput(),\n getRemovedOutput(removedComponents),\n getSnapsOutput(),\n getConfigMergeConflictSummary(),\n getWorkspaceConfigUpdateOutput(workspaceConfigUpdateResult),\n getConflictSummary(),\n getSummary(),\n ]).join('\\n\\n');\n}\n\nexport function getWorkspaceConfigUpdateOutput(workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult): string {\n if (!workspaceConfigUpdateResult) return '';\n const { workspaceConfigConflictWriteError, workspaceDepsConflicts, workspaceDepsUpdates, workspaceDepsUnchanged } =\n workspaceConfigUpdateResult;\n\n const getWorkspaceConflictsOutput = () => {\n if (!workspaceDepsConflicts && !workspaceConfigConflictWriteError) return '';\n if (workspaceConfigConflictWriteError) {\n return `${chalk.red(workspaceConfigConflictWriteError.message)}`;\n }\n return chalk.yellow('workspace.jsonc has conflicts, please edit the file and fix them');\n };\n\n const getWorkspaceUnchangedDepsOutput = () => {\n if (!workspaceDepsUnchanged) return '';\n const title = '\\nworkspace.jsonc was unable to update the following dependencies';\n const body = Object.keys(workspaceDepsUnchanged)\n .map((pkgName) => {\n return ` ${pkgName}: ${workspaceDepsUnchanged[pkgName]}`;\n })\n .join('\\n');\n\n return `${chalk.underline(title)}\\n${body}`;\n };\n\n return compact([\n getWorkspaceUnchangedDepsOutput(),\n getWorkspaceDepsOutput(workspaceDepsUpdates),\n getWorkspaceConflictsOutput(),\n ]).join('\\n\\n');\n}\n\nfunction getWorkspaceDepsOutput(workspaceDepsUpdates?: WorkspaceDepsUpdates): string {\n if (!workspaceDepsUpdates) return '';\n\n const title = '\\nworkspace.jsonc has been updated with the following dependencies';\n const body = Object.keys(workspaceDepsUpdates)\n .map((pkgName) => {\n const [from, to] = workspaceDepsUpdates[pkgName];\n return ` ${pkgName}: ${from} => ${to}`;\n })\n .join('\\n');\n\n return `${chalk.underline(title)}\\n${body}`;\n}\n\n/**\n * shows only the file-changes section.\n * if all files are \"unchanged\", it returns an empty string\n */\nexport function applyVersionReport(components: ApplyVersionResult[], addName = true, showVersion = false): string {\n const tab = addName ? '\\t' : '';\n const fileChanges = compact(\n components.map((component: ApplyVersionResult) => {\n const name = showVersion ? component.id.toString() : component.id.toStringWithoutVersion();\n const files = compact(\n Object.keys(component.filesStatus).map((file) => {\n if (component.filesStatus[file] === FileStatus.unchanged) return null;\n const note =\n component.filesStatus[file] === FileStatus.manual\n ? chalk.white('automatic merge failed. please fix conflicts manually and then run \"bit install\"')\n : '';\n return `${tab}${String(component.filesStatus[file])} ${chalk.bold(file)} ${note}`;\n })\n ).join('\\n');\n if (!files) return null;\n return `${addName ? name : ''}\\n${chalk.cyan(files)}`;\n })\n ).join('\\n\\n');\n if (!fileChanges) {\n return '';\n }\n const title = `\\n${FILE_CHANGES_CHECKOUT_MSG}\\n`;\n return chalk.underline(title) + fileChanges;\n}\n\nexport function conflictSummaryReport(components: ApplyVersionResult[]): {\n conflictedComponents: number;\n conflictedFiles: number;\n conflictStr: string;\n} {\n const tab = '\\t';\n let conflictedComponents = 0;\n let conflictedFiles = 0;\n const conflictStr = compact(\n components.map((component: ApplyVersionResult) => {\n const name = component.id.toStringWithoutVersion();\n const files = compact(\n Object.keys(component.filesStatus).map((file) => {\n if (component.filesStatus[file] === FileStatus.manual) {\n conflictedFiles += 1;\n return `${tab}${String(component.filesStatus[file])} ${chalk.bold(file)}`;\n }\n return null;\n })\n );\n if (!files.length) return null;\n conflictedComponents += 1;\n return `${name}\\n${chalk.cyan(files.join('\\n'))}`;\n })\n ).join('\\n');\n\n return { conflictedComponents, conflictedFiles, conflictStr };\n}\n\nexport function installationErrorOutput(installationError?: Error) {\n if (!installationError) return '';\n const title = chalk.underline('Installation Error');\n const subTitle = 'The following error was thrown by the package manager:';\n const body = chalk.red(installationError.message);\n const suggestion =\n 'Use \"bit install\" to complete the installation, remove the imported components using \"bit remove <comp id>\" or remove the missing dependencies from their source code';\n return `${title}\\n${subTitle}\\n${body}\\n${suggestion}`;\n}\n\nexport function compilationErrorOutput(compilationError?: Error) {\n if (!compilationError) return '';\n const title = chalk.underline('Compilation Error');\n const subTitle = 'The following error was thrown by the compiler';\n const body = chalk.red(compilationError.message);\n const suggestion = 'Please fix the issue and run \"bit compile\"';\n return `${title}\\n${subTitle}\\n${body}\\n${suggestion}`;\n}\n\nexport function getRemovedOutput(removedComponents?: ComponentID[]) {\n if (!removedComponents?.length) return '';\n const title = `the following ${removedComponents.length} component(s) have been removed`;\n const body = removedComponents.join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n}\n\nexport function getAddedOutput(addedComponents?: ComponentID[]) {\n if (!addedComponents?.length) return '';\n const title = `the following ${addedComponents.length} component(s) have been added`;\n const body = addedComponents.join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,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;AAQ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F,MAAMkC,IAAI,GAAGkD,eAAe,CAAC/F,IAAI,CAAC,IAAI,CAAC;EACvC,OAAO,GAAGC,gBAAK,CAACC,SAAS,CAACR,KAAK,CAAC,KAAKmD,IAAI,EAAE;AAC7C","ignoreList":[]}
|
package/dist/merge-files.d.ts
CHANGED
package/dist/merge-files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_execa","_legacy","_gitModules","e","__esModule","default","mergeFiles","filePath","currentFile","baseFile","otherFile","mergeResult","output","conflict","gitExecutablePath","getGitExecutablePath","result","execa","label","path","stripFinalNewline","stdout","err","exitCode","Number","isInteger","stderr","includes","isBinaryConflict","exitCodeName","logger","error","command","GitNotFound","Error","chalk","bold","message"],"sources":["merge-files.ts"],"sourcesContent":["import chalk from 'chalk';\nimport execa from 'execa';\nimport { logger } from '@teambit/legacy.logger';\nimport { GitNotFound, getGitExecutablePath } from '@teambit/git.modules.git-executable';\nimport { PathLinux, PathOsBased } from '@teambit/legacy.utils';\n\nexport type MergeFileResult = {\n filePath: PathLinux;\n output: string | null | undefined;\n conflict: string | null | undefined;\n isBinaryConflict?: boolean;\n};\nexport type MergeFileParams = {\n filePath: PathLinux;\n currentFile: {\n label: string;\n path: PathOsBased;\n };\n baseFile: {\n path: PathOsBased;\n };\n otherFile: {\n label: string;\n path: PathOsBased;\n };\n};\n\n/**\n * use git `merge-file` command. 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 * Here, we are not going to write the result into current-file. Instead, we'll use the \"-p\" flag,\n * to just return the results.\n */\nexport async function mergeFiles({\n filePath,\n currentFile,\n baseFile,\n otherFile,\n}: MergeFileParams): Promise<MergeFileResult> {\n const mergeResult: MergeFileResult = { filePath, output: null, conflict: null };\n const gitExecutablePath = getGitExecutablePath();\n try {\n const result = await execa(\n 'git',\n [\n 'merge-file',\n '-L',\n currentFile.label,\n '-L',\n 'Base File',\n '-L',\n otherFile.label,\n currentFile.path,\n baseFile.path,\n otherFile.path,\n '-p',\n ],\n { stripFinalNewline: false }\n );\n mergeResult.output = result.stdout;\n return mergeResult;\n } catch (err: any) {\n if (err.exitCode && Number.isInteger(err.exitCode) && err.stdout) {\n // merge has been succeeded, return the diff results.\n mergeResult.conflict = err.stdout;\n return mergeResult;\n }\n if (err.exitCode && err.exitCode === 255 && err.stderr && err.stderr.includes('Cannot merge binary files')) {\n mergeResult.isBinaryConflict = true;\n return mergeResult;\n }\n if (err.exitCodeName === 'ENOENT') {\n logger.error(`failed running Git at ${gitExecutablePath}. full command: ${err.command}`);\n throw new GitNotFound(gitExecutablePath, err);\n }\n throw new Error(`failed merging \"${filePath}\" by Git.\n\n${chalk.bold('command:')} ${err.command}\n${chalk.bold('message:')} ${err.message}\n${chalk.bold('original error:')} ${err.stderr}`);\n throw err;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwF,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KA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AM,CAACC,KAAK,CAAC,yBAAyBjB,iBAAiB,mBAAmBQ,GAAG,CAACU,OAAO,EAAE,CAAC;MACxF,MAAM,KAAIC,yBAAW,EAACnB,iBAAiB,EAAEQ,GAAG,CAAC;IAC/C;IACA,MAAM,IAAIY,KAAK,CAAC,mBAAmB3B,QAAQ;AAC/C;AACA,EAAE4B,gBAAK,CAACC,IAAI,CAAC,UAAU,CAAC,IAAId,GAAG,CAACU,OAAO;AACvC,EAAEG,gBAAK,CAACC,IAAI,CAAC,UAAU,CAAC,IAAId,GAAG,CAACe,OAAO;AACvC,EAAEF,gBAAK,CAACC,IAAI,CAAC,iBAAiB,CAAC,IAAId,GAAG,CAACI,MAAM,EAAE,CAAC;IAC5C,MAAMJ,GAAG;EACX;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_execa","_legacy","_gitModules","e","__esModule","default","mergeFiles","filePath","currentFile","baseFile","otherFile","mergeResult","output","conflict","gitExecutablePath","getGitExecutablePath","result","execa","label","path","stripFinalNewline","stdout","err","exitCode","Number","isInteger","stderr","includes","isBinaryConflict","exitCodeName","logger","error","command","GitNotFound","Error","chalk","bold","message"],"sources":["merge-files.ts"],"sourcesContent":["import chalk from 'chalk';\nimport execa from 'execa';\nimport { logger } from '@teambit/legacy.logger';\nimport { GitNotFound, getGitExecutablePath } from '@teambit/git.modules.git-executable';\nimport type { PathLinux, PathOsBased } from '@teambit/legacy.utils';\n\nexport type MergeFileResult = {\n filePath: PathLinux;\n output: string | null | undefined;\n conflict: string | null | undefined;\n isBinaryConflict?: boolean;\n};\nexport type MergeFileParams = {\n filePath: PathLinux;\n currentFile: {\n label: string;\n path: PathOsBased;\n };\n baseFile: {\n path: PathOsBased;\n };\n otherFile: {\n label: string;\n path: PathOsBased;\n };\n};\n\n/**\n * use git `merge-file` command. 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 * Here, we are not going to write the result into current-file. Instead, we'll use the \"-p\" flag,\n * to just return the results.\n */\nexport async function mergeFiles({\n filePath,\n currentFile,\n baseFile,\n otherFile,\n}: MergeFileParams): Promise<MergeFileResult> {\n const mergeResult: MergeFileResult = { filePath, output: null, conflict: null };\n const gitExecutablePath = getGitExecutablePath();\n try {\n const result = await execa(\n 'git',\n [\n 'merge-file',\n '-L',\n currentFile.label,\n '-L',\n 'Base File',\n '-L',\n otherFile.label,\n currentFile.path,\n baseFile.path,\n otherFile.path,\n '-p',\n ],\n { stripFinalNewline: false }\n );\n mergeResult.output = result.stdout;\n return mergeResult;\n } catch (err: any) {\n if (err.exitCode && Number.isInteger(err.exitCode) && err.stdout) {\n // merge has been succeeded, return the diff results.\n mergeResult.conflict = err.stdout;\n return mergeResult;\n }\n if (err.exitCode && err.exitCode === 255 && err.stderr && err.stderr.includes('Cannot merge binary files')) {\n mergeResult.isBinaryConflict = true;\n return mergeResult;\n }\n if (err.exitCodeName === 'ENOENT') {\n logger.error(`failed running Git at ${gitExecutablePath}. full command: ${err.command}`);\n throw new GitNotFound(gitExecutablePath, err);\n }\n throw new Error(`failed merging \"${filePath}\" by Git.\n\n${chalk.bold('command:')} ${err.command}\n${chalk.bold('message:')} ${err.message}\n${chalk.bold('original error:')} ${err.stderr}`);\n throw err;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA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,IAAID,GAAG,CAACC,QAAQ,KAAK,GAAG,IAAID,GAAG,CAACI,MAAM,IAAIJ,GAAG,CAACI,MAAM,CAACC,QAAQ,CAAC,2BAA2B,CAAC,EAAE;MAC1GhB,WAAW,CAACiB,gBAAgB,GAAG,IAAI;MACnC,OAAOjB,WAAW;IACpB;IACA,IAAIW,GAAG,CAACO,YAAY,KAAK,QAAQ,EAAE;MACjCC,gBAAM,CAACC,KAAK,CAAC,yBAAyBjB,iBAAiB,mBAAmBQ,GAAG,CAACU,OAAO,EAAE,CAAC;MACxF,MAAM,KAAIC,yBAAW,EAACnB,iBAAiB,EAAEQ,GAAG,CAAC;IAC/C;IACA,MAAM,IAAIY,KAAK,CAAC,mBAAmB3B,QAAQ;AAC/C;AACA,EAAE4B,gBAAK,CAACC,IAAI,CAAC,UAAU,CAAC,IAAId,GAAG,CAACU,OAAO;AACvC,EAAEG,gBAAK,CAACC,IAAI,CAAC,UAAU,CAAC,IAAId,GAAG,CAACe,OAAO;AACvC,EAAEF,gBAAK,CAACC,IAAI,CAAC,iBAAiB,CAAC,IAAId,GAAG,CAACI,MAAM,EAAE,CAAC;IAC5C,MAAMJ,GAAG;EACX;AACF","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Workspace } from '@teambit/workspace';
|
|
2
|
-
import { ComponentID } from '@teambit/component-id';
|
|
3
|
-
import { Lane } from '@teambit/objects';
|
|
4
|
-
import { ImporterMain } from '@teambit/importer';
|
|
5
|
-
import { Logger } from '@teambit/logger';
|
|
6
|
-
import { ScopeMain } from '@teambit/scope';
|
|
7
|
-
import { MergeStrategy } from './merge-version';
|
|
8
|
-
import { ComponentMergeStatus } from './merging.main.runtime';
|
|
1
|
+
import type { Workspace } from '@teambit/workspace';
|
|
2
|
+
import type { ComponentID } from '@teambit/component-id';
|
|
3
|
+
import type { Lane } from '@teambit/objects';
|
|
4
|
+
import type { ImporterMain } from '@teambit/importer';
|
|
5
|
+
import type { Logger } from '@teambit/logger';
|
|
6
|
+
import type { ScopeMain } from '@teambit/scope';
|
|
7
|
+
import type { MergeStrategy } from './merge-version';
|
|
8
|
+
import type { ComponentMergeStatus } from './merging.main.runtime';
|
|
9
9
|
export type MergeStatusProviderOptions = {
|
|
10
10
|
resolveUnrelated?: MergeStrategy;
|
|
11
11
|
mergeStrategy: MergeStrategy;
|
|
@@ -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 { 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, isEqual } 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';\nimport { 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;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;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,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,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
|
+
{"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;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,cAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,aAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAS,cAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,aAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAU,oBAAA;EAAA,MAAAV,IAAA,GAAAE,OA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eAAe,GAAGD,iBAAiB;MACjF,IAAIpB,gBAAgB,KAAK,MAAM,EAAE;QAC/B,OAAOU,qBAAqB,CAACkB,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACxK,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;MACzG;MACA,IAAIqF,gBAAgB,KAAK,QAAQ,EAAE;QACjC,OAAOiB,uBAAuB,CAACW,eAAe,EAAET,gBAAgB,EAAE,IAAI,CAACxK,WAAW,EAAEgE,QAAQ,CAAC,CAAW,CAAC;MAC3G;MACA,MAAM,IAAId,KAAK,CACb,yBAAyBmG,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,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,8 +1,8 @@
|
|
|
1
|
-
import { Version, SourceFileModel } from '@teambit/objects';
|
|
2
|
-
import { PathLinux } from '@teambit/toolbox.path.path';
|
|
3
|
-
import { ConsumerComponent as Component } from '@teambit/legacy.consumer-component';
|
|
1
|
+
import type { Version, SourceFileModel } from '@teambit/objects';
|
|
2
|
+
import type { PathLinux } from '@teambit/toolbox.path.path';
|
|
3
|
+
import type { ConsumerComponent as Component } from '@teambit/legacy.consumer-component';
|
|
4
4
|
import { SourceFile } from '@teambit/component.sources';
|
|
5
|
-
import { Scope } from '@teambit/legacy.scope';
|
|
5
|
+
import type { Scope } from '@teambit/legacy.scope';
|
|
6
6
|
export type MergeResultsThreeWay = {
|
|
7
7
|
addFiles: Array<{
|
|
8
8
|
filePath: PathLinux;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bitError","data","require","_toolboxCrypto","_toolboxPath","eol","_interopRequireWildcard","_mergeFiles","_component","_legacy","_lodash","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","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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C,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":[]}
|
|
1
|
+
{"version":3,"names":["_bitError","data","require","_toolboxCrypto","_toolboxPath","eol","_interopRequireWildcard","_mergeFiles","_component","_legacy","_lodash","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","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 type { Source, Version, SourceFileModel } from '@teambit/objects';\nimport { sha1 } from '@teambit/toolbox.crypto.sha1';\nimport type { PathLinux, PathOsBased } from '@teambit/toolbox.path.path';\nimport { pathNormalizeToLinux } from '@teambit/toolbox.path.path';\nimport * as eol from '@teambit/toolbox.string.eol';\nimport type { MergeFileParams, MergeFileResult } from '../merge-files';\nimport { mergeFiles } from '../merge-files';\nimport type { ConsumerComponent as Component } from '@teambit/legacy.consumer-component';\nimport { SourceFile } from '@teambit/component.sources';\nimport type { Scope } from '@teambit/legacy.scope';\nimport { Tmp } 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;AAEA,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;AAEA,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;AAEA,SAAAQ,QAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,OAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA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,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":[]}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { CLIMain } from '@teambit/cli';
|
|
2
|
-
import { Workspace, AutoTagResult } from '@teambit/workspace';
|
|
3
|
-
import { Consumer } from '@teambit/legacy.consumer';
|
|
1
|
+
import type { CLIMain } from '@teambit/cli';
|
|
2
|
+
import type { Workspace, AutoTagResult } from '@teambit/workspace';
|
|
3
|
+
import type { Consumer } from '@teambit/legacy.consumer';
|
|
4
4
|
import { ComponentsList } from '@teambit/legacy.component-list';
|
|
5
|
-
import { SnappingMain } from '@teambit/snapping';
|
|
5
|
+
import type { 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/objects';
|
|
9
|
-
import { ConfigMain } from '@teambit/config';
|
|
10
|
-
import { RemoveMain } from '@teambit/remove';
|
|
11
|
-
import { ComponentWriterMain } from '@teambit/component-writer';
|
|
12
|
-
import { ConsumerComponent } from '@teambit/legacy.consumer-component';
|
|
13
|
-
import { ImporterMain } from '@teambit/importer';
|
|
14
|
-
import { Logger, LoggerMain } from '@teambit/logger';
|
|
15
|
-
import { ApplyVersionWithComps, CheckoutMain, ComponentStatusBase } from '@teambit/checkout';
|
|
16
|
-
import { ConfigMergerMain, ConfigMergeResult, WorkspaceConfigUpdateResult } from '@teambit/config-merger';
|
|
17
|
-
import { SnapsDistance } from '@teambit/component.snap-distance';
|
|
18
|
-
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
19
|
-
import { InstallMain } from '@teambit/install';
|
|
20
|
-
import { ScopeMain } from '@teambit/scope';
|
|
21
|
-
import { DataMergeResult, MergeStatusProviderOptions } from './merge-status-provider';
|
|
22
|
-
import { MergeStrategy,
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
8
|
+
import type { Ref, Lane, ModelComponent } from '@teambit/objects';
|
|
9
|
+
import type { ConfigMain } from '@teambit/config';
|
|
10
|
+
import type { RemoveMain } from '@teambit/remove';
|
|
11
|
+
import type { ComponentWriterMain } from '@teambit/component-writer';
|
|
12
|
+
import type { ConsumerComponent } from '@teambit/legacy.consumer-component';
|
|
13
|
+
import type { ImporterMain } from '@teambit/importer';
|
|
14
|
+
import type { Logger, LoggerMain } from '@teambit/logger';
|
|
15
|
+
import type { ApplyVersionWithComps, CheckoutMain, ComponentStatusBase } from '@teambit/checkout';
|
|
16
|
+
import type { ConfigMergerMain, ConfigMergeResult, WorkspaceConfigUpdateResult } from '@teambit/config-merger';
|
|
17
|
+
import type { SnapsDistance } from '@teambit/component.snap-distance';
|
|
18
|
+
import type { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
19
|
+
import type { InstallMain } from '@teambit/install';
|
|
20
|
+
import type { ScopeMain } from '@teambit/scope';
|
|
21
|
+
import type { DataMergeResult, MergeStatusProviderOptions } from './merge-status-provider';
|
|
22
|
+
import type { MergeStrategy, MergeResultsThreeWay } from './merge-version';
|
|
23
|
+
import { FileStatus } from './merge-version';
|
|
24
|
+
import type { ConfigStoreMain } from '@teambit/config-store';
|
|
25
|
+
import type { ApplicationMain } from '@teambit/application';
|
|
25
26
|
type ResolveUnrelatedData = {
|
|
26
27
|
strategy: MergeStrategy;
|
|
27
28
|
headOnCurrentLane: Ref;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_workspace","_legacy","_snapping","_pMapSeries","_interopRequireDefault","_componentId","_bitError","_laneId","_chalk","_config","_remove","_toolboxPath","_pkgModules","_componentWriter","_importer","_logger","_lodash","_checkout","_configMerger","_dependencyResolver","_install","_scope","_mergeCmd","_merging","_mergeStatusProvider","_mergeVersion","_configStore","_application","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","MergingMain","constructor","workspace","scope","install","snapping","checkout","logger","componentWriter","importer","config","remove","configMerger","depResolver","application","merge","pattern","mergeStrategy","abort","resolve","noAutoSnap","message","build","skipDependencyInstallation","OutsideWorkspaceError","consumer","mergeResults","resolveMerge","abortMerge","bitIds","getComponentsToMerge","mergeComponentsFromRemote","onDestroy","snapMessage","currentLaneId","getCurrentLaneId","currentLaneObject","getCurrentLaneObject","allComponentsStatus","getAllComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","map","failedComponent","chalk","bold","id","toString","red","join","BitError","mergeSnaps","otherLaneId","currentLane","noSnap","tag","detachHead","loose","legacyScope","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","shouldBeRemoved","componentIdsToRemove","changeVersion","undefined","succeededComponents","currentLaneIdsBeforeMerge","toComponentIds","componentsResults","applyVersionMultiple","allConfigMerge","compact","configMergeResult","workspaceDepsUpdates","workspaceDepsConflicts","workspaceDepsUnchanged","updateWorkspaceJsoncWithDepsIfNeeded","workspaceConfigConflictWriteError","writeWorkspaceJsoncWithConflictsGracefully","generateConfigMergeConflictFileForAll","objects","add","persist","unmergedComponents","write","writeBitMap","removeFromWsJsonPolicyIfExists","compBitIdsToRemove","ComponentIdList","fromArray","deleteComponentsFiles","cleanFromBitMap","componentsHasConfigMergeConflicts","some","leftUnresolvedConflicts","loadAllAppsAsAspects","dedupe","updateExisting","import","err","error","consoleFailure","updatedComponents","legacyCompToWrite","getSnapOrTagResults","idsToTag","results","tagAllLaneComponent","taggedComponents","autoTaggedResults","removedComponents","snappedComponents","autoSnappedResults","snapResolvedComponents","laneId","toLaneId","mergeSnapResults","mergeSnapError","bitMapSnapshot","bitMap","takeSnapshot","restoreFromSnapshot","components","applyVersionResult","workspaceConfigUpdateResult","newlyIntroducedIds","hasWithoutVersion","newlyIntroducedComponentIds","packages","componentIdToPackageName","isRemoved","removeFromRootPolicy","persistConfig","getMergeStatus","options","otherLane","mergeStatusProvider","MergeStatusProvider","getStatus","mapSeries","currentComponent","resolvedUnrelated","modelComponent","getModelComponent","updatedLaneId","isDefault","LaneId","from","name","applyVersion","remoteHead","getRef","version","compsToWrite","manyComponentsWriterOpts","writeConfig","reasonForBitmapChange","writeMany","filesStatus","unmergedComponent","fullName","head","addToCurrentLane","Error","isPartOfLane","isEqualWithoutVersion","addComponent","handleResolveUnrelated","headOnCurrentLane","unrelated","unrelatedHead","unrelatedLaneId","addEntry","markAllFilesAsUnchanged","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","MergeOptions","ours","strategy","remoteId","idToLoad","theirs","legacyComponent","loadComponentFromModelImportIfNeeded","getConsumerComponent","updateFileStatus","modifiedStatus","modifiedFiles","applyModifiedVersion","removeFilesIfNeeded","successfullyMergedConfig","getSuccessfullyMergedConfig","mergedConfig","manual","unmergedPaths","f","conflict","filePath","detachedHeads","setHead","markVersionAsLocal","ids","getIdsForUnmerged","reset","removeComponent","abortedComponents","snap","legacyBitIds","resolvedComponents","localLaneObject","Promise","all","bitId","remoteScopeName","remoteLaneId","remoteLanes","laneIdStr","toStringWithoutVersion","shouldSquash","getComponents","debug","ComponentID","fromObject","getLoadAspectOnlyForIds","dataMergeResult","dataConflictedIds","conflictedAspects","aspectIds","aspectId","snapFromScope","componentId","aspects","getEntry","lane","updatedLegacyComponents","loadAspectOnlyForIds","tagMessage","unmodified","componentIds","idsByPattern","entry","unresolvedComponents","u","mergePending","listMergePendingComponents","componentsList","ComponentsList","allIds","getAllIdsAvailableOnLaneIncludeRemoved","componentsFromModel","getModelComponents","duringMergeComps","listDuringMergeStateComponents","mergePendingComponents","toComponentId","divergedData","getDivergeDataForMergePending","isDiverged","diverge","provider","cli","loggerMain","compWriter","configStore","createLogger","MergingAspect","merging","register","MergeCmd","exports","CLIAspect","WorkspaceAspect","ScopeAspect","SnappingAspect","CheckoutAspect","InstallAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","ConfigAspect","RemoveAspect","ConfigStoreAspect","ConfigMergerAspect","DependencyResolverAspect","ApplicationAspect","MainRuntime","addRuntime"],"sources":["merging.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { WorkspaceAspect, OutsideWorkspaceError, Workspace, AutoTagResult } from '@teambit/workspace';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport { SnappingAspect, SnappingMain, TagResults } from '@teambit/snapping';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\nimport { UnmergedComponent } from '@teambit/legacy.scope';\nimport { Ref, Lane, ModelComponent } from '@teambit/objects';\nimport chalk from 'chalk';\nimport { ConfigAspect, ConfigMain } from '@teambit/config';\nimport { RemoveAspect, RemoveMain, deleteComponentsFiles } from '@teambit/remove';\nimport { pathNormalizeToLinux } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport {\n ApplyVersionWithComps,\n CheckoutAspect,\n CheckoutMain,\n ComponentStatusBase,\n applyModifiedVersion,\n removeFilesIfNeeded,\n updateFileStatus,\n} from '@teambit/checkout';\nimport {\n ConfigMergerAspect,\n ConfigMergerMain,\n ConfigMergeResult,\n WorkspaceConfigUpdateResult,\n} from '@teambit/config-merger';\nimport { SnapsDistance } from '@teambit/component.snap-distance';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { InstallMain, InstallAspect } from '@teambit/install';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\nimport { DataMergeResult, MergeStatusProvider, MergeStatusProviderOptions } from './merge-status-provider';\nimport {\n MergeStrategy,\n FileStatus,\n getMergeStrategyInteractive,\n MergeResultsThreeWay,\n MergeOptions,\n} from './merge-version';\nimport { ConfigStoreAspect, ConfigStoreMain } from '@teambit/config-store';\nimport { ApplicationAspect, ApplicationMain } from '@teambit/application';\n\ntype ResolveUnrelatedData = {\n strategy: MergeStrategy;\n headOnCurrentLane: Ref;\n unrelatedHead: Ref;\n unrelatedLaneId: LaneId;\n};\n\nexport type DivergedComponent = { id: ComponentID; diverge: SnapsDistance };\n\nexport type ComponentMergeStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null;\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n dataMergeResult?: DataMergeResult;\n};\n\nexport type ComponentMergeStatusBeforeMergeAttempt = ComponentStatusBase & {\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n mergeProps?: {\n otherLaneHead: Ref;\n currentId: ComponentID;\n modelComponent: ModelComponent;\n };\n};\n\nexport type FailedComponents = { id: ComponentID; unchangedMessage: string; unchangedLegitimately?: boolean };\n\n// fileName is PathLinux. TS doesn't let anything else in the keys other than string and number\nexport type FilesStatus = { [fileName: string]: keyof typeof FileStatus };\n\nexport type MergeSnapResults = {\n snappedComponents: ConsumerComponent[];\n autoSnappedResults: AutoTagResult[];\n removedComponents?: ComponentIdList;\n exportedIds?: ComponentID[];\n} | null;\n\nexport type ApplyVersionResult = { id: ComponentID; filesStatus: FilesStatus };\n\nexport type ApplyVersionResults = {\n components?: ApplyVersionResult[];\n version?: string;\n failedComponents?: FailedComponents[];\n removedComponents?: ComponentID[];\n addedComponents?: ComponentID[]; // relevant when restoreMissingComponents is true (e.g. bit lane merge-abort)\n newComponents?: ComponentID[]; // relevant for \"bit stash load\". (stashedBitmapEntries is populated)\n resolvedComponents?: ConsumerComponent[]; // relevant for bit merge --resolve\n abortedComponents?: ApplyVersionResult[]; // relevant for bit merge --abort\n mergeSnapResults?: MergeSnapResults;\n mergeSnapError?: Error;\n leftUnresolvedConflicts?: boolean;\n verbose?: boolean;\n newFromLane?: string[];\n newFromLaneAdded?: boolean;\n installationError?: Error; // in case the package manager failed, it won't throw, instead, it'll return error here\n compilationError?: Error; // in case the compiler failed, it won't throw, instead, it'll return error here\n workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult;\n gitBranchWarning?: string; // warning message when git branch creation fails\n};\n\nexport class MergingMain {\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n private install: InstallMain,\n private snapping: SnappingMain,\n private checkout: CheckoutMain,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private config: ConfigMain,\n private remove: RemoveMain,\n private configMerger: ConfigMergerMain,\n private depResolver: DependencyResolverMain,\n private application: ApplicationMain\n ) {}\n\n async merge(\n pattern: string,\n mergeStrategy: MergeStrategy,\n abort: boolean,\n resolve: boolean,\n noAutoSnap: boolean,\n message: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer: Consumer = this.workspace.consumer;\n let mergeResults;\n if (resolve) {\n mergeResults = await this.resolveMerge(pattern, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(pattern);\n } else {\n const bitIds = await this.getComponentsToMerge(pattern);\n mergeResults = await this.mergeComponentsFromRemote(\n consumer,\n bitIds,\n mergeStrategy,\n noAutoSnap,\n message,\n build,\n skipDependencyInstallation\n );\n }\n await consumer.onDestroy('merge');\n return mergeResults;\n }\n\n /**\n * when user is on main, it merges the remote main components into local.\n * when user is on a lane, it merges the remote lane components into the local lane.\n */\n async mergeComponentsFromRemote(\n consumer: Consumer,\n bitIds: ComponentID[],\n mergeStrategy: MergeStrategy,\n noAutoSnap: boolean,\n snapMessage: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n const currentLaneId = consumer.getCurrentLaneId();\n const currentLaneObject = await consumer.getCurrentLaneObject();\n const allComponentsStatus = await this.getAllComponentsStatus(\n bitIds,\n currentLaneId,\n currentLaneObject,\n mergeStrategy\n );\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to merge due to the following failures:\\n${failureMsgs}`);\n }\n\n return this.mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n otherLaneId: currentLaneId,\n currentLane: currentLaneObject,\n noAutoSnap: noAutoSnap,\n snapMessage,\n build,\n skipDependencyInstallation,\n });\n }\n\n /**\n * merge multiple components according to the \"allComponentsStatus\".\n */\n async mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n otherLaneId,\n currentLane,\n noAutoSnap,\n noSnap,\n tag,\n snapMessage,\n build,\n skipDependencyInstallation,\n detachHead,\n loose,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n otherLaneId: LaneId;\n currentLane?: Lane;\n noAutoSnap?: boolean;\n noSnap?: boolean;\n tag?: boolean;\n snapMessage?: string;\n build?: boolean;\n skipDependencyInstallation?: boolean;\n detachHead?: boolean;\n loose?: boolean;\n }): Promise<ApplyVersionResults> {\n const consumer = this.workspace?.consumer;\n const legacyScope = this.scope.legacyScope;\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict && !mergeStrategy) {\n mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unchangedMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\n .map((componentStatus) => ({\n id: componentStatus.id,\n unchangedMessage: componentStatus.unchangedMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unchangedMessage);\n\n const currentLaneIdsBeforeMerge = currentLane?.toComponentIds();\n\n const componentsResults = await this.applyVersionMultiple(\n succeededComponents,\n otherLaneId,\n mergeStrategy,\n currentLane,\n detachHead\n );\n\n const allConfigMerge = compact(succeededComponents.map((c) => c.configMergeResult));\n\n const { workspaceDepsUpdates, workspaceDepsConflicts, workspaceDepsUnchanged } = this.workspace\n ? await this.configMerger.updateWorkspaceJsoncWithDepsIfNeeded(allConfigMerge)\n : { workspaceDepsUpdates: undefined, workspaceDepsConflicts: undefined, workspaceDepsUnchanged: undefined };\n\n let workspaceConfigConflictWriteError: Error | undefined;\n if (workspaceDepsConflicts) {\n workspaceConfigConflictWriteError =\n await this.configMerger.writeWorkspaceJsoncWithConflictsGracefully(workspaceDepsConflicts);\n }\n if (this.workspace) await this.configMerger.generateConfigMergeConflictFileForAll(allConfigMerge);\n\n if (currentLane) legacyScope.objects.add(currentLane);\n\n await legacyScope.objects.persist(); // persist anyway, if currentLane is null it should save all main heads\n\n await legacyScope.objects.unmergedComponents.write();\n\n if (this.workspace) {\n await consumer.writeBitMap(`merge ${otherLaneId.toString()}`);\n await this.removeFromWsJsonPolicyIfExists(componentsResults, currentLane, currentLaneIdsBeforeMerge);\n }\n\n if (componentIdsToRemove.length && this.workspace) {\n const compBitIdsToRemove = ComponentIdList.fromArray(componentIdsToRemove);\n await deleteComponentsFiles(consumer, compBitIdsToRemove);\n await consumer.cleanFromBitMap(compBitIdsToRemove);\n }\n\n const componentsHasConfigMergeConflicts = allComponentsStatus.some((c) => c.configMergeResult?.hasConflicts());\n const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';\n\n if (!skipDependencyInstallation && !leftUnresolvedConflicts && !componentsHasConfigMergeConflicts) {\n // this is a workaround.\n // keep this here. although it gets called before snapping.\n // the reason is that when the installation is running, for some reason, some apps are unable to load in the same process.\n // they throw an error \"Cannot find module\" during the aspect loading.\n await this.application.loadAllAppsAsAspects();\n\n try {\n await this.install.install(undefined, {\n dedupe: true,\n updateExisting: false,\n import: false,\n });\n } catch (err: any) {\n this.logger.error(`failed installing packages`, err);\n this.logger.consoleFailure(\n `failed installing packages, see the log for full stacktrace. error: ${err.message}`\n );\n }\n }\n\n const updatedComponents = compact(componentsResults.map((c) => c.legacyCompToWrite));\n\n const getSnapOrTagResults = async (): Promise<MergeSnapResults> => {\n // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged\n // and some not. besides the fact that it could by mistake tag dependent, it's a confusing state. better not snap.\n if (noAutoSnap || noSnap || leftUnresolvedConflicts || componentsHasConfigMergeConflicts) {\n return null;\n }\n if (tag) {\n const idsToTag = allComponentsStatus.map((c) => c.id);\n const results = await this.tagAllLaneComponent(idsToTag, snapMessage, build);\n if (!results) return null;\n const { taggedComponents, autoTaggedResults, removedComponents } = results;\n return { snappedComponents: taggedComponents, autoSnappedResults: autoTaggedResults, removedComponents };\n }\n return this.snapResolvedComponents(allComponentsStatus, updatedComponents, {\n snapMessage,\n build,\n laneId: currentLane?.toLaneId(),\n loose,\n });\n };\n let mergeSnapResults: MergeSnapResults = null;\n let mergeSnapError: Error | undefined;\n const bitMapSnapshot = this.workspace ? this.workspace.bitMap.takeSnapshot() : null;\n try {\n mergeSnapResults = await getSnapOrTagResults();\n } catch (err: any) {\n this.logger.error('failed running snap. mergeSnapError:', err);\n mergeSnapError = err;\n if (bitMapSnapshot) this.workspace.bitMap.restoreFromSnapshot(bitMapSnapshot);\n }\n\n return {\n components: componentsResults.map((c) => c.applyVersionResult),\n failedComponents,\n removedComponents: [...componentIdsToRemove, ...(mergeSnapResults?.removedComponents || [])],\n mergeSnapResults,\n mergeSnapError,\n workspaceConfigUpdateResult: {\n workspaceDepsUpdates,\n workspaceDepsConflicts,\n workspaceDepsUnchanged,\n workspaceConfigConflictWriteError,\n },\n leftUnresolvedConflicts,\n };\n }\n\n async removeFromWsJsonPolicyIfExists(\n componentsResults: ApplyVersionWithComps[],\n currentLane?: Lane,\n currentLaneIdsBeforeMerge?: ComponentIdList\n ) {\n const newlyIntroducedIds = currentLane\n ?.toComponentIds()\n .filter((id) => !currentLaneIdsBeforeMerge?.hasWithoutVersion(id));\n const newlyIntroducedComponentIds = ComponentIdList.fromArray(newlyIntroducedIds || []);\n const components = compact(\n componentsResults\n .map((c) => c.legacyCompToWrite)\n .filter((c) => c && newlyIntroducedComponentIds.hasWithoutVersion(c.id))\n );\n const packages = components.map((c) => componentIdToPackageName(c));\n const isRemoved = this.depResolver.removeFromRootPolicy(packages);\n if (isRemoved) await this.depResolver.persistConfig('merge (remove packages)');\n }\n\n /**\n * this function gets called from two different commands:\n * 1. \"bit merge <ids...>\", when merging a component from a remote to the local.\n * in this case, the remote and local are on the same lane or both on main.\n * 2. \"bit lane merge\", when merging from one lane to another.\n */\n async getMergeStatus(\n bitIds: ComponentID[], // the id.version is the version we want to merge to the current component\n options: MergeStatusProviderOptions,\n currentLane?: Lane, // currently checked out lane. if on main, then it's null.\n otherLane?: Lane // the lane we want to merged to our lane. (null if it's \"main\").\n ): Promise<ComponentMergeStatus[]> {\n const mergeStatusProvider = new MergeStatusProvider(\n this.scope,\n this.logger,\n this.importer,\n options,\n this.workspace,\n currentLane,\n otherLane\n );\n return mergeStatusProvider.getStatus(bitIds);\n }\n\n private async applyVersionMultiple(\n succeededComponents: ComponentMergeStatus[],\n otherLaneId: LaneId,\n mergeStrategy: MergeStrategy,\n currentLane?: Lane,\n detachHead?: boolean\n ): Promise<ApplyVersionWithComps[]> {\n const componentsResults = await mapSeries(\n succeededComponents,\n async ({ currentComponent, id, mergeResults, resolvedUnrelated, configMergeResult }) => {\n const modelComponent = await this.scope.legacyScope.getModelComponent(id);\n const updatedLaneId = otherLaneId.isDefault() ? LaneId.from(otherLaneId.name, id.scope as string) : otherLaneId;\n return this.applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead: modelComponent.getRef(id.version as string) as Ref,\n otherLaneId: updatedLaneId,\n currentLane,\n resolvedUnrelated,\n configMergeResult,\n detachHead,\n });\n }\n );\n\n if (this.workspace) {\n const compsToWrite = compact(componentsResults.map((c) => c.legacyCompToWrite));\n const manyComponentsWriterOpts = {\n consumer: this.workspace.consumer,\n components: compsToWrite,\n skipDependencyInstallation: true,\n writeConfig: false, // @todo: should write if config exists before, needs to figure out how to do it.\n reasonForBitmapChange: 'merge',\n };\n await this.componentWriter.writeMany(manyComponentsWriterOpts);\n }\n\n return componentsResults;\n }\n\n private async applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead,\n otherLaneId,\n currentLane,\n resolvedUnrelated,\n configMergeResult,\n detachHead,\n }: {\n currentComponent: ConsumerComponent | null | undefined;\n id: ComponentID;\n mergeResults: MergeResultsThreeWay | null | undefined;\n mergeStrategy: MergeStrategy;\n remoteHead: Ref;\n otherLaneId: LaneId;\n currentLane?: Lane;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n detachHead?: boolean;\n }): Promise<ApplyVersionWithComps> {\n const legacyScope = this.scope.legacyScope;\n let filesStatus = {};\n const unmergedComponent: UnmergedComponent = {\n id: { name: id.fullName, scope: id.scope },\n head: remoteHead,\n laneId: otherLaneId,\n };\n id = currentComponent ? currentComponent.id : id;\n const modelComponent = await legacyScope.getModelComponent(id);\n\n const addToCurrentLane = (head: Ref) => {\n if (!currentLane) throw new Error('currentLane must be defined when adding to the lane');\n if (otherLaneId.isDefault()) {\n const isPartOfLane = currentLane.components.find((c) => c.id.isEqualWithoutVersion(id));\n if (!isPartOfLane) return;\n }\n currentLane.addComponent({ id, head });\n };\n\n const handleResolveUnrelated = (legacyCompToWrite?: ConsumerComponent) => {\n if (!currentComponent) throw new Error('currentComponent must be defined when resolvedUnrelated');\n // because when on a main, we don't allow merging lanes with unrelated. we asks users to switch to the lane\n // first and then merge with --resolve-unrelated\n if (!currentLane) throw new Error('currentLane must be defined when resolvedUnrelated');\n if (!resolvedUnrelated) throw new Error('resolvedUnrelated must be populated');\n addToCurrentLane(resolvedUnrelated.headOnCurrentLane);\n unmergedComponent.unrelated = {\n unrelatedHead: resolvedUnrelated.unrelatedHead,\n headOnCurrentLane: resolvedUnrelated.headOnCurrentLane,\n unrelatedLaneId: resolvedUnrelated.unrelatedLaneId,\n };\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { applyVersionResult: { id, filesStatus }, component: currentComponent, legacyCompToWrite };\n };\n\n const markAllFilesAsUnchanged = () => {\n if (!currentComponent) throw new Error(`applyVersion expect to get currentComponent for ${id.toString()}`);\n currentComponent.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n };\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n markAllFilesAsUnchanged();\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { applyVersionResult: { id, filesStatus }, component: currentComponent || undefined };\n }\n if (resolvedUnrelated?.strategy === 'ours') {\n markAllFilesAsUnchanged();\n return handleResolveUnrelated();\n }\n const remoteId = id.changeVersion(remoteHead.toString());\n const idToLoad = !mergeResults || mergeStrategy === MergeOptions.theirs ? remoteId : id;\n const legacyComponent = this.workspace\n ? await this.workspace.consumer.loadComponentFromModelImportIfNeeded(idToLoad)\n : 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\n if (mergeResults && mergeStrategy === MergeOptions.theirs) {\n // in this case, we don't want to update .bitmap with the version of the remote. we want to keep the same version\n legacyComponent.version = id.version;\n }\n const files = legacyComponent.files;\n updateFileStatus(files, filesStatus, currentComponent || undefined);\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n legacyComponent.files = modifiedFiles;\n filesStatus = { ...filesStatus, ...modifiedStatus };\n }\n\n if (this.workspace) await removeFilesIfNeeded(filesStatus, this.workspace.consumer, currentComponent || undefined);\n\n if (configMergeResult) {\n const successfullyMergedConfig = configMergeResult.getSuccessfullyMergedConfig();\n if (successfullyMergedConfig) {\n unmergedComponent.mergedConfig = successfullyMergedConfig;\n // no need to `unmergedComponents.addEntry` here. it'll be added in the next lines inside `if (mergeResults)`.\n // because if `configMergeResult` is set, `mergeResults` must be set as well. both happen on diverge.\n }\n }\n\n // if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents\n // otherwise, update the head of the current lane or main\n if (mergeResults) {\n if (mergeResults.hasConflicts && mergeStrategy === MergeOptions.manual) {\n unmergedComponent.unmergedPaths = mergeResults.modifiedFiles.filter((f) => f.conflict).map((f) => f.filePath);\n }\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n } else if (currentLane) {\n if (resolvedUnrelated) {\n // must be \"theirs\"\n return handleResolveUnrelated(legacyComponent);\n }\n addToCurrentLane(remoteHead);\n } else {\n // this is main\n if (detachHead) {\n modelComponent.detachedHeads.setHead(remoteHead);\n } else {\n modelComponent.setHead(remoteHead);\n // mark it as local, otherwise, when importing this component from a remote, it'll override it.\n modelComponent.markVersionAsLocal(remoteHead.toString());\n }\n legacyScope.objects.add(modelComponent);\n }\n\n return {\n applyVersionResult: { id: idToLoad, filesStatus },\n component: currentComponent || undefined,\n legacyCompToWrite: legacyComponent,\n };\n }\n\n private async abortMerge(pattern: string): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const ids = await this.getIdsForUnmerged(pattern);\n const results = await this.checkout.checkout({ ids, reset: true });\n ids.forEach((id) => consumer.scope.objects.unmergedComponents.removeComponent(id));\n await consumer.scope.objects.unmergedComponents.write();\n return { abortedComponents: results.components };\n }\n\n private async resolveMerge(pattern: string, snapMessage: string, build: boolean): Promise<ApplyVersionResults> {\n const ids = await this.getIdsForUnmerged(pattern);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const { snappedComponents } = await this.snapping.snap({\n legacyBitIds: ComponentIdList.fromArray(ids.map((id) => id)),\n build,\n message: snapMessage,\n });\n return { resolvedComponents: snappedComponents };\n }\n\n private async getAllComponentsStatus(\n bitIds: ComponentID[],\n laneId: LaneId,\n localLaneObject: Lane | undefined,\n mergeStrategy: MergeStrategy\n ): Promise<ComponentMergeStatus[]> {\n const ids = await Promise.all(\n bitIds.map(async (bitId) => {\n const remoteScopeName = laneId.isDefault() ? bitId.scope : laneId.scope;\n const remoteLaneId = LaneId.from(laneId.name, remoteScopeName as string);\n const remoteHead = await this.workspace.consumer.scope.objects.remoteLanes.getRef(remoteLaneId, bitId);\n const laneIdStr = remoteLaneId.toString();\n if (!remoteHead) {\n throw new BitError(`unable to find a remote head of \"${bitId.toStringWithoutVersion()}\" in \"${laneIdStr}\"`);\n }\n return bitId.changeVersion(remoteHead.toString());\n })\n );\n\n return this.getMergeStatus(ids, { shouldSquash: false, mergeStrategy }, localLaneObject, localLaneObject);\n }\n\n private async snapResolvedComponents(\n allComponentsStatus: ComponentMergeStatus[],\n updatedComponents: ConsumerComponent[],\n {\n snapMessage,\n build,\n laneId,\n loose,\n }: {\n snapMessage?: string;\n build?: boolean;\n laneId?: LaneId;\n loose?: boolean;\n }\n ): Promise<MergeSnapResults> {\n const unmergedComponents = this.scope.legacyScope.objects.unmergedComponents.getComponents();\n this.logger.debug(`merge-snaps, snapResolvedComponents, total ${unmergedComponents.length.toString()} components`);\n if (!unmergedComponents.length) return null;\n const ids = ComponentIdList.fromArray(unmergedComponents.map((r) => ComponentID.fromObject(r.id)));\n if (!this.workspace) {\n const getLoadAspectOnlyForIds = (): ComponentIdList | undefined => {\n if (!allComponentsStatus.length || !allComponentsStatus[0].dataMergeResult) return undefined;\n const dataConflictedIds = allComponentsStatus\n .filter((c) => {\n const conflictedAspects = c.dataMergeResult?.conflictedAspects || {};\n const aspectIds = Object.keys(conflictedAspects);\n aspectIds.forEach((aspectId) =>\n this.logger.debug(\n `conflicted-data for \"${c.id.toString()}\". aspectId: ${aspectId}. reason: ${conflictedAspects[aspectId]}`\n )\n );\n return aspectIds.length;\n })\n .map((c) => c.id);\n return ComponentIdList.fromArray(dataConflictedIds);\n };\n const results = await this.snapping.snapFromScope(\n ids.map((id) => ({\n componentId: id.toString(),\n aspects: this.scope.legacyScope.objects.unmergedComponents.getEntry(id)?.mergedConfig,\n })),\n {\n message: snapMessage,\n build,\n lane: laneId?.toString(),\n updatedLegacyComponents: updatedComponents,\n loadAspectOnlyForIds: getLoadAspectOnlyForIds(),\n loose,\n }\n );\n return results;\n }\n return this.snapping.snap({\n legacyBitIds: ids,\n build,\n message: snapMessage,\n loose,\n });\n }\n\n private async tagAllLaneComponent(\n idsToTag: ComponentID[],\n tagMessage?: string,\n build?: boolean\n ): Promise<TagResults | null> {\n const ids = idsToTag.map((id) => {\n return id.toStringWithoutVersion();\n });\n this.logger.debug(`merge-snaps, tagResolvedComponents, total ${idsToTag.length.toString()} components`);\n return this.snapping.tag({\n ids,\n build,\n message: tagMessage,\n unmodified: true,\n });\n }\n\n private async getIdsForUnmerged(pattern?: string): Promise<ComponentID[]> {\n if (pattern) {\n const componentIds = await this.workspace.idsByPattern(pattern);\n componentIds.forEach((id) => {\n const entry = this.workspace.consumer.scope.objects.unmergedComponents.getEntry(id);\n if (!entry) {\n throw new BitError(`unable to merge-resolve ${id.toString()}, it is not marked as unresolved`);\n }\n });\n return componentIds;\n }\n const unresolvedComponents = this.workspace.consumer.scope.objects.unmergedComponents.getComponents();\n if (!unresolvedComponents.length) throw new BitError(`all components are resolved already, nothing to do`);\n return unresolvedComponents.map((u) => ComponentID.fromObject(u.id));\n }\n\n private async getComponentsToMerge(pattern?: string): Promise<ComponentID[]> {\n if (pattern) {\n return this.workspace.idsByPattern(pattern);\n }\n const mergePending = await this.listMergePendingComponents();\n return mergePending.map((c) => c.id);\n }\n\n async listMergePendingComponents(componentsList?: ComponentsList): Promise<DivergedComponent[]> {\n const consumer = this.workspace.consumer;\n componentsList = componentsList || new ComponentsList(this.workspace);\n const allIds = consumer.bitMap.getAllIdsAvailableOnLaneIncludeRemoved();\n const componentsFromModel = await componentsList.getModelComponents();\n const duringMergeComps = componentsList.listDuringMergeStateComponents();\n const mergePendingComponents = await Promise.all(\n allIds.map(async (componentId: ComponentID) => {\n const modelComponent = componentsFromModel.find((c) => c.toComponentId().isEqualWithoutVersion(componentId));\n if (!modelComponent || duringMergeComps.hasWithoutVersion(componentId)) return null;\n const divergedData = await modelComponent.getDivergeDataForMergePending(consumer.scope.objects);\n if (!divergedData.isDiverged()) return null;\n return { id: modelComponent.toComponentId(), diverge: divergedData };\n })\n );\n return compact(mergePendingComponents);\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n ScopeAspect,\n SnappingAspect,\n CheckoutAspect,\n InstallAspect,\n LoggerAspect,\n ComponentWriterAspect,\n ImporterAspect,\n ConfigAspect,\n RemoveAspect,\n ConfigStoreAspect,\n ConfigMergerAspect,\n DependencyResolverAspect,\n ApplicationAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n scope,\n snapping,\n checkout,\n install,\n loggerMain,\n compWriter,\n importer,\n config,\n remove,\n configStore,\n configMerger,\n depResolver,\n application,\n ]: [\n CLIMain,\n Workspace,\n ScopeMain,\n SnappingMain,\n CheckoutMain,\n InstallMain,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n ConfigMain,\n RemoveMain,\n ConfigStoreMain,\n ConfigMergerMain,\n DependencyResolverMain,\n ApplicationMain,\n ]) {\n const logger = loggerMain.createLogger(MergingAspect.id);\n const merging = new MergingMain(\n workspace,\n scope,\n install,\n snapping,\n checkout,\n logger,\n compWriter,\n importer,\n config,\n remove,\n configMerger,\n depResolver,\n application\n );\n cli.register(new MergeCmd(merging, configStore));\n return merging;\n }\n}\n\nMergingAspect.addRuntime(MergingMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;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EACxBC,gCAAiB,CAClB;AAAAvT,eAAA,CAlpBUgB,WAAW,aAmpBLwS,kBAAW;AAuD9BpB,wBAAa,CAACqB,UAAU,CAACzS,WAAW,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_workspace","_legacy","_snapping","_pMapSeries","_interopRequireDefault","_componentId","_bitError","_laneId","_chalk","_config","_remove","_toolboxPath","_pkgModules","_componentWriter","_importer","_logger","_lodash","_checkout","_configMerger","_dependencyResolver","_install","_scope","_mergeCmd","_merging","_mergeStatusProvider","_mergeVersion","_configStore","_application","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","MergingMain","constructor","workspace","scope","install","snapping","checkout","logger","componentWriter","importer","config","remove","configMerger","depResolver","application","merge","pattern","mergeStrategy","abort","resolve","noAutoSnap","message","build","skipDependencyInstallation","OutsideWorkspaceError","consumer","mergeResults","resolveMerge","abortMerge","bitIds","getComponentsToMerge","mergeComponentsFromRemote","onDestroy","snapMessage","currentLaneId","getCurrentLaneId","currentLaneObject","getCurrentLaneObject","allComponentsStatus","getAllComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","map","failedComponent","chalk","bold","id","toString","red","join","BitError","mergeSnaps","otherLaneId","currentLane","noSnap","tag","detachHead","loose","legacyScope","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","shouldBeRemoved","componentIdsToRemove","changeVersion","undefined","succeededComponents","currentLaneIdsBeforeMerge","toComponentIds","componentsResults","applyVersionMultiple","allConfigMerge","compact","configMergeResult","workspaceDepsUpdates","workspaceDepsConflicts","workspaceDepsUnchanged","updateWorkspaceJsoncWithDepsIfNeeded","workspaceConfigConflictWriteError","writeWorkspaceJsoncWithConflictsGracefully","generateConfigMergeConflictFileForAll","objects","add","persist","unmergedComponents","write","writeBitMap","removeFromWsJsonPolicyIfExists","compBitIdsToRemove","ComponentIdList","fromArray","deleteComponentsFiles","cleanFromBitMap","componentsHasConfigMergeConflicts","some","leftUnresolvedConflicts","loadAllAppsAsAspects","dedupe","updateExisting","import","err","error","consoleFailure","updatedComponents","legacyCompToWrite","getSnapOrTagResults","idsToTag","results","tagAllLaneComponent","taggedComponents","autoTaggedResults","removedComponents","snappedComponents","autoSnappedResults","snapResolvedComponents","laneId","toLaneId","mergeSnapResults","mergeSnapError","bitMapSnapshot","bitMap","takeSnapshot","restoreFromSnapshot","components","applyVersionResult","workspaceConfigUpdateResult","newlyIntroducedIds","hasWithoutVersion","newlyIntroducedComponentIds","packages","componentIdToPackageName","isRemoved","removeFromRootPolicy","persistConfig","getMergeStatus","options","otherLane","mergeStatusProvider","MergeStatusProvider","getStatus","mapSeries","currentComponent","resolvedUnrelated","modelComponent","getModelComponent","updatedLaneId","isDefault","LaneId","from","name","applyVersion","remoteHead","getRef","version","compsToWrite","manyComponentsWriterOpts","writeConfig","reasonForBitmapChange","writeMany","filesStatus","unmergedComponent","fullName","head","addToCurrentLane","Error","isPartOfLane","isEqualWithoutVersion","addComponent","handleResolveUnrelated","headOnCurrentLane","unrelated","unrelatedHead","unrelatedLaneId","addEntry","markAllFilesAsUnchanged","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","MergeOptions","ours","strategy","remoteId","idToLoad","theirs","legacyComponent","loadComponentFromModelImportIfNeeded","getConsumerComponent","updateFileStatus","modifiedStatus","modifiedFiles","applyModifiedVersion","removeFilesIfNeeded","successfullyMergedConfig","getSuccessfullyMergedConfig","mergedConfig","manual","unmergedPaths","f","conflict","filePath","detachedHeads","setHead","markVersionAsLocal","ids","getIdsForUnmerged","reset","removeComponent","abortedComponents","snap","legacyBitIds","resolvedComponents","localLaneObject","Promise","all","bitId","remoteScopeName","remoteLaneId","remoteLanes","laneIdStr","toStringWithoutVersion","shouldSquash","getComponents","debug","ComponentID","fromObject","getLoadAspectOnlyForIds","dataMergeResult","dataConflictedIds","conflictedAspects","aspectIds","aspectId","snapFromScope","componentId","aspects","getEntry","lane","updatedLegacyComponents","loadAspectOnlyForIds","tagMessage","unmodified","componentIds","idsByPattern","entry","unresolvedComponents","u","mergePending","listMergePendingComponents","componentsList","ComponentsList","allIds","getAllIdsAvailableOnLaneIncludeRemoved","componentsFromModel","getModelComponents","duringMergeComps","listDuringMergeStateComponents","mergePendingComponents","toComponentId","divergedData","getDivergeDataForMergePending","isDiverged","diverge","provider","cli","loggerMain","compWriter","configStore","createLogger","MergingAspect","merging","register","MergeCmd","exports","CLIAspect","WorkspaceAspect","ScopeAspect","SnappingAspect","CheckoutAspect","InstallAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","ConfigAspect","RemoveAspect","ConfigStoreAspect","ConfigMergerAspect","DependencyResolverAspect","ApplicationAspect","MainRuntime","addRuntime"],"sources":["merging.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { Workspace, AutoTagResult } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport type { SnappingMain, TagResults } from '@teambit/snapping';\nimport { SnappingAspect } from '@teambit/snapping';\nimport mapSeries from 'p-map-series';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\nimport type { UnmergedComponent } from '@teambit/legacy.scope';\nimport type { Ref, Lane, ModelComponent } from '@teambit/objects';\nimport chalk from 'chalk';\nimport type { ConfigMain } from '@teambit/config';\nimport { ConfigAspect } from '@teambit/config';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect, deleteComponentsFiles } from '@teambit/remove';\nimport { pathNormalizeToLinux } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport type { ComponentWriterMain } from '@teambit/component-writer';\nimport { ComponentWriterAspect } from '@teambit/component-writer';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport type { ApplyVersionWithComps, CheckoutMain, ComponentStatusBase } from '@teambit/checkout';\nimport { CheckoutAspect, applyModifiedVersion, removeFilesIfNeeded, updateFileStatus } from '@teambit/checkout';\nimport type { ConfigMergerMain, ConfigMergeResult, WorkspaceConfigUpdateResult } from '@teambit/config-merger';\nimport { ConfigMergerAspect } from '@teambit/config-merger';\nimport type { SnapsDistance } from '@teambit/component.snap-distance';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport type { InstallMain } from '@teambit/install';\nimport { InstallAspect } from '@teambit/install';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\nimport type { DataMergeResult, MergeStatusProviderOptions } from './merge-status-provider';\nimport { MergeStatusProvider } from './merge-status-provider';\nimport type { MergeStrategy, MergeResultsThreeWay } from './merge-version';\nimport { FileStatus, getMergeStrategyInteractive, MergeOptions } from './merge-version';\nimport type { ConfigStoreMain } from '@teambit/config-store';\nimport { ConfigStoreAspect } from '@teambit/config-store';\nimport type { ApplicationMain } from '@teambit/application';\nimport { ApplicationAspect } from '@teambit/application';\n\ntype ResolveUnrelatedData = {\n strategy: MergeStrategy;\n headOnCurrentLane: Ref;\n unrelatedHead: Ref;\n unrelatedLaneId: LaneId;\n};\n\nexport type DivergedComponent = { id: ComponentID; diverge: SnapsDistance };\n\nexport type ComponentMergeStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null;\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n dataMergeResult?: DataMergeResult;\n};\n\nexport type ComponentMergeStatusBeforeMergeAttempt = ComponentStatusBase & {\n divergeData?: SnapsDistance;\n resolvedUnrelated?: ResolveUnrelatedData;\n mergeProps?: {\n otherLaneHead: Ref;\n currentId: ComponentID;\n modelComponent: ModelComponent;\n };\n};\n\nexport type FailedComponents = { id: ComponentID; unchangedMessage: string; unchangedLegitimately?: boolean };\n\n// fileName is PathLinux. TS doesn't let anything else in the keys other than string and number\nexport type FilesStatus = { [fileName: string]: keyof typeof FileStatus };\n\nexport type MergeSnapResults = {\n snappedComponents: ConsumerComponent[];\n autoSnappedResults: AutoTagResult[];\n removedComponents?: ComponentIdList;\n exportedIds?: ComponentID[];\n} | null;\n\nexport type ApplyVersionResult = { id: ComponentID; filesStatus: FilesStatus };\n\nexport type ApplyVersionResults = {\n components?: ApplyVersionResult[];\n version?: string;\n failedComponents?: FailedComponents[];\n removedComponents?: ComponentID[];\n addedComponents?: ComponentID[]; // relevant when restoreMissingComponents is true (e.g. bit lane merge-abort)\n newComponents?: ComponentID[]; // relevant for \"bit stash load\". (stashedBitmapEntries is populated)\n resolvedComponents?: ConsumerComponent[]; // relevant for bit merge --resolve\n abortedComponents?: ApplyVersionResult[]; // relevant for bit merge --abort\n mergeSnapResults?: MergeSnapResults;\n mergeSnapError?: Error;\n leftUnresolvedConflicts?: boolean;\n verbose?: boolean;\n newFromLane?: string[];\n newFromLaneAdded?: boolean;\n installationError?: Error; // in case the package manager failed, it won't throw, instead, it'll return error here\n compilationError?: Error; // in case the compiler failed, it won't throw, instead, it'll return error here\n workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult;\n gitBranchWarning?: string; // warning message when git branch creation fails\n};\n\nexport class MergingMain {\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n private install: InstallMain,\n private snapping: SnappingMain,\n private checkout: CheckoutMain,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private config: ConfigMain,\n private remove: RemoveMain,\n private configMerger: ConfigMergerMain,\n private depResolver: DependencyResolverMain,\n private application: ApplicationMain\n ) {}\n\n async merge(\n pattern: string,\n mergeStrategy: MergeStrategy,\n abort: boolean,\n resolve: boolean,\n noAutoSnap: boolean,\n message: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer: Consumer = this.workspace.consumer;\n let mergeResults;\n if (resolve) {\n mergeResults = await this.resolveMerge(pattern, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(pattern);\n } else {\n const bitIds = await this.getComponentsToMerge(pattern);\n mergeResults = await this.mergeComponentsFromRemote(\n consumer,\n bitIds,\n mergeStrategy,\n noAutoSnap,\n message,\n build,\n skipDependencyInstallation\n );\n }\n await consumer.onDestroy('merge');\n return mergeResults;\n }\n\n /**\n * when user is on main, it merges the remote main components into local.\n * when user is on a lane, it merges the remote lane components into the local lane.\n */\n async mergeComponentsFromRemote(\n consumer: Consumer,\n bitIds: ComponentID[],\n mergeStrategy: MergeStrategy,\n noAutoSnap: boolean,\n snapMessage: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n const currentLaneId = consumer.getCurrentLaneId();\n const currentLaneObject = await consumer.getCurrentLaneObject();\n const allComponentsStatus = await this.getAllComponentsStatus(\n bitIds,\n currentLaneId,\n currentLaneObject,\n mergeStrategy\n );\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to merge due to the following failures:\\n${failureMsgs}`);\n }\n\n return this.mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n otherLaneId: currentLaneId,\n currentLane: currentLaneObject,\n noAutoSnap: noAutoSnap,\n snapMessage,\n build,\n skipDependencyInstallation,\n });\n }\n\n /**\n * merge multiple components according to the \"allComponentsStatus\".\n */\n async mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n otherLaneId,\n currentLane,\n noAutoSnap,\n noSnap,\n tag,\n snapMessage,\n build,\n skipDependencyInstallation,\n detachHead,\n loose,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n otherLaneId: LaneId;\n currentLane?: Lane;\n noAutoSnap?: boolean;\n noSnap?: boolean;\n tag?: boolean;\n snapMessage?: string;\n build?: boolean;\n skipDependencyInstallation?: boolean;\n detachHead?: boolean;\n loose?: boolean;\n }): Promise<ApplyVersionResults> {\n const consumer = this.workspace?.consumer;\n const legacyScope = this.scope.legacyScope;\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict && !mergeStrategy) {\n mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unchangedMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\n .map((componentStatus) => ({\n id: componentStatus.id,\n unchangedMessage: componentStatus.unchangedMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unchangedMessage);\n\n const currentLaneIdsBeforeMerge = currentLane?.toComponentIds();\n\n const componentsResults = await this.applyVersionMultiple(\n succeededComponents,\n otherLaneId,\n mergeStrategy,\n currentLane,\n detachHead\n );\n\n const allConfigMerge = compact(succeededComponents.map((c) => c.configMergeResult));\n\n const { workspaceDepsUpdates, workspaceDepsConflicts, workspaceDepsUnchanged } = this.workspace\n ? await this.configMerger.updateWorkspaceJsoncWithDepsIfNeeded(allConfigMerge)\n : { workspaceDepsUpdates: undefined, workspaceDepsConflicts: undefined, workspaceDepsUnchanged: undefined };\n\n let workspaceConfigConflictWriteError: Error | undefined;\n if (workspaceDepsConflicts) {\n workspaceConfigConflictWriteError =\n await this.configMerger.writeWorkspaceJsoncWithConflictsGracefully(workspaceDepsConflicts);\n }\n if (this.workspace) await this.configMerger.generateConfigMergeConflictFileForAll(allConfigMerge);\n\n if (currentLane) legacyScope.objects.add(currentLane);\n\n await legacyScope.objects.persist(); // persist anyway, if currentLane is null it should save all main heads\n\n await legacyScope.objects.unmergedComponents.write();\n\n if (this.workspace) {\n await consumer.writeBitMap(`merge ${otherLaneId.toString()}`);\n await this.removeFromWsJsonPolicyIfExists(componentsResults, currentLane, currentLaneIdsBeforeMerge);\n }\n\n if (componentIdsToRemove.length && this.workspace) {\n const compBitIdsToRemove = ComponentIdList.fromArray(componentIdsToRemove);\n await deleteComponentsFiles(consumer, compBitIdsToRemove);\n await consumer.cleanFromBitMap(compBitIdsToRemove);\n }\n\n const componentsHasConfigMergeConflicts = allComponentsStatus.some((c) => c.configMergeResult?.hasConflicts());\n const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';\n\n if (!skipDependencyInstallation && !leftUnresolvedConflicts && !componentsHasConfigMergeConflicts) {\n // this is a workaround.\n // keep this here. although it gets called before snapping.\n // the reason is that when the installation is running, for some reason, some apps are unable to load in the same process.\n // they throw an error \"Cannot find module\" during the aspect loading.\n await this.application.loadAllAppsAsAspects();\n\n try {\n await this.install.install(undefined, {\n dedupe: true,\n updateExisting: false,\n import: false,\n });\n } catch (err: any) {\n this.logger.error(`failed installing packages`, err);\n this.logger.consoleFailure(\n `failed installing packages, see the log for full stacktrace. error: ${err.message}`\n );\n }\n }\n\n const updatedComponents = compact(componentsResults.map((c) => c.legacyCompToWrite));\n\n const getSnapOrTagResults = async (): Promise<MergeSnapResults> => {\n // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged\n // and some not. besides the fact that it could by mistake tag dependent, it's a confusing state. better not snap.\n if (noAutoSnap || noSnap || leftUnresolvedConflicts || componentsHasConfigMergeConflicts) {\n return null;\n }\n if (tag) {\n const idsToTag = allComponentsStatus.map((c) => c.id);\n const results = await this.tagAllLaneComponent(idsToTag, snapMessage, build);\n if (!results) return null;\n const { taggedComponents, autoTaggedResults, removedComponents } = results;\n return { snappedComponents: taggedComponents, autoSnappedResults: autoTaggedResults, removedComponents };\n }\n return this.snapResolvedComponents(allComponentsStatus, updatedComponents, {\n snapMessage,\n build,\n laneId: currentLane?.toLaneId(),\n loose,\n });\n };\n let mergeSnapResults: MergeSnapResults = null;\n let mergeSnapError: Error | undefined;\n const bitMapSnapshot = this.workspace ? this.workspace.bitMap.takeSnapshot() : null;\n try {\n mergeSnapResults = await getSnapOrTagResults();\n } catch (err: any) {\n this.logger.error('failed running snap. mergeSnapError:', err);\n mergeSnapError = err;\n if (bitMapSnapshot) this.workspace.bitMap.restoreFromSnapshot(bitMapSnapshot);\n }\n\n return {\n components: componentsResults.map((c) => c.applyVersionResult),\n failedComponents,\n removedComponents: [...componentIdsToRemove, ...(mergeSnapResults?.removedComponents || [])],\n mergeSnapResults,\n mergeSnapError,\n workspaceConfigUpdateResult: {\n workspaceDepsUpdates,\n workspaceDepsConflicts,\n workspaceDepsUnchanged,\n workspaceConfigConflictWriteError,\n },\n leftUnresolvedConflicts,\n };\n }\n\n async removeFromWsJsonPolicyIfExists(\n componentsResults: ApplyVersionWithComps[],\n currentLane?: Lane,\n currentLaneIdsBeforeMerge?: ComponentIdList\n ) {\n const newlyIntroducedIds = currentLane\n ?.toComponentIds()\n .filter((id) => !currentLaneIdsBeforeMerge?.hasWithoutVersion(id));\n const newlyIntroducedComponentIds = ComponentIdList.fromArray(newlyIntroducedIds || []);\n const components = compact(\n componentsResults\n .map((c) => c.legacyCompToWrite)\n .filter((c) => c && newlyIntroducedComponentIds.hasWithoutVersion(c.id))\n );\n const packages = components.map((c) => componentIdToPackageName(c));\n const isRemoved = this.depResolver.removeFromRootPolicy(packages);\n if (isRemoved) await this.depResolver.persistConfig('merge (remove packages)');\n }\n\n /**\n * this function gets called from two different commands:\n * 1. \"bit merge <ids...>\", when merging a component from a remote to the local.\n * in this case, the remote and local are on the same lane or both on main.\n * 2. \"bit lane merge\", when merging from one lane to another.\n */\n async getMergeStatus(\n bitIds: ComponentID[], // the id.version is the version we want to merge to the current component\n options: MergeStatusProviderOptions,\n currentLane?: Lane, // currently checked out lane. if on main, then it's null.\n otherLane?: Lane // the lane we want to merged to our lane. (null if it's \"main\").\n ): Promise<ComponentMergeStatus[]> {\n const mergeStatusProvider = new MergeStatusProvider(\n this.scope,\n this.logger,\n this.importer,\n options,\n this.workspace,\n currentLane,\n otherLane\n );\n return mergeStatusProvider.getStatus(bitIds);\n }\n\n private async applyVersionMultiple(\n succeededComponents: ComponentMergeStatus[],\n otherLaneId: LaneId,\n mergeStrategy: MergeStrategy,\n currentLane?: Lane,\n detachHead?: boolean\n ): Promise<ApplyVersionWithComps[]> {\n const componentsResults = await mapSeries(\n succeededComponents,\n async ({ currentComponent, id, mergeResults, resolvedUnrelated, configMergeResult }) => {\n const modelComponent = await this.scope.legacyScope.getModelComponent(id);\n const updatedLaneId = otherLaneId.isDefault() ? LaneId.from(otherLaneId.name, id.scope as string) : otherLaneId;\n return this.applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead: modelComponent.getRef(id.version as string) as Ref,\n otherLaneId: updatedLaneId,\n currentLane,\n resolvedUnrelated,\n configMergeResult,\n detachHead,\n });\n }\n );\n\n if (this.workspace) {\n const compsToWrite = compact(componentsResults.map((c) => c.legacyCompToWrite));\n const manyComponentsWriterOpts = {\n consumer: this.workspace.consumer,\n components: compsToWrite,\n skipDependencyInstallation: true,\n writeConfig: false, // @todo: should write if config exists before, needs to figure out how to do it.\n reasonForBitmapChange: 'merge',\n };\n await this.componentWriter.writeMany(manyComponentsWriterOpts);\n }\n\n return componentsResults;\n }\n\n private async applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead,\n otherLaneId,\n currentLane,\n resolvedUnrelated,\n configMergeResult,\n detachHead,\n }: {\n currentComponent: ConsumerComponent | null | undefined;\n id: ComponentID;\n mergeResults: MergeResultsThreeWay | null | undefined;\n mergeStrategy: MergeStrategy;\n remoteHead: Ref;\n otherLaneId: LaneId;\n currentLane?: Lane;\n resolvedUnrelated?: ResolveUnrelatedData;\n configMergeResult?: ConfigMergeResult;\n detachHead?: boolean;\n }): Promise<ApplyVersionWithComps> {\n const legacyScope = this.scope.legacyScope;\n let filesStatus = {};\n const unmergedComponent: UnmergedComponent = {\n id: { name: id.fullName, scope: id.scope },\n head: remoteHead,\n laneId: otherLaneId,\n };\n id = currentComponent ? currentComponent.id : id;\n const modelComponent = await legacyScope.getModelComponent(id);\n\n const addToCurrentLane = (head: Ref) => {\n if (!currentLane) throw new Error('currentLane must be defined when adding to the lane');\n if (otherLaneId.isDefault()) {\n const isPartOfLane = currentLane.components.find((c) => c.id.isEqualWithoutVersion(id));\n if (!isPartOfLane) return;\n }\n currentLane.addComponent({ id, head });\n };\n\n const handleResolveUnrelated = (legacyCompToWrite?: ConsumerComponent) => {\n if (!currentComponent) throw new Error('currentComponent must be defined when resolvedUnrelated');\n // because when on a main, we don't allow merging lanes with unrelated. we asks users to switch to the lane\n // first and then merge with --resolve-unrelated\n if (!currentLane) throw new Error('currentLane must be defined when resolvedUnrelated');\n if (!resolvedUnrelated) throw new Error('resolvedUnrelated must be populated');\n addToCurrentLane(resolvedUnrelated.headOnCurrentLane);\n unmergedComponent.unrelated = {\n unrelatedHead: resolvedUnrelated.unrelatedHead,\n headOnCurrentLane: resolvedUnrelated.headOnCurrentLane,\n unrelatedLaneId: resolvedUnrelated.unrelatedLaneId,\n };\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { applyVersionResult: { id, filesStatus }, component: currentComponent, legacyCompToWrite };\n };\n\n const markAllFilesAsUnchanged = () => {\n if (!currentComponent) throw new Error(`applyVersion expect to get currentComponent for ${id.toString()}`);\n currentComponent.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n };\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n markAllFilesAsUnchanged();\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { applyVersionResult: { id, filesStatus }, component: currentComponent || undefined };\n }\n if (resolvedUnrelated?.strategy === 'ours') {\n markAllFilesAsUnchanged();\n return handleResolveUnrelated();\n }\n const remoteId = id.changeVersion(remoteHead.toString());\n const idToLoad = !mergeResults || mergeStrategy === MergeOptions.theirs ? remoteId : id;\n const legacyComponent = this.workspace\n ? await this.workspace.consumer.loadComponentFromModelImportIfNeeded(idToLoad)\n : 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\n if (mergeResults && mergeStrategy === MergeOptions.theirs) {\n // in this case, we don't want to update .bitmap with the version of the remote. we want to keep the same version\n legacyComponent.version = id.version;\n }\n const files = legacyComponent.files;\n updateFileStatus(files, filesStatus, currentComponent || undefined);\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n legacyComponent.files = modifiedFiles;\n filesStatus = { ...filesStatus, ...modifiedStatus };\n }\n\n if (this.workspace) await removeFilesIfNeeded(filesStatus, this.workspace.consumer, currentComponent || undefined);\n\n if (configMergeResult) {\n const successfullyMergedConfig = configMergeResult.getSuccessfullyMergedConfig();\n if (successfullyMergedConfig) {\n unmergedComponent.mergedConfig = successfullyMergedConfig;\n // no need to `unmergedComponents.addEntry` here. it'll be added in the next lines inside `if (mergeResults)`.\n // because if `configMergeResult` is set, `mergeResults` must be set as well. both happen on diverge.\n }\n }\n\n // if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents\n // otherwise, update the head of the current lane or main\n if (mergeResults) {\n if (mergeResults.hasConflicts && mergeStrategy === MergeOptions.manual) {\n unmergedComponent.unmergedPaths = mergeResults.modifiedFiles.filter((f) => f.conflict).map((f) => f.filePath);\n }\n legacyScope.objects.unmergedComponents.addEntry(unmergedComponent);\n } else if (currentLane) {\n if (resolvedUnrelated) {\n // must be \"theirs\"\n return handleResolveUnrelated(legacyComponent);\n }\n addToCurrentLane(remoteHead);\n } else {\n // this is main\n if (detachHead) {\n modelComponent.detachedHeads.setHead(remoteHead);\n } else {\n modelComponent.setHead(remoteHead);\n // mark it as local, otherwise, when importing this component from a remote, it'll override it.\n modelComponent.markVersionAsLocal(remoteHead.toString());\n }\n legacyScope.objects.add(modelComponent);\n }\n\n return {\n applyVersionResult: { id: idToLoad, filesStatus },\n component: currentComponent || undefined,\n legacyCompToWrite: legacyComponent,\n };\n }\n\n private async abortMerge(pattern: string): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const ids = await this.getIdsForUnmerged(pattern);\n const results = await this.checkout.checkout({ ids, reset: true });\n ids.forEach((id) => consumer.scope.objects.unmergedComponents.removeComponent(id));\n await consumer.scope.objects.unmergedComponents.write();\n return { abortedComponents: results.components };\n }\n\n private async resolveMerge(pattern: string, snapMessage: string, build: boolean): Promise<ApplyVersionResults> {\n const ids = await this.getIdsForUnmerged(pattern);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const { snappedComponents } = await this.snapping.snap({\n legacyBitIds: ComponentIdList.fromArray(ids.map((id) => id)),\n build,\n message: snapMessage,\n });\n return { resolvedComponents: snappedComponents };\n }\n\n private async getAllComponentsStatus(\n bitIds: ComponentID[],\n laneId: LaneId,\n localLaneObject: Lane | undefined,\n mergeStrategy: MergeStrategy\n ): Promise<ComponentMergeStatus[]> {\n const ids = await Promise.all(\n bitIds.map(async (bitId) => {\n const remoteScopeName = laneId.isDefault() ? bitId.scope : laneId.scope;\n const remoteLaneId = LaneId.from(laneId.name, remoteScopeName as string);\n const remoteHead = await this.workspace.consumer.scope.objects.remoteLanes.getRef(remoteLaneId, bitId);\n const laneIdStr = remoteLaneId.toString();\n if (!remoteHead) {\n throw new BitError(`unable to find a remote head of \"${bitId.toStringWithoutVersion()}\" in \"${laneIdStr}\"`);\n }\n return bitId.changeVersion(remoteHead.toString());\n })\n );\n\n return this.getMergeStatus(ids, { shouldSquash: false, mergeStrategy }, localLaneObject, localLaneObject);\n }\n\n private async snapResolvedComponents(\n allComponentsStatus: ComponentMergeStatus[],\n updatedComponents: ConsumerComponent[],\n {\n snapMessage,\n build,\n laneId,\n loose,\n }: {\n snapMessage?: string;\n build?: boolean;\n laneId?: LaneId;\n loose?: boolean;\n }\n ): Promise<MergeSnapResults> {\n const unmergedComponents = this.scope.legacyScope.objects.unmergedComponents.getComponents();\n this.logger.debug(`merge-snaps, snapResolvedComponents, total ${unmergedComponents.length.toString()} components`);\n if (!unmergedComponents.length) return null;\n const ids = ComponentIdList.fromArray(unmergedComponents.map((r) => ComponentID.fromObject(r.id)));\n if (!this.workspace) {\n const getLoadAspectOnlyForIds = (): ComponentIdList | undefined => {\n if (!allComponentsStatus.length || !allComponentsStatus[0].dataMergeResult) return undefined;\n const dataConflictedIds = allComponentsStatus\n .filter((c) => {\n const conflictedAspects = c.dataMergeResult?.conflictedAspects || {};\n const aspectIds = Object.keys(conflictedAspects);\n aspectIds.forEach((aspectId) =>\n this.logger.debug(\n `conflicted-data for \"${c.id.toString()}\". aspectId: ${aspectId}. reason: ${conflictedAspects[aspectId]}`\n )\n );\n return aspectIds.length;\n })\n .map((c) => c.id);\n return ComponentIdList.fromArray(dataConflictedIds);\n };\n const results = await this.snapping.snapFromScope(\n ids.map((id) => ({\n componentId: id.toString(),\n aspects: this.scope.legacyScope.objects.unmergedComponents.getEntry(id)?.mergedConfig,\n })),\n {\n message: snapMessage,\n build,\n lane: laneId?.toString(),\n updatedLegacyComponents: updatedComponents,\n loadAspectOnlyForIds: getLoadAspectOnlyForIds(),\n loose,\n }\n );\n return results;\n }\n return this.snapping.snap({\n legacyBitIds: ids,\n build,\n message: snapMessage,\n loose,\n });\n }\n\n private async tagAllLaneComponent(\n idsToTag: ComponentID[],\n tagMessage?: string,\n build?: boolean\n ): Promise<TagResults | null> {\n const ids = idsToTag.map((id) => {\n return id.toStringWithoutVersion();\n });\n this.logger.debug(`merge-snaps, tagResolvedComponents, total ${idsToTag.length.toString()} components`);\n return this.snapping.tag({\n ids,\n build,\n message: tagMessage,\n unmodified: true,\n });\n }\n\n private async getIdsForUnmerged(pattern?: string): Promise<ComponentID[]> {\n if (pattern) {\n const componentIds = await this.workspace.idsByPattern(pattern);\n componentIds.forEach((id) => {\n const entry = this.workspace.consumer.scope.objects.unmergedComponents.getEntry(id);\n if (!entry) {\n throw new BitError(`unable to merge-resolve ${id.toString()}, it is not marked as unresolved`);\n }\n });\n return componentIds;\n }\n const unresolvedComponents = this.workspace.consumer.scope.objects.unmergedComponents.getComponents();\n if (!unresolvedComponents.length) throw new BitError(`all components are resolved already, nothing to do`);\n return unresolvedComponents.map((u) => ComponentID.fromObject(u.id));\n }\n\n private async getComponentsToMerge(pattern?: string): Promise<ComponentID[]> {\n if (pattern) {\n return this.workspace.idsByPattern(pattern);\n }\n const mergePending = await this.listMergePendingComponents();\n return mergePending.map((c) => c.id);\n }\n\n async listMergePendingComponents(componentsList?: ComponentsList): Promise<DivergedComponent[]> {\n const consumer = this.workspace.consumer;\n componentsList = componentsList || new ComponentsList(this.workspace);\n const allIds = consumer.bitMap.getAllIdsAvailableOnLaneIncludeRemoved();\n const componentsFromModel = await componentsList.getModelComponents();\n const duringMergeComps = componentsList.listDuringMergeStateComponents();\n const mergePendingComponents = await Promise.all(\n allIds.map(async (componentId: ComponentID) => {\n const modelComponent = componentsFromModel.find((c) => c.toComponentId().isEqualWithoutVersion(componentId));\n if (!modelComponent || duringMergeComps.hasWithoutVersion(componentId)) return null;\n const divergedData = await modelComponent.getDivergeDataForMergePending(consumer.scope.objects);\n if (!divergedData.isDiverged()) return null;\n return { id: modelComponent.toComponentId(), diverge: divergedData };\n })\n );\n return compact(mergePendingComponents);\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n ScopeAspect,\n SnappingAspect,\n CheckoutAspect,\n InstallAspect,\n LoggerAspect,\n ComponentWriterAspect,\n ImporterAspect,\n ConfigAspect,\n RemoveAspect,\n ConfigStoreAspect,\n ConfigMergerAspect,\n DependencyResolverAspect,\n ApplicationAspect,\n ];\n static runtime = MainRuntime;\n static async provider([\n cli,\n workspace,\n scope,\n snapping,\n checkout,\n install,\n loggerMain,\n compWriter,\n importer,\n config,\n remove,\n configStore,\n configMerger,\n depResolver,\n application,\n ]: [\n CLIMain,\n Workspace,\n ScopeMain,\n SnappingMain,\n CheckoutMain,\n InstallMain,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n ConfigMain,\n RemoveMain,\n ConfigStoreMain,\n ConfigMergerMain,\n DependencyResolverMain,\n ApplicationMain,\n ]) {\n const logger = loggerMain.createLogger(MergingAspect.id);\n const merging = new MergingMain(\n workspace,\n scope,\n install,\n snapping,\n checkout,\n logger,\n compWriter,\n importer,\n config,\n remove,\n configMerger,\n depResolver,\n application\n );\n cli.register(new MergeCmd(merging, configStore));\n return merging;\n }\n}\n\nMergingAspect.addRuntime(MergingMain);\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA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,sBAAY,EACZC,gCAAiB,EACjBC,kCAAkB,EAClBC,8CAAwB,EACxBC,gCAAiB,CAClB;AAAAvT,eAAA,CAlpBUgB,WAAW,aAmpBLwS,kBAAW;AAuD9BpB,wBAAa,CAACqB,UAAU,CAACzS,WAAW,CAAC","ignoreList":[]}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { BitError } from '@teambit/bit-error';
|
|
2
|
-
import { Source, Version, SourceFileModel } from '@teambit/objects';
|
|
2
|
+
import type { Source, Version, SourceFileModel } from '@teambit/objects';
|
|
3
3
|
import { sha1 } from '@teambit/toolbox.crypto.sha1';
|
|
4
|
-
import { PathLinux,
|
|
4
|
+
import type { PathLinux, PathOsBased } from '@teambit/toolbox.path.path';
|
|
5
|
+
import { pathNormalizeToLinux } from '@teambit/toolbox.path.path';
|
|
5
6
|
import * as eol from '@teambit/toolbox.string.eol';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import type { MergeFileParams, MergeFileResult } from '../merge-files';
|
|
8
|
+
import { mergeFiles } from '../merge-files';
|
|
9
|
+
import type { ConsumerComponent as Component } from '@teambit/legacy.consumer-component';
|
|
8
10
|
import { SourceFile } from '@teambit/component.sources';
|
|
9
|
-
import {
|
|
11
|
+
import type { Scope } from '@teambit/legacy.scope';
|
|
12
|
+
import { Tmp } from '@teambit/legacy.scope';
|
|
10
13
|
import { isEmpty } from 'lodash';
|
|
11
14
|
|
|
12
15
|
export type MergeResultsThreeWay = {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/merging",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.668",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/merging",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "merging",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.668"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -19,37 +19,37 @@
|
|
|
19
19
|
"@teambit/git.modules.git-executable": "0.0.14",
|
|
20
20
|
"@teambit/legacy.logger": "0.0.22",
|
|
21
21
|
"@teambit/legacy.utils": "0.0.22",
|
|
22
|
-
"@teambit/component.snap-distance": "0.0.58",
|
|
23
22
|
"@teambit/lane-id": "0.0.312",
|
|
24
|
-
"@teambit/legacy.consumer-component": "0.0.58",
|
|
25
|
-
"@teambit/legacy.extension-data": "0.0.59",
|
|
26
|
-
"@teambit/legacy.scope": "0.0.57",
|
|
27
23
|
"@teambit/harmony": "0.4.7",
|
|
28
|
-
"@teambit/legacy.component-list": "0.0.111",
|
|
29
|
-
"@teambit/legacy.consumer": "0.0.57",
|
|
30
|
-
"@teambit/pkg.modules.component-package-name": "0.0.64",
|
|
31
24
|
"@teambit/toolbox.path.path": "0.0.8",
|
|
32
25
|
"@teambit/legacy.cli.prompts": "0.0.19",
|
|
33
|
-
"@teambit/component.sources": "0.0.109",
|
|
34
26
|
"@teambit/toolbox.crypto.sha1": "0.0.7",
|
|
35
27
|
"@teambit/toolbox.string.eol": "0.0.5",
|
|
36
|
-
"@teambit/cli": "0.0.
|
|
37
|
-
"@teambit/config-merger": "0.0.
|
|
38
|
-
"@teambit/config-store": "0.0.
|
|
39
|
-
"@teambit/builder": "1.0.
|
|
40
|
-
"@teambit/
|
|
41
|
-
"@teambit/
|
|
42
|
-
"@teambit/
|
|
43
|
-
"@teambit/
|
|
44
|
-
"@teambit/
|
|
45
|
-
"@teambit/
|
|
46
|
-
"@teambit/
|
|
47
|
-
"@teambit/
|
|
48
|
-
"@teambit/
|
|
49
|
-
"@teambit/
|
|
50
|
-
"@teambit/
|
|
51
|
-
"@teambit/
|
|
52
|
-
"@teambit/
|
|
28
|
+
"@teambit/cli": "0.0.1245",
|
|
29
|
+
"@teambit/config-merger": "0.0.535",
|
|
30
|
+
"@teambit/config-store": "0.0.125",
|
|
31
|
+
"@teambit/builder": "1.0.668",
|
|
32
|
+
"@teambit/component.snap-distance": "0.0.59",
|
|
33
|
+
"@teambit/dependency-resolver": "1.0.668",
|
|
34
|
+
"@teambit/importer": "1.0.668",
|
|
35
|
+
"@teambit/legacy.consumer-component": "0.0.59",
|
|
36
|
+
"@teambit/legacy.extension-data": "0.0.60",
|
|
37
|
+
"@teambit/legacy.scope": "0.0.58",
|
|
38
|
+
"@teambit/logger": "0.0.1338",
|
|
39
|
+
"@teambit/objects": "0.0.175",
|
|
40
|
+
"@teambit/scope": "1.0.668",
|
|
41
|
+
"@teambit/workspace": "1.0.668",
|
|
42
|
+
"@teambit/application": "1.0.668",
|
|
43
|
+
"@teambit/checkout": "1.0.668",
|
|
44
|
+
"@teambit/component-writer": "1.0.668",
|
|
45
|
+
"@teambit/config": "0.0.1419",
|
|
46
|
+
"@teambit/install": "1.0.668",
|
|
47
|
+
"@teambit/legacy.component-list": "0.0.112",
|
|
48
|
+
"@teambit/legacy.consumer": "0.0.58",
|
|
49
|
+
"@teambit/pkg.modules.component-package-name": "0.0.65",
|
|
50
|
+
"@teambit/remove": "1.0.668",
|
|
51
|
+
"@teambit/snapping": "1.0.668",
|
|
52
|
+
"@teambit/component.sources": "0.0.110"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/lodash": "4.14.165",
|
|
File without changes
|