@teambit/merge-lanes 1.0.224 → 1.0.226

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.
@@ -167,6 +167,7 @@ the lane must be up-to-date with the other lane, otherwise, conflicts might occu
167
167
  })
168
168
  };
169
169
  } catch (err) {
170
+ this.mergeLanes.logger.error('merge-lane-from-scope.json, error: ', err);
170
171
  return {
171
172
  code: 1,
172
173
  error: err.message
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_laneId","_lodash","_utils","_bitError","_excluded","obj","__esModule","default","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","ownKeys","e","r","t","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","value","_toPropertyKey","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","MergeLaneFromScopeCmd","constructor","mergeLanes","name","description","DEFAULT_LANE","report","fromLane","toLane","pattern","keepReadme","noSquash","includeDeps","title","titleBase64","reMerge","BitError","titleBase64Decoded","fromBase64","undefined","mergedNow","unmerged","exportedIds","conflicts","mergeSnapError","mergeFromScope","snapMessage","mergedTitle","chalk","green","mergedOutput","join","nonMergedTitle","bold","nonMergedOutput","map","u","id","reason","conflictsTitle","conflictsOutput","files","config","mergeSnapErrorTitle","mergeSnapErrorOutput","red","message","exportedTitle","exportedOutput","compact","json","results","code","toString","mergedPreviously","_ref","rest","snappedIds","stack","err","error","exports"],"sources":["merge-lane-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\nimport { fromBase64 } from '@teambit/legacy/dist/utils';\nimport { BitError } from '@teambit/bit-error';\nimport { MergeFromScopeResult, MergeLanesMain } from './merge-lanes.main.runtime';\n\ntype Flags = {\n pattern?: string;\n push?: boolean;\n keepReadme?: boolean;\n noSquash: boolean;\n includeDeps?: boolean;\n title?: string;\n titleBase64?: string;\n reMerge?: boolean;\n};\n\n/**\n * private command. the underscore prefix is intended.\n */\nexport class MergeLaneFromScopeCmd implements Command {\n name = '_merge-lane <from-lane> [to-lane]';\n description = `merge a remote lane into another lane or main via a bare-scope (not workspace)`;\n extendedDescription = `to merge from a workspace, use \"bit lane merge\" command.\nthis is intended to use from the UI, which will have a button to merge an existing lane.\nthe lane must be up-to-date with the other lane, otherwise, conflicts might occur which are not handled in this command`;\n arguments = [\n {\n name: 'from-lane',\n description: `lane-id to merge from or \"${DEFAULT_LANE}\"`,\n },\n {\n name: 'to-lane',\n description: `lane-id to merge to. default is \"${DEFAULT_LANE}\"`,\n },\n ];\n alias = '';\n options = [\n ['', 'pattern <string>', 'partially merge the lane with the specified component-pattern'],\n [\n '',\n 'title <string>',\n 'if provided, it replaces the original message with this title and append squashed snaps messages',\n ],\n ['', 'title-base64 <string>', 'same as --title flag but the title is base64 encoded'],\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['', 'keep-readme', 'skip deleting the lane readme component after merging'],\n ['', 'no-squash', 'relevant for merging lanes into main, which by default squash.'],\n ['', 'include-deps', 'relevant for \"--pattern\". merge also dependencies of the given components'],\n ['', 're-merge', 'helpful when last merge failed during export. do not skip components that seemed to be merged'],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n remoteOp = true;\n\n constructor(private mergeLanes: MergeLanesMain) {}\n\n async report(\n [fromLane, toLane]: [string, string],\n {\n pattern,\n push = false,\n keepReadme = false,\n noSquash = false,\n includeDeps = false,\n title,\n titleBase64,\n reMerge,\n }: Flags\n ): Promise<string> {\n if (includeDeps && !pattern) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --pattern flag`);\n }\n if (fromLane === DEFAULT_LANE && !toLane) {\n throw new BitError('to merge from the main lane, specify the target lane');\n }\n\n const titleBase64Decoded = titleBase64 ? fromBase64(titleBase64) : undefined;\n\n const { mergedNow, unmerged, exportedIds, conflicts, mergeSnapError } = await this.mergeLanes.mergeFromScope(\n fromLane,\n toLane || DEFAULT_LANE,\n {\n push,\n keepReadme,\n noSquash,\n pattern,\n includeDeps,\n snapMessage: titleBase64Decoded || title,\n reMerge,\n }\n );\n\n const mergedTitle = chalk.green(\n `successfully merged ${mergedNow.length} components from ${fromLane} to ${toLane || DEFAULT_LANE}`\n );\n const mergedOutput = mergedNow.length ? `${mergedTitle}\\n${mergedNow.join('\\n')}` : '';\n\n const nonMergedTitle = chalk.bold(`the following ${unmerged.length} components were not merged`);\n const nonMergedOutput = unmerged.length\n ? `${nonMergedTitle}\\n${unmerged.map((u) => `${u.id} (${u.reason})`).join('\\n')}`\n : '';\n\n const conflictsTitle = chalk.bold(\n `the following ${conflicts?.length} components have conflicts, the merge was not completed`\n );\n const conflictsOutput = conflicts?.length\n ? `${conflictsTitle}\\n${conflicts\n .map((u) => `${u.id} (files: ${u.files.join(', ') || 'N/A'}) (config: ${u.config})`)\n .join('\\n')}`\n : '';\n\n const mergeSnapErrorTitle = chalk.bold(`the following error was thrown while snapping the components:`);\n const mergeSnapErrorOutput = mergeSnapError ? `${mergeSnapErrorTitle}\\n${chalk.red(mergeSnapError.message)}` : '';\n\n const exportedTitle = chalk.bold(`successfully exported ${exportedIds.length} components`);\n const exportedOutput = exportedIds.length ? `${exportedTitle}\\n${exportedIds.join('\\n')}` : '';\n\n return compact([mergedOutput, nonMergedOutput, conflictsOutput, mergeSnapErrorOutput, exportedOutput]).join('\\n\\n');\n }\n async json(\n [fromLane, toLane]: [string, string],\n { pattern, push = false, keepReadme = false, noSquash = false, includeDeps = false, reMerge }: Flags\n ) {\n if (includeDeps && !pattern) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --pattern flag`);\n }\n let results: MergeFromScopeResult;\n try {\n results = await this.mergeLanes.mergeFromScope(fromLane, toLane || DEFAULT_LANE, {\n push,\n keepReadme,\n noSquash,\n pattern,\n includeDeps,\n reMerge,\n });\n return {\n code: 0,\n data: {\n ...results,\n mergedNow: results.mergedNow.map((id) => id.toString()),\n mergedPreviously: results.mergedPreviously.map((id) => id.toString()),\n exportedIds: results.exportedIds.map((id) => id.toString()),\n unmerged: results.unmerged.map(({ id, reason }) => ({ id: id.toString(), reason })),\n conflicts: results.conflicts?.map(({ id, ...rest }) => ({ id: id.toString(), ...rest })),\n snappedIds: results.snappedIds?.map((id) => id.toString()),\n mergeSnapError: results.mergeSnapError\n ? { message: results.mergeSnapError.message, stack: results.mergeSnapError.stack }\n : undefined,\n },\n };\n } catch (err: any) {\n return {\n code: 1,\n error: err.message,\n };\n }\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,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,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;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,MAAAO,SAAA;AAAA,SAAAN,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA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mG,IAAA,EAAAvG,SAAA;YAAA,OAAA+B,aAAA;cAAUsD,EAAE,EAAEA,EAAE,CAACgB,QAAQ,CAAC;YAAC,GAAKG,IAAI;UAAA,CAAG,CAAC;UACxFC,UAAU,EAAEN,OAAO,CAACM,UAAU,EAAEtB,GAAG,CAAEE,EAAE,IAAKA,EAAE,CAACgB,QAAQ,CAAC,CAAC,CAAC;UAC1D7B,cAAc,EAAE2B,OAAO,CAAC3B,cAAc,GAClC;YAAEsB,OAAO,EAAEK,OAAO,CAAC3B,cAAc,CAACsB,OAAO;YAAEY,KAAK,EAAEP,OAAO,CAAC3B,cAAc,CAACkC;UAAM,CAAC,GAChFvC;QAAS;MAEjB,CAAC;IACH,CAAC,CAAC,OAAOwC,GAAQ,EAAE;MACjB,OAAO;QACLP,IAAI,EAAE,CAAC;QACPQ,KAAK,EAAED,GAAG,CAACb;MACb,CAAC;IACH;EACF;AACF;AAACe,OAAA,CAAA7D,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_laneId","_lodash","_utils","_bitError","_excluded","obj","__esModule","default","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","ownKeys","e","r","t","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","value","_toPropertyKey","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","MergeLaneFromScopeCmd","constructor","mergeLanes","name","description","DEFAULT_LANE","report","fromLane","toLane","pattern","keepReadme","noSquash","includeDeps","title","titleBase64","reMerge","BitError","titleBase64Decoded","fromBase64","undefined","mergedNow","unmerged","exportedIds","conflicts","mergeSnapError","mergeFromScope","snapMessage","mergedTitle","chalk","green","mergedOutput","join","nonMergedTitle","bold","nonMergedOutput","map","u","id","reason","conflictsTitle","conflictsOutput","files","config","mergeSnapErrorTitle","mergeSnapErrorOutput","red","message","exportedTitle","exportedOutput","compact","json","results","code","toString","mergedPreviously","_ref","rest","snappedIds","stack","err","logger","error","exports"],"sources":["merge-lane-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\nimport { fromBase64 } from '@teambit/legacy/dist/utils';\nimport { BitError } from '@teambit/bit-error';\nimport { MergeFromScopeResult, MergeLanesMain } from './merge-lanes.main.runtime';\n\ntype Flags = {\n pattern?: string;\n push?: boolean;\n keepReadme?: boolean;\n noSquash: boolean;\n includeDeps?: boolean;\n title?: string;\n titleBase64?: string;\n reMerge?: boolean;\n};\n\n/**\n * private command. the underscore prefix is intended.\n */\nexport class MergeLaneFromScopeCmd implements Command {\n name = '_merge-lane <from-lane> [to-lane]';\n description = `merge a remote lane into another lane or main via a bare-scope (not workspace)`;\n extendedDescription = `to merge from a workspace, use \"bit lane merge\" command.\nthis is intended to use from the UI, which will have a button to merge an existing lane.\nthe lane must be up-to-date with the other lane, otherwise, conflicts might occur which are not handled in this command`;\n arguments = [\n {\n name: 'from-lane',\n description: `lane-id to merge from or \"${DEFAULT_LANE}\"`,\n },\n {\n name: 'to-lane',\n description: `lane-id to merge to. default is \"${DEFAULT_LANE}\"`,\n },\n ];\n alias = '';\n options = [\n ['', 'pattern <string>', 'partially merge the lane with the specified component-pattern'],\n [\n '',\n 'title <string>',\n 'if provided, it replaces the original message with this title and append squashed snaps messages',\n ],\n ['', 'title-base64 <string>', 'same as --title flag but the title is base64 encoded'],\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['', 'keep-readme', 'skip deleting the lane readme component after merging'],\n ['', 'no-squash', 'relevant for merging lanes into main, which by default squash.'],\n ['', 'include-deps', 'relevant for \"--pattern\". merge also dependencies of the given components'],\n ['', 're-merge', 'helpful when last merge failed during export. do not skip components that seemed to be merged'],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n remoteOp = true;\n\n constructor(private mergeLanes: MergeLanesMain) {}\n\n async report(\n [fromLane, toLane]: [string, string],\n {\n pattern,\n push = false,\n keepReadme = false,\n noSquash = false,\n includeDeps = false,\n title,\n titleBase64,\n reMerge,\n }: Flags\n ): Promise<string> {\n if (includeDeps && !pattern) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --pattern flag`);\n }\n if (fromLane === DEFAULT_LANE && !toLane) {\n throw new BitError('to merge from the main lane, specify the target lane');\n }\n\n const titleBase64Decoded = titleBase64 ? fromBase64(titleBase64) : undefined;\n\n const { mergedNow, unmerged, exportedIds, conflicts, mergeSnapError } = await this.mergeLanes.mergeFromScope(\n fromLane,\n toLane || DEFAULT_LANE,\n {\n push,\n keepReadme,\n noSquash,\n pattern,\n includeDeps,\n snapMessage: titleBase64Decoded || title,\n reMerge,\n }\n );\n\n const mergedTitle = chalk.green(\n `successfully merged ${mergedNow.length} components from ${fromLane} to ${toLane || DEFAULT_LANE}`\n );\n const mergedOutput = mergedNow.length ? `${mergedTitle}\\n${mergedNow.join('\\n')}` : '';\n\n const nonMergedTitle = chalk.bold(`the following ${unmerged.length} components were not merged`);\n const nonMergedOutput = unmerged.length\n ? `${nonMergedTitle}\\n${unmerged.map((u) => `${u.id} (${u.reason})`).join('\\n')}`\n : '';\n\n const conflictsTitle = chalk.bold(\n `the following ${conflicts?.length} components have conflicts, the merge was not completed`\n );\n const conflictsOutput = conflicts?.length\n ? `${conflictsTitle}\\n${conflicts\n .map((u) => `${u.id} (files: ${u.files.join(', ') || 'N/A'}) (config: ${u.config})`)\n .join('\\n')}`\n : '';\n\n const mergeSnapErrorTitle = chalk.bold(`the following error was thrown while snapping the components:`);\n const mergeSnapErrorOutput = mergeSnapError ? `${mergeSnapErrorTitle}\\n${chalk.red(mergeSnapError.message)}` : '';\n\n const exportedTitle = chalk.bold(`successfully exported ${exportedIds.length} components`);\n const exportedOutput = exportedIds.length ? `${exportedTitle}\\n${exportedIds.join('\\n')}` : '';\n\n return compact([mergedOutput, nonMergedOutput, conflictsOutput, mergeSnapErrorOutput, exportedOutput]).join('\\n\\n');\n }\n async json(\n [fromLane, toLane]: [string, string],\n { pattern, push = false, keepReadme = false, noSquash = false, includeDeps = false, reMerge }: Flags\n ) {\n if (includeDeps && !pattern) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --pattern flag`);\n }\n let results: MergeFromScopeResult;\n try {\n results = await this.mergeLanes.mergeFromScope(fromLane, toLane || DEFAULT_LANE, {\n push,\n keepReadme,\n noSquash,\n pattern,\n includeDeps,\n reMerge,\n });\n return {\n code: 0,\n data: {\n ...results,\n mergedNow: results.mergedNow.map((id) => id.toString()),\n mergedPreviously: results.mergedPreviously.map((id) => id.toString()),\n exportedIds: results.exportedIds.map((id) => id.toString()),\n unmerged: results.unmerged.map(({ id, reason }) => ({ id: id.toString(), reason })),\n conflicts: results.conflicts?.map(({ id, ...rest }) => ({ id: id.toString(), ...rest })),\n snappedIds: results.snappedIds?.map((id) => id.toString()),\n mergeSnapError: results.mergeSnapError\n ? { message: results.mergeSnapError.message, stack: results.mergeSnapError.stack }\n : undefined,\n },\n };\n } catch (err: any) {\n this.mergeLanes.logger.error('merge-lane-from-scope.json, error: ', err);\n return {\n code: 1,\n error: err.message,\n };\n }\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,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAA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AACgB,QAAQ,CAAC,CAAC,CAAC;UAC3DhC,QAAQ,EAAE8B,OAAO,CAAC9B,QAAQ,CAACc,GAAG,CAAC,CAAC;YAAEE,EAAE;YAAEC;UAAO,CAAC,MAAM;YAAED,EAAE,EAAEA,EAAE,CAACgB,QAAQ,CAAC,CAAC;YAAEf;UAAO,CAAC,CAAC,CAAC;UACnFf,SAAS,EAAE4B,OAAO,CAAC5B,SAAS,EAAEY,GAAG,CAACoB,IAAA;YAAA,IAAC;gBAAElB;cAAY,CAAC,GAAAkB,IAAA;cAANC,IAAI,GAAApG,wBAAA,CAAAmG,IAAA,EAAAvG,SAAA;YAAA,OAAA+B,aAAA;cAAUsD,EAAE,EAAEA,EAAE,CAACgB,QAAQ,CAAC;YAAC,GAAKG,IAAI;UAAA,CAAG,CAAC;UACxFC,UAAU,EAAEN,OAAO,CAACM,UAAU,EAAEtB,GAAG,CAAEE,EAAE,IAAKA,EAAE,CAACgB,QAAQ,CAAC,CAAC,CAAC;UAC1D7B,cAAc,EAAE2B,OAAO,CAAC3B,cAAc,GAClC;YAAEsB,OAAO,EAAEK,OAAO,CAAC3B,cAAc,CAACsB,OAAO;YAAEY,KAAK,EAAEP,OAAO,CAAC3B,cAAc,CAACkC;UAAM,CAAC,GAChFvC;QAAS;MAEjB,CAAC;IACH,CAAC,CAAC,OAAOwC,GAAQ,EAAE;MACjB,IAAI,CAACzD,UAAU,CAAC0D,MAAM,CAACC,KAAK,CAAC,qCAAqC,EAAEF,GAAG,CAAC;MACxE,OAAO;QACLP,IAAI,EAAE,CAAC;QACPS,KAAK,EAAEF,GAAG,CAACb;MACb,CAAC;IACH;EACF;AACF;AAACgB,OAAA,CAAA9D,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -33,6 +33,7 @@ export type MergeLaneOptions = {
33
33
  ignoreConfigChanges?: boolean;
34
34
  skipFetch?: boolean;
35
35
  excludeNonLaneComps?: boolean;
36
+ shouldIncludeUpdateDependents?: boolean;
36
37
  };
37
38
  export type MergeFromScopeResult = {
38
39
  mergedNow: ComponentID[];
@@ -137,13 +137,6 @@ function _globalConfig() {
137
137
  };
138
138
  return data;
139
139
  }
140
- function _getDivergeData() {
141
- const data = require("@teambit/legacy/dist/scope/component-ops/get-diverge-data");
142
- _getDivergeData = function () {
143
- return data;
144
- };
145
- return data;
146
- }
147
140
  function _mergeLanes() {
148
141
  const data = require("./merge-lanes.aspect");
149
142
  _mergeLanes = function () {
@@ -232,7 +225,8 @@ class MergeLanesMain {
232
225
  resolveUnrelated,
233
226
  ignoreConfigChanges,
234
227
  skipFetch,
235
- excludeNonLaneComps
228
+ excludeNonLaneComps,
229
+ shouldIncludeUpdateDependents
236
230
  } = options;
237
231
  const legacyScope = this.scope.legacyScope;
238
232
  if (tag && !currentLaneId.isDefault()) {
@@ -276,7 +270,7 @@ class MergeLanesMain {
276
270
  }));
277
271
  }
278
272
  if (!otherLane) throw new Error(`lane must be defined for non-default`);
279
- return otherLane.toBitIds();
273
+ return shouldIncludeUpdateDependents ? otherLane.toComponentIdsIncludeUpdateDependents() : otherLane.toComponentIds();
280
274
  };
281
275
  const idsToMerge = await getBitIds();
282
276
  this.logger.debug(`merging the following ids: ${idsToMerge.toString()}`);
@@ -317,7 +311,7 @@ class MergeLanesMain {
317
311
  }
318
312
  (0, _checkout().throwForFailures)(allComponentsStatus);
319
313
  if (shouldSquash) {
320
- await squashSnaps(allComponentsStatus, currentLaneId, otherLaneId, legacyScope);
314
+ await squashSnaps(allComponentsStatus, currentLaneId, otherLaneId, legacyScope, options.snapMessage);
321
315
  }
322
316
  if (laneToFetchArtifactsFrom) {
323
317
  const ids = allComponentsStatus.map(c => c.id);
@@ -421,7 +415,7 @@ class MergeLanesMain {
421
415
  const getIdsToMerge = async () => {
422
416
  if (!options.pattern) return laneIds;
423
417
  const ids = await this.scope.filterIdsFromPoolIdsByPattern(options.pattern, laneIds);
424
- return _componentId().ComponentIdList.fromArray(ids.map(id => id));
418
+ return _componentId().ComponentIdList.fromArray(ids);
425
419
  };
426
420
  const idsToMerge = await getIdsToMerge();
427
421
  const scopeComponentsImporter = this.scope.legacyScope.scopeImporter;
@@ -470,116 +464,60 @@ class MergeLanesMain {
470
464
  });
471
465
  return exported;
472
466
  };
473
- if (fromLaneId.isDefault()) {
474
- // current -> target (to)
475
- // other -> source (from)
476
- options.mergeStrategy = 'manual';
477
- options.excludeNonLaneComps = true;
478
- options.skipDependencyInstallation = true;
479
- this.scope.legacyScope.setCurrentLaneId(toLaneId);
480
- // this causes issues when merging main to a lane as it fetches from the lane instead of from main.
481
- // see the e2e-test: "main to lane and multiple scopes when a main-version is missing from lane-scope"
482
- // this.scope.legacyScope.scopeImporter.shouldOnlyFetchFromCurrentLane = true;
467
+ if (!fromLaneId.isDefault()) {
468
+ await this.throwIfNotUpToDate(fromLaneId, toLaneId);
469
+ }
483
470
 
484
- const result = await this.mergeLane(fromLaneId, toLaneId, options);
485
- const {
486
- mergeSnapResults,
487
- leftUnresolvedConflicts,
488
- failedComponents,
489
- components,
490
- mergeSnapError
491
- } = result.mergeResults;
492
- this.logger.debug(`found the following config conflicts: ${result.configMergeResults.map(c => `\n${c.compIdStr}\n${c.generateMergeConflictFile()}`).join('\n')}`);
493
- const componentsWithConfigConflicts = result.configMergeResults.filter(c => c.hasConflicts()).map(c => c.compIdStr);
494
- const conflicts = [];
495
- const merged = [];
496
- components?.forEach(c => {
497
- const files = Object.keys(c.filesStatus).filter(f => c.filesStatus[f] === _mergeVersion().FileStatus.manual || c.filesStatus[f] === _mergeVersion().FileStatus.binaryConflict);
498
- const config = componentsWithConfigConflicts.includes(c.id.toStringWithoutVersion());
499
- if (files.length || config) {
500
- conflicts.push({
501
- id: c.id,
502
- files,
503
- config
504
- });
505
- } else merged.push(c.id);
506
- });
507
- const snappedIds = mergeSnapResults?.snappedComponents.map(c => c.id) || [];
508
- const laneToExport = await this.lanes.loadLane(toLaneId); // needs to be loaded again after the merge as it changed
509
- const exportedIds = leftUnresolvedConflicts || mergeSnapError ? [] : await exportIfNeeded(idsToMerge.map(id => id.changeVersion(undefined)), laneToExport);
510
- return {
511
- mergedNow: merged,
512
- mergedPreviously: failedComponents?.filter(({
513
- unchangedMessage
514
- }) => unchangedMessage === _merging().compIsAlreadyMergedMsg).map(c => c.id) || [],
515
- exportedIds,
516
- unmerged: failedComponents?.map(c => ({
471
+ // current -> target (to)
472
+ // other -> source (from)
473
+ options.mergeStrategy = 'manual';
474
+ options.excludeNonLaneComps = true;
475
+ options.skipDependencyInstallation = true;
476
+ options.shouldIncludeUpdateDependents = shouldIncludeUpdateDependents;
477
+ this.scope.legacyScope.setCurrentLaneId(toLaneId);
478
+ // this causes issues when merging main to a lane as it fetches from the lane instead of from main.
479
+ // see the e2e-test: "main to lane and multiple scopes when a main-version is missing from lane-scope"
480
+ // this.scope.legacyScope.scopeImporter.shouldOnlyFetchFromCurrentLane = true;
481
+
482
+ const result = await this.mergeLane(fromLaneId, toLaneId, options);
483
+ const {
484
+ mergeSnapResults,
485
+ leftUnresolvedConflicts,
486
+ failedComponents,
487
+ components,
488
+ mergeSnapError
489
+ } = result.mergeResults;
490
+ this.logger.debug(`found the following config conflicts: ${result.configMergeResults.map(c => `\n${c.compIdStr}\n${c.generateMergeConflictFile()}`).join('\n')}`);
491
+ const componentsWithConfigConflicts = result.configMergeResults.filter(c => c.hasConflicts()).map(c => c.compIdStr);
492
+ const conflicts = [];
493
+ const merged = [];
494
+ components?.forEach(c => {
495
+ const files = Object.keys(c.filesStatus).filter(f => c.filesStatus[f] === _mergeVersion().FileStatus.manual || c.filesStatus[f] === _mergeVersion().FileStatus.binaryConflict);
496
+ const config = componentsWithConfigConflicts.includes(c.id.toStringWithoutVersion());
497
+ if (files.length || config) {
498
+ conflicts.push({
517
499
  id: c.id,
518
- reason: c.unchangedMessage
519
- })) || [],
520
- conflicts,
521
- snappedIds,
522
- mergeSnapError
523
- };
524
- }
525
- await this.throwIfNotUpToDate(fromLaneId, toLaneId);
526
- const repo = this.scope.legacyScope.objects;
527
- // loop through all components, make sure they're all ahead of main (it might not be on main yet).
528
- // then, change the version object to include an extra parent to point to the main.
529
- // then, change the component object head to point to this changed version
530
- const mergedPreviously = [];
531
- const mergedNow = [];
532
- const log = await getLogForSquash(fromLaneId);
533
- const bitObjectsPerComp = await (0, _pMapSeries().default)(idsToMerge, async id => {
534
- const modelComponent = await this.scope.legacyScope.getModelComponent(id);
535
- const fromVersionObj = await modelComponent.loadVersion(id.version, repo);
536
- if (fromVersionObj.isRemoved()) return undefined;
537
- const fromLaneHead = modelComponent.getRef(id.version);
538
- if (!fromLaneHead) throw new Error(`lane head must be defined for ${id.toString()}`);
539
- const toLaneHead = toLaneObj ? toLaneObj.getComponent(id)?.head : modelComponent.head || null;
540
- if (toLaneHead?.isEqual(fromLaneHead) && !options.reMerge) {
541
- mergedPreviously.push(id);
542
- return undefined;
543
- }
544
- const divergeData = await (0, _getDivergeData().getDivergeData)({
545
- repo,
546
- modelComponent,
547
- sourceHead: toLaneHead,
548
- targetHead: fromLaneHead,
549
- throwForNoCommonSnap: true
550
- });
551
- const modifiedVersion = shouldSquash ? await squashOneComp(_laneId().DEFAULT_LANE, fromLaneId, id, divergeData, log, this.scope.legacyScope, fromVersionObj, options.snapMessage) : undefined;
552
- const objects = [];
553
- if (modifiedVersion) objects.push(modifiedVersion);
554
- if (toLaneObj) {
555
- toLaneObj.addComponent({
556
- id: id.changeVersion(undefined),
557
- head: fromLaneHead
500
+ files,
501
+ config
558
502
  });
559
- } else {
560
- modelComponent.setHead(fromLaneHead);
561
- objects.push(modelComponent);
562
- }
563
- mergedNow.push(id);
564
- return {
565
- id,
566
- objects
567
- };
503
+ } else merged.push(c.id);
568
504
  });
569
- const bitObjects = (0, _lodash().compact)(bitObjectsPerComp).map(b => b.objects);
570
- const bitObjectsFlat = bitObjects.flat();
571
- if (toLaneObj) bitObjectsFlat.push(toLaneObj);
572
- await repo.writeObjectsToTheFS(bitObjectsFlat);
573
- const ids = (0, _lodash().compact)(bitObjectsPerComp).map(b => b.id);
574
- const exportedIds = await exportIfNeeded(ids, toLaneObj);
505
+ const snappedIds = mergeSnapResults?.snappedComponents.map(c => c.id) || [];
506
+ const laneToExport = toLaneId.isDefault() ? undefined : await this.lanes.loadLane(toLaneId); // needs to be loaded again after the merge as it changed
507
+ const exportedIds = leftUnresolvedConflicts || mergeSnapError ? [] : await exportIfNeeded(idsToMerge.map(id => id.changeVersion(undefined)), laneToExport || undefined);
575
508
  return {
576
- mergedPreviously,
577
- mergedNow,
509
+ mergedNow: merged,
510
+ mergedPreviously: failedComponents?.filter(({
511
+ unchangedMessage
512
+ }) => unchangedMessage === _merging().compIsAlreadyMergedMsg).map(c => c.id) || [],
578
513
  exportedIds,
579
- unmerged: mergedPreviously.map(id => ({
580
- id,
581
- reason: 'already merged'
582
- }))
514
+ unmerged: failedComponents?.map(c => ({
515
+ id: c.id,
516
+ reason: c.unchangedMessage
517
+ })) || [],
518
+ conflicts,
519
+ snappedIds,
520
+ mergeSnapError
583
521
  };
584
522
  }
585
523
  async throwIfNotUpToDate(fromLaneId, toLaneId) {
@@ -723,7 +661,7 @@ async function getLogForSquash(otherLaneId) {
723
661
  });
724
662
  return log;
725
663
  }
726
- async function squashSnaps(allComponentsStatus, currentLaneId, otherLaneId, scope) {
664
+ async function squashSnaps(allComponentsStatus, currentLaneId, otherLaneId, scope, messageTitle) {
727
665
  const currentLaneName = currentLaneId.name;
728
666
  const succeededComponents = allComponentsStatus.filter(c => !c.unchangedMessage);
729
667
  const log = await getLogForSquash(otherLaneId);
@@ -735,7 +673,7 @@ async function squashSnaps(allComponentsStatus, currentLaneId, otherLaneId, scop
735
673
  if (!divergeData) {
736
674
  throw new Error(`unable to squash. divergeData is missing from ${id.toString()}`);
737
675
  }
738
- const modifiedComp = await squashOneComp(currentLaneName, otherLaneId, id, divergeData, log, scope, componentFromModel);
676
+ const modifiedComp = await squashOneComp(currentLaneName, otherLaneId, id, divergeData, log, scope, componentFromModel, messageTitle);
739
677
  if (modifiedComp) {
740
678
  scope.objects.add(modifiedComp);
741
679
  const modelComponent = await scope.getModelComponent(id);