@teambit/merge-lanes 1.0.1284 → 1.0.1286

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.
@@ -1,4 +1,4 @@
1
- import type { Route, Request, Response } from '@teambit/express';
1
+ import type { Route, Middleware } from '@teambit/express';
2
2
  import { Verb } from '@teambit/express';
3
3
  import type { Logger } from '@teambit/logger';
4
4
  import type { MergeLanesMain } from './merge-lanes.main.runtime';
@@ -9,5 +9,5 @@ export declare class LanesCheckConflictsRoute implements Route {
9
9
  method: string;
10
10
  route: string;
11
11
  verb: Verb;
12
- middlewares: ((req: Request, res: Response) => Promise<import("express").Response<any, Record<string, any>>>)[];
12
+ middlewares: Middleware[];
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_express","data","require","ownKeys","e","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","LanesCheckConflictsRoute","constructor","mergeLanes","logger","Verb","READ","req","res","body","sourceLane","targetLane","status","send","conflicts","checkLaneForConflicts","conflictsOutput","map","conflict","id","toString","json","error","exports"],"sources":["lanes-check-conflicts.route.ts"],"sourcesContent":["import type { Route, Request, Response } from '@teambit/express';\nimport { Verb } from '@teambit/express';\nimport type { Logger } from '@teambit/logger';\nimport type { MergeLanesMain } from './merge-lanes.main.runtime';\n\nexport class LanesCheckConflictsRoute implements Route {\n constructor(\n private mergeLanes: MergeLanesMain,\n private logger: Logger\n ) {}\n\n method = 'post';\n route = '/lanes/check-conflicts';\n verb = Verb.READ;\n\n middlewares = [\n async (req: Request, res: Response) => {\n const { body } = req;\n const sourceLane = body.sourceLane;\n const targetLane = body.targetLane;\n if (!sourceLane) {\n return res.status(400).send('Missing sourceLane in body');\n }\n if (!targetLane) {\n return res.status(400).send('Missing targetLane in body');\n }\n try {\n const { conflicts } = await this.mergeLanes.checkLaneForConflicts(sourceLane, targetLane, {});\n const conflictsOutput = conflicts.map((conflict) => {\n return {\n ...conflict,\n id: conflict.id.toString(),\n };\n });\n return res.json({ conflicts: conflictsOutput });\n } catch (e: any) {\n this.logger.error(e.toString());\n return res.status(500).send(e.toString());\n }\n },\n ];\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwC,SAAAE,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,KAAAH,OAAA,CAAAI,MAAA,CAAAD,CAAA,GA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MG,UAAU,GAAGD,IAAI,CAACC,UAAU;MAClC,MAAMC,UAAU,GAAGF,IAAI,CAACE,UAAU;MAClC,IAAI,CAACD,UAAU,EAAE;QACf,OAAOF,GAAG,CAACI,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,4BAA4B,CAAC;MAC3D;MACA,IAAI,CAACF,UAAU,EAAE;QACf,OAAOH,GAAG,CAACI,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,4BAA4B,CAAC;MAC3D;MACA,IAAI;QACF,MAAM;UAAEC;QAAU,CAAC,GAAG,MAAM,IAAI,CAACX,UAAU,CAACY,qBAAqB,CAACL,UAAU,EAAEC,UAAU,EAAE,CAAC,CAAC,CAAC;QAC7F,MAAMK,eAAe,GAAGF,SAAS,CAACG,GAAG,CAAEC,QAAQ,IAAK;UAClD,OAAArC,aAAA,CAAAA,aAAA,KACKqC,QAAQ;YACXC,EAAE,EAAED,QAAQ,CAACC,EAAE,CAACC,QAAQ,CAAC;UAAC;QAE9B,CAAC,CAAC;QACF,OAAOZ,GAAG,CAACa,IAAI,CAAC;UAAEP,SAAS,EAAEE;QAAgB,CAAC,CAAC;MACjD,CAAC,CAAC,OAAO/C,CAAM,EAAE;QACf,IAAI,CAACmC,MAAM,CAACkB,KAAK,CAACrD,CAAC,CAACmD,QAAQ,CAAC,CAAC,CAAC;QAC/B,OAAOZ,GAAG,CAACI,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC5C,CAAC,CAACmD,QAAQ,CAAC,CAAC,CAAC;MAC3C;IACF,CAAC,CACF;EA/BE;AAgCL;AAACG,OAAA,CAAAtB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_express","data","require","ownKeys","e","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","LanesCheckConflictsRoute","constructor","mergeLanes","logger","Verb","READ","req","res","body","sourceLane","targetLane","status","send","conflicts","checkLaneForConflicts","conflictsOutput","map","conflict","id","toString","json","error","exports"],"sources":["lanes-check-conflicts.route.ts"],"sourcesContent":["import type { Route, Request, Response, Middleware } from '@teambit/express';\nimport { Verb } from '@teambit/express';\nimport type { Logger } from '@teambit/logger';\nimport type { MergeLanesMain } from './merge-lanes.main.runtime';\n\nexport class LanesCheckConflictsRoute implements Route {\n constructor(\n private mergeLanes: MergeLanesMain,\n private logger: Logger\n ) {}\n\n method = 'post';\n route = '/lanes/check-conflicts';\n verb = Verb.READ;\n\n middlewares: Middleware[] = [\n async (req: Request, res: Response) => {\n const { body } = req;\n const sourceLane = body.sourceLane;\n const targetLane = body.targetLane;\n if (!sourceLane) {\n return res.status(400).send('Missing sourceLane in body');\n }\n if (!targetLane) {\n return res.status(400).send('Missing targetLane in body');\n }\n try {\n const { conflicts } = await this.mergeLanes.checkLaneForConflicts(sourceLane, targetLane, {});\n const conflictsOutput = conflicts.map((conflict) => {\n return {\n ...conflict,\n id: conflict.id.toString(),\n };\n });\n return res.json({ conflicts: conflictsOutput });\n } catch (e: any) {\n this.logger.error(e.toString());\n return res.status(500).send(e.toString());\n }\n },\n ];\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwC,SAAAE,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA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ACF,OAAOZ,GAAG,CAACa,IAAI,CAAC;UAAEP,SAAS,EAAEE;QAAgB,CAAC,CAAC;MACjD,CAAC,CAAC,OAAO/C,CAAM,EAAE;QACf,IAAI,CAACmC,MAAM,CAACkB,KAAK,CAACrD,CAAC,CAACmD,QAAQ,CAAC,CAAC,CAAC;QAC/B,OAAOZ,GAAG,CAACI,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC5C,CAAC,CAACmD,QAAQ,CAAC,CAAC,CAAC;MAC3C;IACF,CAAC,CACF;EA/BE;AAgCL;AAACG,OAAA,CAAAtB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ import type { ComponentID } from '@teambit/component-id';
1
2
  import type { ScopeMain } from '@teambit/scope';
2
3
  import type { Lane } from '@teambit/objects';
3
4
  import type { Consumer } from '@teambit/legacy.consumer';
@@ -9,6 +10,7 @@ type Snapshot = {
9
10
  copyOfWorkspaceJsonc: string;
10
11
  copyOfStagedSnaps?: string;
11
12
  copyOfStagedConfig?: string;
13
+ copyOfMainComponents?: Buffer[];
12
14
  };
13
15
  export declare class LastMerged {
14
16
  private scope;
@@ -16,13 +18,22 @@ export declare class LastMerged {
16
18
  private logger;
17
19
  constructor(scope: ScopeMain, consumer: Consumer, logger: Logger);
18
20
  get path(): string;
19
- takeSnapshot(currentLane?: Lane | null): Promise<Snapshot>;
21
+ /**
22
+ * `idsToMerge` is needed when merging into main. a lane keeps the heads of its components in the lane object, main
23
+ * keeps them in the component objects, so these are copied to restore the heads the merge moves.
24
+ */
25
+ takeSnapshot(currentLane?: Lane | null, idsToMerge?: ComponentID[]): Promise<Snapshot>;
26
+ private compressComponentObjects;
20
27
  persistSnapshot(snapshot: Snapshot): Promise<void>;
21
28
  restoreLaneObjectFromLastMerged(): Promise<void>;
22
29
  restoreFromLastMerged(mergeAbortOpts: MergeAbortOpts, currentLane?: Lane | null): Promise<{
23
30
  compDirsToRemove: string[];
24
31
  }>;
25
32
  private mergeAbortPrompt;
33
+ /**
34
+ * restore the component objects as they were before merging into main, which restores their main heads.
35
+ */
36
+ private restoreMainComponents;
26
37
  private getLastMergedLaneContentIfExists;
27
38
  private getFileContentIfExist;
28
39
  private getLastMergedBitmapPath;
@@ -30,5 +41,6 @@ export declare class LastMerged {
30
41
  private getLastMergedLanePath;
31
42
  private getLastMergedStagedSnapsPath;
32
43
  private getLastMergedStagedConfigPath;
44
+ private getLastMergedMainComponentsPath;
33
45
  }
34
46
  export {};
@@ -46,6 +46,13 @@ function _legacy() {
46
46
  };
47
47
  return data;
48
48
  }
49
+ function _lodash() {
50
+ const data = require("lodash");
51
+ _lodash = function () {
52
+ return data;
53
+ };
54
+ return data;
55
+ }
49
56
  function _objects() {
50
57
  const data = require("@teambit/objects");
51
58
  _objects = function () {
@@ -75,6 +82,7 @@ class PromptCanceled extends _bitError().BitError {
75
82
  }
76
83
  const LAST_MERGED_LANE_FILENAME = 'lane';
77
84
  const LAST_MERGED_BITMAP_FILENAME = 'bitmap';
85
+ const LAST_MERGED_MAIN_COMPONENTS_DIR = 'main-components';
78
86
  class LastMerged {
79
87
  constructor(scope, consumer, logger) {
80
88
  this.scope = scope;
@@ -84,7 +92,12 @@ class LastMerged {
84
92
  get path() {
85
93
  return this.scope.getLastMergedPath();
86
94
  }
87
- async takeSnapshot(currentLane) {
95
+
96
+ /**
97
+ * `idsToMerge` is needed when merging into main. a lane keeps the heads of its components in the lane object, main
98
+ * keeps them in the component objects, so these are copied to restore the heads the merge moves.
99
+ */
100
+ async takeSnapshot(currentLane, idsToMerge = []) {
88
101
  const consumer = this.consumer;
89
102
  const copyOfCurrentLane = currentLane ? currentLane.clone() : undefined;
90
103
  const copyOfBitmap = _tempy().default.file();
@@ -102,14 +115,20 @@ class LastMerged {
102
115
  copyOfStagedConfig = _tempy().default.file();
103
116
  await _fsExtra().default.copyFile(stagedConfig.filePath, copyOfStagedConfig);
104
117
  }
118
+ const copyOfMainComponents = currentLane ? undefined : await this.compressComponentObjects(idsToMerge);
105
119
  return {
106
120
  copyOfCurrentLane,
107
121
  copyOfBitmap,
108
122
  copyOfWorkspaceJsonc,
109
123
  copyOfStagedSnaps,
110
- copyOfStagedConfig
124
+ copyOfStagedConfig,
125
+ copyOfMainComponents
111
126
  };
112
127
  }
128
+ async compressComponentObjects(ids) {
129
+ const modelComponents = await Promise.all(ids.map(id => this.scope.legacyScope.getModelComponentIfExist(id.changeVersion(undefined))));
130
+ return Promise.all((0, _lodash().compact)(modelComponents).map(modelComponent => modelComponent.compress()));
131
+ }
113
132
  async persistSnapshot(snapshot) {
114
133
  const {
115
134
  copyOfCurrentLane,
@@ -132,6 +151,7 @@ class LastMerged {
132
151
  if (copyOfStagedConfig) {
133
152
  await _fsExtra().default.copyFile(copyOfStagedConfig, this.getLastMergedStagedConfigPath());
134
153
  }
154
+ await Promise.all((snapshot.copyOfMainComponents || []).map((compressed, index) => _fsExtra().default.outputFile(_path().default.join(this.getLastMergedMainComponentsPath(), String(index)), compressed)));
135
155
  }
136
156
  async restoreLaneObjectFromLastMerged() {
137
157
  if (!_fsExtra().default.pathExistsSync(this.path)) {
@@ -155,12 +175,8 @@ class LastMerged {
155
175
  if (!_fsExtra().default.pathExistsSync(this.getLastMergedWorkspacePath())) {
156
176
  throw new (_bitError().BitError)(`unable to abort the last lane-merge because the workspace.jsonc is missing from ${this.path}`);
157
177
  }
158
- if (currentLane) {
159
- if (!lastLane) {
160
- throw new (_bitError().BitError)(`unable to abort the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`);
161
- }
162
- const laneFromBackup = await _objects().BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);
163
- await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);
178
+ if (currentLane && !lastLane) {
179
+ throw new (_bitError().BitError)(`unable to abort the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`);
164
180
  }
165
181
  const previousBitmapBuffer = await _fsExtra().default.readFile(this.getLastMergedBitmapPath());
166
182
  const previousBitmap = _legacy().BitMap.loadFromContentWithoutLoadingFiles(previousBitmapBuffer, '', '', '');
@@ -170,6 +186,12 @@ class LastMerged {
170
186
  if (!mergeAbortOpts.silent) {
171
187
  await this.mergeAbortPrompt(compDirsToRemove);
172
188
  }
189
+ if (currentLane) {
190
+ const laneFromBackup = await _objects().BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);
191
+ await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);
192
+ } else {
193
+ await this.restoreMainComponents();
194
+ }
173
195
  await Promise.all(compDirsToRemove.map(dir => _fsExtra().default.remove(dir))); // it doesn't throw if not-exist, so we're good here.
174
196
  await _fsExtra().default.copyFile(this.getLastMergedBitmapPath(), this.consumer.bitMap.mapPath);
175
197
  await _fsExtra().default.copyFile(this.getLastMergedWorkspacePath(), this.consumer.config.path);
@@ -202,6 +224,20 @@ ${_chalk().default.bold('Do you want to continue? [yes(y)/no(n)]')}`
202
224
  throw new PromptCanceled();
203
225
  }
204
226
  }
227
+
228
+ /**
229
+ * restore the component objects as they were before merging into main, which restores their main heads.
230
+ */
231
+ async restoreMainComponents() {
232
+ const dir = this.getLastMergedMainComponentsPath();
233
+ // a snapshot of an older bit, or of a merge with no components, has no such dir
234
+ const filenames = await _fsExtra().default.readdir(dir).catch(err => {
235
+ if (err.code === 'ENOENT') return [];
236
+ throw err;
237
+ });
238
+ const modelComponents = await Promise.all(filenames.map(async filename => _objects().BitObject.parseObject(await _fsExtra().default.readFile(_path().default.join(dir, filename)), filename)));
239
+ await this.scope.legacyScope.objects.writeObjectsToTheFS(modelComponents);
240
+ }
205
241
  async getLastMergedLaneContentIfExists() {
206
242
  const filename = this.getLastMergedLanePath();
207
243
  return this.getFileContentIfExist(filename);
@@ -229,6 +265,9 @@ ${_chalk().default.bold('Do you want to continue? [yes(y)/no(n)]')}`
229
265
  getLastMergedStagedConfigPath() {
230
266
  return _path().default.join(this.path, 'staged-config.json');
231
267
  }
268
+ getLastMergedMainComponentsPath() {
269
+ return _path().default.join(this.path, LAST_MERGED_MAIN_COMPONENTS_DIR);
270
+ }
232
271
  }
233
272
  exports.LastMerged = LastMerged;
234
273
 
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","_interopRequireDefault","require","_tempy","_fsExtra","_yesno","_chalk","_legacy","_objects","_legacy2","_bitError","e","__esModule","default","PromptCanceled","BitError","constructor","chalk","yellow","LAST_MERGED_LANE_FILENAME","LAST_MERGED_BITMAP_FILENAME","LastMerged","scope","consumer","logger","path","getLastMergedPath","takeSnapshot","currentLane","copyOfCurrentLane","clone","undefined","copyOfBitmap","tempy","file","copyOfWorkspaceJsonc","copyOfStagedSnaps","fs","copyFile","bitMap","mapPath","config","stagedSnaps","isEmpty","StagedSnaps","getPath","stagedConfig","getStagedConfig","copyOfStagedConfig","filePath","persistSnapshot","snapshot","remove","ensureDir","getLastMergedBitmapPath","getLastMergedWorkspacePath","compressed","compress","outputFile","getLastMergedLanePath","getLastMergedStagedSnapsPath","getLastMergedStagedConfigPath","restoreLaneObjectFromLastMerged","pathExistsSync","lastLane","getLastMergedLaneContentIfExists","laneFromBackup","BitObject","parseObject","legacyScope","objects","writeObjectsToTheFS","restoreFromLastMerged","mergeAbortOpts","previousBitmapBuffer","readFile","previousBitmap","BitMap","loadFromContentWithoutLoadingFiles","currentRootDirs","getAllTrackDirs","previousRootDirs","compDirsToRemove","Object","keys","filter","dir","silent","mergeAbortPrompt","Promise","all","map","deleteFile","dirsToRemove","clearStatusLine","dirsToRemoveStr","length","join","ok","yesno","question","bold","filename","getFileContentIfExist","err","code","exports"],"sources":["last-merged.ts"],"sourcesContent":["import path from 'path';\nimport tempy from 'tempy';\nimport fs from 'fs-extra';\nimport yesno from 'yesno';\nimport chalk from 'chalk';\nimport { BitMap } from '@teambit/legacy.bit-map';\nimport type { ScopeMain } from '@teambit/scope';\nimport type { Lane } from '@teambit/objects';\nimport { BitObject } from '@teambit/objects';\nimport { StagedSnaps } from '@teambit/legacy.scope';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport { BitError } from '@teambit/bit-error';\nimport type { Logger } from '@teambit/logger';\nimport type { MergeAbortOpts } from './merge-abort.cmd';\n\nclass PromptCanceled extends BitError {\n constructor() {\n super(chalk.yellow('operation aborted'));\n }\n}\n\nconst LAST_MERGED_LANE_FILENAME = 'lane';\nconst LAST_MERGED_BITMAP_FILENAME = 'bitmap';\n\ntype Snapshot = {\n copyOfCurrentLane?: Lane;\n copyOfBitmap: string;\n copyOfWorkspaceJsonc: string;\n copyOfStagedSnaps?: string;\n copyOfStagedConfig?: string;\n};\n\nexport class LastMerged {\n constructor(\n private scope: ScopeMain,\n private consumer: Consumer,\n private logger: Logger\n ) {}\n\n get path() {\n return this.scope.getLastMergedPath();\n }\n\n async takeSnapshot(currentLane?: Lane | null): Promise<Snapshot> {\n const consumer = this.consumer;\n const copyOfCurrentLane = currentLane ? currentLane.clone() : undefined;\n const copyOfBitmap = tempy.file();\n const copyOfWorkspaceJsonc = tempy.file();\n let copyOfStagedSnaps: string | undefined;\n await fs.copyFile(consumer.bitMap.mapPath, copyOfBitmap);\n await fs.copyFile(consumer.config.path, copyOfWorkspaceJsonc);\n if (!consumer.scope.stagedSnaps.isEmpty()) {\n copyOfStagedSnaps = tempy.file();\n await fs.copyFile(StagedSnaps.getPath(consumer.scope.path), copyOfStagedSnaps);\n }\n const stagedConfig = await this.scope.getStagedConfig();\n let copyOfStagedConfig: string | undefined;\n if (!stagedConfig.isEmpty()) {\n copyOfStagedConfig = tempy.file();\n await fs.copyFile(stagedConfig.filePath, copyOfStagedConfig);\n }\n\n return {\n copyOfCurrentLane,\n copyOfBitmap,\n copyOfWorkspaceJsonc,\n copyOfStagedSnaps,\n copyOfStagedConfig,\n };\n }\n\n async persistSnapshot(snapshot: Snapshot) {\n const { copyOfCurrentLane, copyOfBitmap, copyOfWorkspaceJsonc, copyOfStagedSnaps, copyOfStagedConfig } = snapshot;\n await fs.remove(this.path);\n await fs.ensureDir(this.path);\n await fs.copyFile(copyOfBitmap, this.getLastMergedBitmapPath());\n await fs.copyFile(copyOfWorkspaceJsonc, this.getLastMergedWorkspacePath());\n if (copyOfCurrentLane) {\n const compressed = await copyOfCurrentLane.compress();\n await fs.outputFile(this.getLastMergedLanePath(), compressed);\n }\n if (copyOfStagedSnaps) {\n await fs.copyFile(copyOfStagedSnaps, this.getLastMergedStagedSnapsPath());\n }\n if (copyOfStagedConfig) {\n await fs.copyFile(copyOfStagedConfig, this.getLastMergedStagedConfigPath());\n }\n }\n\n async restoreLaneObjectFromLastMerged() {\n if (!fs.pathExistsSync(this.path)) {\n throw new BitError(`unable to abort the last lane-merge because \"bit export\" was running since then`);\n }\n const lastLane = await this.getLastMergedLaneContentIfExists();\n if (!lastLane) {\n throw new BitError(\n `unable to revert the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`\n );\n }\n const laneFromBackup = await BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);\n }\n\n async restoreFromLastMerged(mergeAbortOpts: MergeAbortOpts, currentLane?: Lane | null) {\n if (!fs.pathExistsSync(this.path)) {\n throw new BitError(`unable to abort the last lane-merge because \"bit export\" was running since then`);\n }\n const lastLane = await this.getLastMergedLaneContentIfExists();\n\n if (!fs.pathExistsSync(this.getLastMergedBitmapPath())) {\n throw new BitError(\n `unable to abort the last lane-merge because the ${LAST_MERGED_BITMAP_FILENAME} is missing from ${this.path}`\n );\n }\n if (!fs.pathExistsSync(this.getLastMergedWorkspacePath())) {\n throw new BitError(\n `unable to abort the last lane-merge because the workspace.jsonc is missing from ${this.path}`\n );\n }\n if (currentLane) {\n if (!lastLane) {\n throw new BitError(\n `unable to abort the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`\n );\n }\n const laneFromBackup = await BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);\n }\n const previousBitmapBuffer = await fs.readFile(this.getLastMergedBitmapPath());\n const previousBitmap = BitMap.loadFromContentWithoutLoadingFiles(previousBitmapBuffer, '', '', '');\n const currentRootDirs = this.consumer.bitMap.getAllTrackDirs();\n const previousRootDirs = previousBitmap.getAllTrackDirs();\n const compDirsToRemove = Object.keys(currentRootDirs).filter((dir) => !previousRootDirs[dir]);\n\n if (!mergeAbortOpts.silent) {\n await this.mergeAbortPrompt(compDirsToRemove);\n }\n await Promise.all(compDirsToRemove.map((dir) => fs.remove(dir))); // it doesn't throw if not-exist, so we're good here.\n await fs.copyFile(this.getLastMergedBitmapPath(), this.consumer.bitMap.mapPath);\n await fs.copyFile(this.getLastMergedWorkspacePath(), this.consumer.config.path);\n if (fs.pathExistsSync(this.getLastMergedStagedSnapsPath())) {\n await fs.copyFile(this.getLastMergedStagedSnapsPath(), StagedSnaps.getPath(this.scope.path));\n } else {\n await this.scope.legacyScope.stagedSnaps.deleteFile();\n }\n const stagedConfig = await this.scope.getStagedConfig();\n if (fs.pathExistsSync(this.getLastMergedStagedConfigPath())) {\n await fs.copyFile(this.getLastMergedStagedConfigPath(), stagedConfig.filePath);\n } else {\n await stagedConfig.deleteFile();\n }\n await fs.remove(this.path);\n\n return {\n compDirsToRemove,\n };\n }\n\n private async mergeAbortPrompt(dirsToRemove: string[]) {\n this.logger.clearStatusLine();\n const dirsToRemoveStr = dirsToRemove.length\n ? `\\nThe following directories introduced by the merge will be deleted: ${dirsToRemove.join(', ')}`\n : '';\n const ok = await yesno({\n question: `Code changes that were done since the last lane-merge will be lost.${dirsToRemoveStr}\nThe .bitmap and workspace.jsonc files will be restored to the state before the merge.\nThis action is irreversible.\n${chalk.bold('Do you want to continue? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new PromptCanceled();\n }\n }\n\n private async getLastMergedLaneContentIfExists(): Promise<Buffer | null> {\n const filename = this.getLastMergedLanePath();\n return this.getFileContentIfExist(filename);\n }\n private async getFileContentIfExist(filename: string): Promise<Buffer | null> {\n try {\n return await fs.readFile(filename);\n } catch (err: any) {\n if (err.code === 'ENOENT') return null;\n throw err;\n }\n }\n private getLastMergedBitmapPath() {\n return path.join(this.path, LAST_MERGED_BITMAP_FILENAME);\n }\n private getLastMergedWorkspacePath() {\n return path.join(this.path, 'workspace.jsonc');\n }\n private getLastMergedLanePath() {\n return path.join(this.path, LAST_MERGED_LANE_FILENAME);\n }\n private getLastMergedStagedSnapsPath() {\n return path.join(this.path, 'staged-snaps');\n }\n private getLastMergedStagedConfigPath() {\n return path.join(this.path, 'staged-config.json');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,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,SAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,MAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA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0BAA0BA,CAAA,EAAG;IACnC,OAAO9B,eAAI,CAACwE,IAAI,CAAC,IAAI,CAACxE,IAAI,EAAE,iBAAiB,CAAC;EAChD;EACQkC,qBAAqBA,CAAA,EAAG;IAC9B,OAAOlC,eAAI,CAACwE,IAAI,CAAC,IAAI,CAACxE,IAAI,EAAEN,yBAAyB,CAAC;EACxD;EACQyC,4BAA4BA,CAAA,EAAG;IACrC,OAAOnC,eAAI,CAACwE,IAAI,CAAC,IAAI,CAACxE,IAAI,EAAE,cAAc,CAAC;EAC7C;EACQoC,6BAA6BA,CAAA,EAAG;IACtC,OAAOpC,eAAI,CAACwE,IAAI,CAAC,IAAI,CAACxE,IAAI,EAAE,oBAAoB,CAAC;EACnD;AACF;AAACiF,OAAA,CAAArF,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_path","data","_interopRequireDefault","require","_tempy","_fsExtra","_yesno","_chalk","_legacy","_lodash","_objects","_legacy2","_bitError","e","__esModule","default","PromptCanceled","BitError","constructor","chalk","yellow","LAST_MERGED_LANE_FILENAME","LAST_MERGED_BITMAP_FILENAME","LAST_MERGED_MAIN_COMPONENTS_DIR","LastMerged","scope","consumer","logger","path","getLastMergedPath","takeSnapshot","currentLane","idsToMerge","copyOfCurrentLane","clone","undefined","copyOfBitmap","tempy","file","copyOfWorkspaceJsonc","copyOfStagedSnaps","fs","copyFile","bitMap","mapPath","config","stagedSnaps","isEmpty","StagedSnaps","getPath","stagedConfig","getStagedConfig","copyOfStagedConfig","filePath","copyOfMainComponents","compressComponentObjects","ids","modelComponents","Promise","all","map","id","legacyScope","getModelComponentIfExist","changeVersion","compact","modelComponent","compress","persistSnapshot","snapshot","remove","ensureDir","getLastMergedBitmapPath","getLastMergedWorkspacePath","compressed","outputFile","getLastMergedLanePath","getLastMergedStagedSnapsPath","getLastMergedStagedConfigPath","index","join","getLastMergedMainComponentsPath","String","restoreLaneObjectFromLastMerged","pathExistsSync","lastLane","getLastMergedLaneContentIfExists","laneFromBackup","BitObject","parseObject","objects","writeObjectsToTheFS","restoreFromLastMerged","mergeAbortOpts","previousBitmapBuffer","readFile","previousBitmap","BitMap","loadFromContentWithoutLoadingFiles","currentRootDirs","getAllTrackDirs","previousRootDirs","compDirsToRemove","Object","keys","filter","dir","silent","mergeAbortPrompt","restoreMainComponents","deleteFile","dirsToRemove","clearStatusLine","dirsToRemoveStr","length","ok","yesno","question","bold","filenames","readdir","catch","err","code","filename","getFileContentIfExist","exports"],"sources":["last-merged.ts"],"sourcesContent":["import path from 'path';\nimport tempy from 'tempy';\nimport fs from 'fs-extra';\nimport yesno from 'yesno';\nimport chalk from 'chalk';\nimport { BitMap } from '@teambit/legacy.bit-map';\nimport { compact } from 'lodash';\nimport type { ComponentID } from '@teambit/component-id';\nimport type { ScopeMain } from '@teambit/scope';\nimport type { Lane } from '@teambit/objects';\nimport { BitObject } from '@teambit/objects';\nimport { StagedSnaps } from '@teambit/legacy.scope';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport { BitError } from '@teambit/bit-error';\nimport type { Logger } from '@teambit/logger';\nimport type { MergeAbortOpts } from './merge-abort.cmd';\n\nclass PromptCanceled extends BitError {\n constructor() {\n super(chalk.yellow('operation aborted'));\n }\n}\n\nconst LAST_MERGED_LANE_FILENAME = 'lane';\nconst LAST_MERGED_BITMAP_FILENAME = 'bitmap';\nconst LAST_MERGED_MAIN_COMPONENTS_DIR = 'main-components';\n\ntype Snapshot = {\n copyOfCurrentLane?: Lane;\n copyOfBitmap: string;\n copyOfWorkspaceJsonc: string;\n copyOfStagedSnaps?: string;\n copyOfStagedConfig?: string;\n copyOfMainComponents?: Buffer[];\n};\n\nexport class LastMerged {\n constructor(\n private scope: ScopeMain,\n private consumer: Consumer,\n private logger: Logger\n ) {}\n\n get path() {\n return this.scope.getLastMergedPath();\n }\n\n /**\n * `idsToMerge` is needed when merging into main. a lane keeps the heads of its components in the lane object, main\n * keeps them in the component objects, so these are copied to restore the heads the merge moves.\n */\n async takeSnapshot(currentLane?: Lane | null, idsToMerge: ComponentID[] = []): Promise<Snapshot> {\n const consumer = this.consumer;\n const copyOfCurrentLane = currentLane ? currentLane.clone() : undefined;\n const copyOfBitmap = tempy.file();\n const copyOfWorkspaceJsonc = tempy.file();\n let copyOfStagedSnaps: string | undefined;\n await fs.copyFile(consumer.bitMap.mapPath, copyOfBitmap);\n await fs.copyFile(consumer.config.path, copyOfWorkspaceJsonc);\n if (!consumer.scope.stagedSnaps.isEmpty()) {\n copyOfStagedSnaps = tempy.file();\n await fs.copyFile(StagedSnaps.getPath(consumer.scope.path), copyOfStagedSnaps);\n }\n const stagedConfig = await this.scope.getStagedConfig();\n let copyOfStagedConfig: string | undefined;\n if (!stagedConfig.isEmpty()) {\n copyOfStagedConfig = tempy.file();\n await fs.copyFile(stagedConfig.filePath, copyOfStagedConfig);\n }\n const copyOfMainComponents = currentLane ? undefined : await this.compressComponentObjects(idsToMerge);\n\n return {\n copyOfCurrentLane,\n copyOfBitmap,\n copyOfWorkspaceJsonc,\n copyOfStagedSnaps,\n copyOfStagedConfig,\n copyOfMainComponents,\n };\n }\n\n private async compressComponentObjects(ids: ComponentID[]): Promise<Buffer[]> {\n const modelComponents = await Promise.all(\n ids.map((id) => this.scope.legacyScope.getModelComponentIfExist(id.changeVersion(undefined)))\n );\n return Promise.all(compact(modelComponents).map((modelComponent) => modelComponent.compress()));\n }\n\n async persistSnapshot(snapshot: Snapshot) {\n const { copyOfCurrentLane, copyOfBitmap, copyOfWorkspaceJsonc, copyOfStagedSnaps, copyOfStagedConfig } = snapshot;\n await fs.remove(this.path);\n await fs.ensureDir(this.path);\n await fs.copyFile(copyOfBitmap, this.getLastMergedBitmapPath());\n await fs.copyFile(copyOfWorkspaceJsonc, this.getLastMergedWorkspacePath());\n if (copyOfCurrentLane) {\n const compressed = await copyOfCurrentLane.compress();\n await fs.outputFile(this.getLastMergedLanePath(), compressed);\n }\n if (copyOfStagedSnaps) {\n await fs.copyFile(copyOfStagedSnaps, this.getLastMergedStagedSnapsPath());\n }\n if (copyOfStagedConfig) {\n await fs.copyFile(copyOfStagedConfig, this.getLastMergedStagedConfigPath());\n }\n await Promise.all(\n (snapshot.copyOfMainComponents || []).map((compressed, index) =>\n fs.outputFile(path.join(this.getLastMergedMainComponentsPath(), String(index)), compressed)\n )\n );\n }\n\n async restoreLaneObjectFromLastMerged() {\n if (!fs.pathExistsSync(this.path)) {\n throw new BitError(`unable to abort the last lane-merge because \"bit export\" was running since then`);\n }\n const lastLane = await this.getLastMergedLaneContentIfExists();\n if (!lastLane) {\n throw new BitError(\n `unable to revert the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`\n );\n }\n const laneFromBackup = await BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);\n }\n\n async restoreFromLastMerged(mergeAbortOpts: MergeAbortOpts, currentLane?: Lane | null) {\n if (!fs.pathExistsSync(this.path)) {\n throw new BitError(`unable to abort the last lane-merge because \"bit export\" was running since then`);\n }\n const lastLane = await this.getLastMergedLaneContentIfExists();\n\n if (!fs.pathExistsSync(this.getLastMergedBitmapPath())) {\n throw new BitError(\n `unable to abort the last lane-merge because the ${LAST_MERGED_BITMAP_FILENAME} is missing from ${this.path}`\n );\n }\n if (!fs.pathExistsSync(this.getLastMergedWorkspacePath())) {\n throw new BitError(\n `unable to abort the last lane-merge because the workspace.jsonc is missing from ${this.path}`\n );\n }\n if (currentLane && !lastLane) {\n throw new BitError(\n `unable to abort the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`\n );\n }\n const previousBitmapBuffer = await fs.readFile(this.getLastMergedBitmapPath());\n const previousBitmap = BitMap.loadFromContentWithoutLoadingFiles(previousBitmapBuffer, '', '', '');\n const currentRootDirs = this.consumer.bitMap.getAllTrackDirs();\n const previousRootDirs = previousBitmap.getAllTrackDirs();\n const compDirsToRemove = Object.keys(currentRootDirs).filter((dir) => !previousRootDirs[dir]);\n\n if (!mergeAbortOpts.silent) {\n await this.mergeAbortPrompt(compDirsToRemove);\n }\n if (currentLane) {\n const laneFromBackup = await BitObject.parseObject(lastLane as Buffer, LAST_MERGED_LANE_FILENAME);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);\n } else {\n await this.restoreMainComponents();\n }\n await Promise.all(compDirsToRemove.map((dir) => fs.remove(dir))); // it doesn't throw if not-exist, so we're good here.\n await fs.copyFile(this.getLastMergedBitmapPath(), this.consumer.bitMap.mapPath);\n await fs.copyFile(this.getLastMergedWorkspacePath(), this.consumer.config.path);\n if (fs.pathExistsSync(this.getLastMergedStagedSnapsPath())) {\n await fs.copyFile(this.getLastMergedStagedSnapsPath(), StagedSnaps.getPath(this.scope.path));\n } else {\n await this.scope.legacyScope.stagedSnaps.deleteFile();\n }\n const stagedConfig = await this.scope.getStagedConfig();\n if (fs.pathExistsSync(this.getLastMergedStagedConfigPath())) {\n await fs.copyFile(this.getLastMergedStagedConfigPath(), stagedConfig.filePath);\n } else {\n await stagedConfig.deleteFile();\n }\n await fs.remove(this.path);\n\n return {\n compDirsToRemove,\n };\n }\n\n private async mergeAbortPrompt(dirsToRemove: string[]) {\n this.logger.clearStatusLine();\n const dirsToRemoveStr = dirsToRemove.length\n ? `\\nThe following directories introduced by the merge will be deleted: ${dirsToRemove.join(', ')}`\n : '';\n const ok = await yesno({\n question: `Code changes that were done since the last lane-merge will be lost.${dirsToRemoveStr}\nThe .bitmap and workspace.jsonc files will be restored to the state before the merge.\nThis action is irreversible.\n${chalk.bold('Do you want to continue? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new PromptCanceled();\n }\n }\n\n /**\n * restore the component objects as they were before merging into main, which restores their main heads.\n */\n private async restoreMainComponents() {\n const dir = this.getLastMergedMainComponentsPath();\n // a snapshot of an older bit, or of a merge with no components, has no such dir\n const filenames: string[] = await fs.readdir(dir).catch((err) => {\n if (err.code === 'ENOENT') return [];\n throw err;\n });\n const modelComponents = await Promise.all(\n filenames.map(async (filename) => BitObject.parseObject(await fs.readFile(path.join(dir, filename)), filename))\n );\n await this.scope.legacyScope.objects.writeObjectsToTheFS(modelComponents);\n }\n\n private async getLastMergedLaneContentIfExists(): Promise<Buffer | null> {\n const filename = this.getLastMergedLanePath();\n return this.getFileContentIfExist(filename);\n }\n private async getFileContentIfExist(filename: string): Promise<Buffer | null> {\n try {\n return await fs.readFile(filename);\n } catch (err: any) {\n if (err.code === 'ENOENT') return null;\n throw err;\n }\n }\n private getLastMergedBitmapPath() {\n return path.join(this.path, LAST_MERGED_BITMAP_FILENAME);\n }\n private getLastMergedWorkspacePath() {\n return path.join(this.path, 'workspace.jsonc');\n }\n private getLastMergedLanePath() {\n return path.join(this.path, LAST_MERGED_LANE_FILENAME);\n }\n private getLastMergedStagedSnapsPath() {\n return path.join(this.path, 'staged-snaps');\n }\n private getLastMergedStagedConfigPath() {\n return path.join(this.path, 'staged-config.json');\n }\n private getLastMergedMainComponentsPath() {\n return path.join(this.path, LAST_MERGED_MAIN_COMPONENTS_DIR);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,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,SAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAA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G;IACtC,OAAOlD,eAAI,CAACoD,IAAI,CAAC,IAAI,CAACpD,IAAI,EAAE,oBAAoB,CAAC;EACnD;EACQqD,+BAA+BA,CAAA,EAAG;IACxC,OAAOrD,eAAI,CAACoD,IAAI,CAAC,IAAI,CAACpD,IAAI,EAAEL,+BAA+B,CAAC;EAC9D;AACF;AAACuG,OAAA,CAAAtG,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -333,7 +333,8 @@ class MergeLanesMain {
333
333
  await this.importer.importHeadArtifactsFromLane(laneToFetchArtifactsFrom, ids, true);
334
334
  }
335
335
  const lastMerged = consumer ? new (_lastMerged().LastMerged)(this.scope, consumer, this.logger) : undefined;
336
- const snapshot = await lastMerged?.takeSnapshot(currentLane);
336
+ // not only the succeeded ones. with "--tag", the unchanged components are tagged as well
337
+ const snapshot = await lastMerged?.takeSnapshot(currentLane, allComponentsStatus.map(c => c.id));
337
338
  const mergeResults = await this.merging.mergeSnaps({
338
339
  mergeStrategy,
339
340
  allComponentsStatus,
@@ -1 +1 @@
1
- {"version":3,"names":["_bitError","data","require","_path","_interopRequireDefault","_harmonyModules","_cli","_importer","_lanes","_merging","_componentModules","_workspace","_configStore","_harmonyModules2","_componentId","_objects","_componentVersion","_pMapSeries","_scope","_laneId","_logger","_checkout","_remove","_lodash","_export","_mergeLanes","_mergeLane","_missingCompsToMerge","_mergeAbort","_lastMerged","_mergeMove","_express","_lanesCheckConflicts","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MergeLanesMain","constructor","workspace","merging","lanes","logger","remove","scope","exporter","importer","checkout","mergeLaneByCLI","laneName","options","BitError","currentLaneId","consumer","getCurrentLaneId","otherLaneId","getParsedLaneId","shouldIncludeUpdateDependents","undefined","mergeLane","validateMergeFlags","currentLane","otherLane","laneToFetchArtifactsFrom","idsToMerge","resolveMergeContext","mergeStrategy","noAutoSnap","noSnap","tag","snapMessage","existingOnWorkspaceOnly","build","loose","keepReadme","squash","noSquash","pattern","includeDeps","skipDependencyInstallation","resolveUnrelated","ignoreConfigChanges","throwIfNotUpToDate","detachHead","legacyScope","debug","toString","shouldSquash","isDefault","allComponentsStatus","getMergeStatus","handleTargetAheadAsDiverged","shouldMergeAspectsData","componentIds","compIdsFromPattern","filterIdsFromPoolIdsByPattern","filterComponentsStatus","forEach","bitId","find","c","id","isEqualWithoutVersion","push","unchangedLegitimately","unchangedMessage","workspaceIds","listIds","filter","throwForFailures","succeededComponents","squashSnaps","messageTitle","ids","map","importHeadArtifactsFromLane","lastMerged","LastMerged","snapshot","takeSnapshot","mergeResults","mergeSnaps","persistSnapshot","mergedSuccessfully","failedComponents","length","every","failedComponent","deleteResults","readmeComponent","readmeComponentId","changeVersion","head","hash","removeLocallyByIds","reasonForRemoval","readmeResult","configMergeResults","compact","configMergeResult","mergedSnapIds","ComponentIdList","fromArray","mergeSnapResults","snappedComponents","componentsWithConfigConflicts","hasConflicts","compIdStr","conflicts","mergedSuccessfullyIds","components","files","keys","filesStatus","f","FileStatus","manual","binaryConflict","config","includes","toStringWithoutVersion","snappedId","searchWithoutVersion","importMissingReferencedDeps","onDestroy","name","checkedHashes","Set","candidateRefs","pMapSeries","modelComponent","getModelComponentIfExist","headVersion","loadVersion","objects","flattenedDependencies","loadFlattenedDependencies","depId","version","isSnap","has","add","Ref","from","existingRefs","hasMultiple","existingHashes","ref","missingHashes","scopeImporter","importManyObjects","subRefs","versionObject","load","refsWithOptions","existingSubRefs","missingSubRefs","isEqual","skipFetch","excludeNonLaneComps","fetchCurrent","fetchLaneWithItsComponents","loadLane","isDefaultLane","getMainIdsToMerge","compIdList","toVersionLatest","importObjectsFromMainIfExist","getOtherLane","lane","shouldFetch","isNew","getBitIds","resolveMainHeadsFromRemote","idsWithHead","Promise","all","getHeadOnMain","modelComponents","getModelComponent","toComponentId","Error","toComponentIdsIncludeUpdateDependents","toComponentIds","checkLaneForConflicts","sourceLaneIdStr","targetLaneIdStr","parseLaneIdFromString","modifiedFiles","conflict","isBinaryConflict","configData","co","configConflict","generateMergeConflictFile","filePath","mergeMove","newLaneName","OutsideWorkspaceError","lastMerge","restoreLaneObjectFromLastMerged","newLaneResult","createLane","abortLaneMerge","checkoutProps","mergeAbortOpts","getCurrentLane","compDirsToRemove","restoreFromLastMerged","_reloadConsumer","unmergedComponents","removeAllComponents","write","configMergeFile","getConflictMergeFile","delete","checkoutResults","checkoutError","restoreMissingComponents","err","error","restoredItems","path","basename","bitMap","mapPath","join","includeNonLaneComps","includeUpdateDependents","DEFAULT_LANE","laneIds","isExported","mainNotOnLane","laneId","fromLaneId","toLaneId","status","diffStatus","skipChanges","compsNotUpToDate","componentsStatus","s","upToDate","componentId","provider","cli","loggerMain","configStore","express","createLogger","MergeLanesAspect","lanesCommand","getCommand","mergeLanesMain","commands","MergeLaneCmd","MergeAbortLaneCmd","MergeMoveLaneCmd","register","LanesCheckConflictsRoute","exports","LanesAspect","CLIAspect","WorkspaceAspect","MergingAspect","LoggerAspect","RemoveAspect","ScopeAspect","ExportAspect","ImporterAspect","CheckoutAspect","ConfigStoreAspect","ExpressAspect","MainRuntime","compIdsToKeep","allBitIds","bitIdsFromPattern","bitIdsNotFromPattern","hasWithoutVersion","filteredComponentStatus","depsToAdd","missingDepsFromHead","missingDepsFromHistory","versionsToCheckPerId","compId","fromStatus","divergeData","targetVersions","snapsOnTargetOnly","headOnTarget","getCompHeadIncludeUpdateDependents","toImport","v","flat","importWithoutDeps","cache","includeVersionHistory","reason","remoteVersion","versionObj","flattenedDeps","depsNotIncludeInPattern","depsOnLane","dep","isOnLane","isIdOnLane","depsOnLaneStr","MissingCompsToMerge","uniq","depsWithoutVersion","d","depsUniqWithoutVersion","uniqFromArray","opts","currentLaneName","log","getLogForSquash","componentFromModel","modifiedComp","squashOneComp","versionHistory","updateRebasedVersionHistory","isDiverged","isSourceAhead","isTargetAhead","remoteSnaps","getAllMessages","versionObjects","message","getFinalMessage","allMessage","allMessageStr","m","currentParents","parents","commonSnapBeforeDiverge","doSquash","addAsOnlyParent","removeParent","finalMessage","setSquashed","previousParents","addRuntime","_default"],"sources":["merge-lanes.main.runtime.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport path from 'path';\nimport type { CLIMain } from '@teambit/cli';\nimport { MainRuntime } from '@teambit/harmony.modules.runtimes';\nimport { CLIAspect } from '@teambit/cli';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport type { LanesMain } from '@teambit/lanes';\nimport { LanesAspect } from '@teambit/lanes';\nimport type { MergingMain, ComponentMergeStatus } from '@teambit/merging';\nimport type { ApplyVersionResults, MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { MergingAspect } from '@teambit/merging';\nimport { FileStatus } from '@teambit/component.modules.merge-helper';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport type { ConfigStoreMain } from '@teambit/config-store';\nimport { ConfigStoreAspect } from '@teambit/config-store';\nimport { getLogForSquash } from '@teambit/harmony.modules.get-basic-log';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { Lane, Version, Log } from '@teambit/objects';\nimport { Ref } from '@teambit/objects';\nimport { isSnap } from '@teambit/component-version';\nimport pMapSeries from 'p-map-series';\nimport type { Scope as LegacyScope } from '@teambit/legacy.scope';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { LaneId } from '@teambit/lane-id';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport type { ConfigMergeResult } from '@teambit/config-merger';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { CheckoutMain, CheckoutProps } from '@teambit/checkout';\nimport { CheckoutAspect, throwForFailures } from '@teambit/checkout';\nimport type { SnapsDistance } from '@teambit/component.snap-distance';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect } from '@teambit/remove';\nimport { compact, uniq } from 'lodash';\nimport type { ExportMain } from '@teambit/export';\nimport { ExportAspect } from '@teambit/export';\nimport { MergeLanesAspect } from './merge-lanes.aspect';\nimport { MergeLaneCmd } from './merge-lane.cmd';\nimport { MissingCompsToMerge } from './exceptions/missing-comps-to-merge';\nimport type { MergeAbortOpts } from './merge-abort.cmd';\nimport { MergeAbortLaneCmd } from './merge-abort.cmd';\nimport { LastMerged } from './last-merged';\nimport { MergeMoveLaneCmd } from './merge-move.cmd';\nimport type { ExpressMain } from '@teambit/express';\nimport { ExpressAspect } from '@teambit/express';\nimport { LanesCheckConflictsRoute } from './lanes-check-conflicts.route';\n\nexport type MergeLaneOptions = {\n mergeStrategy: MergeStrategy;\n ours?: boolean;\n theirs?: boolean;\n noAutoSnap?: boolean;\n noSnap?: boolean;\n snapMessage?: string;\n existingOnWorkspaceOnly?: boolean;\n build?: boolean;\n keepReadme?: boolean;\n squash?: boolean;\n noSquash?: boolean;\n tag?: boolean;\n pattern?: string;\n includeDeps?: boolean;\n skipDependencyInstallation?: boolean;\n resolveUnrelated?: MergeStrategy;\n ignoreConfigChanges?: boolean;\n skipFetch?: boolean;\n excludeNonLaneComps?: boolean;\n shouldIncludeUpdateDependents?: boolean;\n throwIfNotUpToDate?: boolean; // relevant when merging from a scope\n fetchCurrent?: boolean; // needed when merging from a bare-scope (because it's empty)\n detachHead?: boolean;\n loose?: boolean; // relevant for --build, to allow build to succeed even if tasks like tests or lint fail\n // opt in to resolving each component's head on main from the REMOTE scope (via getHeadOnMain) when\n // merging from main, so a base that lives only on the remote is still merged. off by default: the\n // merge resolves heads from the local scope only (matches the historical behavior), so this remote\n // round-trip is paid solely by callers that explicitly need it, not every merge-from-main consumer.\n resolveMainHeadsFromRemote?: boolean;\n};\nexport type ConflictPerId = { id: ComponentID; files: string[]; config?: boolean; configConflict?: string };\n\nexport class MergeLanesMain {\n constructor(\n private workspace: Workspace | undefined,\n private merging: MergingMain,\n readonly lanes: LanesMain,\n readonly logger: Logger,\n private remove: RemoveMain,\n private scope: ScopeMain,\n private exporter: ExportMain,\n private importer: ImporterMain,\n private checkout: CheckoutMain\n ) {}\n\n async mergeLaneByCLI(laneName: string, options: MergeLaneOptions) {\n if (!this.workspace) {\n throw new BitError(`unable to merge a lane outside of Bit workspace`);\n }\n const currentLaneId = this.workspace.consumer.getCurrentLaneId();\n const otherLaneId = await this.workspace.consumer.getParsedLaneId(laneName);\n // Hidden lane updateDependents must participate in every merge — otherwise main→lane refresh\n // (`bit lane merge main`) leaves the lane's cascaded entries stuck on their old main-head\n // base, and lane→main merge would push a partially-consistent lane state. The bare-scope\n // counterpart (`bit _merge-lane`, used by Ripple / the UI's \"update lane\" button) already\n // sets this; the workspace path was the missing leg.\n if (options.shouldIncludeUpdateDependents === undefined) {\n options.shouldIncludeUpdateDependents = true;\n }\n return this.mergeLane(otherLaneId, currentLaneId, options);\n }\n\n /**\n * merge otherLaneId into currentLaneId\n */\n async mergeLane(\n otherLaneId: LaneId,\n currentLaneId: LaneId,\n options: MergeLaneOptions\n ): Promise<{\n mergeResults: ApplyVersionResults;\n deleteResults: any;\n configMergeResults: ConfigMergeResult[];\n mergedSuccessfullyIds: ComponentID[];\n conflicts: ConflictPerId[];\n }> {\n this.validateMergeFlags(otherLaneId, currentLaneId, options);\n const { currentLane, otherLane, laneToFetchArtifactsFrom, idsToMerge } = await this.resolveMergeContext(\n otherLaneId,\n currentLaneId,\n options\n );\n\n const {\n mergeStrategy,\n noAutoSnap,\n noSnap,\n tag,\n snapMessage,\n existingOnWorkspaceOnly,\n build,\n loose,\n keepReadme,\n squash,\n noSquash,\n pattern,\n includeDeps,\n skipDependencyInstallation,\n resolveUnrelated,\n ignoreConfigChanges,\n throwIfNotUpToDate,\n detachHead,\n } = options;\n const legacyScope = this.scope.legacyScope;\n const consumer = this.workspace?.consumer;\n\n if (throwIfNotUpToDate) await this.throwIfNotUpToDate(otherLaneId, currentLaneId);\n\n this.logger.debug(`merging the following ids: ${idsToMerge.toString()}`);\n\n const shouldSquash = squash || (currentLaneId.isDefault() && !noSquash);\n let allComponentsStatus = await this.merging.getMergeStatus(\n idsToMerge,\n {\n resolveUnrelated,\n ignoreConfigChanges,\n shouldSquash,\n mergeStrategy,\n handleTargetAheadAsDiverged: noSnap,\n detachHead,\n shouldMergeAspectsData: true,\n },\n currentLane,\n otherLane\n );\n\n if (pattern) {\n const componentIds = idsToMerge;\n const compIdsFromPattern = await (this.workspace || this.scope).filterIdsFromPoolIdsByPattern(\n pattern,\n componentIds\n );\n allComponentsStatus = await filterComponentsStatus(\n allComponentsStatus,\n compIdsFromPattern,\n idsToMerge,\n legacyScope,\n includeDeps,\n otherLane,\n shouldSquash\n );\n idsToMerge.forEach((bitId) => {\n if (!allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(bitId))) {\n allComponentsStatus.push({ id: bitId, unchangedLegitimately: true, unchangedMessage: `excluded by pattern` });\n }\n });\n }\n if (existingOnWorkspaceOnly && this.workspace) {\n const workspaceIds = this.workspace.listIds();\n const compIdsFromPattern = workspaceIds.filter((id) =>\n allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(id))\n );\n allComponentsStatus = await filterComponentsStatus(\n allComponentsStatus,\n compIdsFromPattern,\n idsToMerge,\n legacyScope,\n includeDeps,\n otherLane,\n shouldSquash\n );\n idsToMerge.forEach((bitId) => {\n if (!allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(bitId))) {\n allComponentsStatus.push({\n id: bitId,\n unchangedLegitimately: true,\n unchangedMessage: `not in the workspace`,\n });\n }\n });\n }\n\n throwForFailures(allComponentsStatus);\n\n const succeededComponents = allComponentsStatus.filter((c) => !c.unchangedMessage);\n if (shouldSquash) {\n await squashSnaps(succeededComponents, currentLaneId, otherLaneId, legacyScope, {\n messageTitle: options.snapMessage,\n detachHead,\n });\n }\n\n if (laneToFetchArtifactsFrom) {\n const ids = allComponentsStatus.map((c) => c.id);\n await this.importer.importHeadArtifactsFromLane(laneToFetchArtifactsFrom, ids, true);\n }\n\n const lastMerged = consumer ? new LastMerged(this.scope, consumer, this.logger) : undefined;\n const snapshot = await lastMerged?.takeSnapshot(currentLane);\n\n const mergeResults = await this.merging.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 shouldSquash,\n });\n\n if (snapshot) await lastMerged?.persistSnapshot(snapshot);\n\n const mergedSuccessfully =\n !mergeResults.failedComponents ||\n mergeResults.failedComponents.length === 0 ||\n mergeResults.failedComponents.every((failedComponent) => failedComponent.unchangedLegitimately);\n\n let deleteResults = {};\n\n if (!keepReadme && otherLane && otherLane.readmeComponent && mergedSuccessfully) {\n const readmeComponentId = otherLane.readmeComponent.id.changeVersion(otherLane.readmeComponent?.head?.hash);\n deleteResults = await this.remove.removeLocallyByIds([readmeComponentId], { reasonForRemoval: 'lane-merge' });\n } else if (otherLane && !otherLane.readmeComponent) {\n deleteResults = { readmeResult: '' };\n }\n const configMergeResults = compact(allComponentsStatus.map((c) => c.configMergeResult));\n\n const mergedSnapIds = ComponentIdList.fromArray(\n mergeResults.mergeSnapResults?.snappedComponents.map((c) => c.id) || []\n );\n const componentsWithConfigConflicts = configMergeResults.filter((c) => c.hasConflicts()).map((c) => c.compIdStr);\n const conflicts: ConflictPerId[] = [];\n const mergedSuccessfullyIds: ComponentID[] = [];\n mergeResults.components?.forEach((c) => {\n const files = Object.keys(c.filesStatus).filter(\n (f) => c.filesStatus[f] === FileStatus.manual || c.filesStatus[f] === FileStatus.binaryConflict\n );\n const config = componentsWithConfigConflicts.includes(c.id.toStringWithoutVersion());\n if (files.length || config) {\n conflicts.push({ id: c.id, files, config });\n } else {\n const snappedId = mergedSnapIds.searchWithoutVersion(c.id);\n mergedSuccessfullyIds.push(snappedId || c.id);\n }\n });\n\n // A merged head may reference — via its flattened dependencies — a non-head snap of another\n // component. When merging to main the squash removes intermediate snaps from each component's own\n // chain, and a bare-scope merge (`bit _merge-lane --push`) exports heads only; in both cases such a\n // referenced snap wouldn't be exported, and on lean lanes it lives only on the lane scope. Import\n // any missing one now so the export can ship it (otherwise the remote's dependency-integrity check\n // would reject the push). Not needed for non-squash workspace merges, which export full history.\n if (shouldSquash || !this.workspace) {\n await this.importMissingReferencedDeps(mergedSuccessfullyIds, otherLane);\n }\n\n await this.workspace?.consumer.onDestroy(`lane-merge (${otherLaneId.name})`);\n\n return { mergeResults, deleteResults, configMergeResults, mergedSuccessfullyIds, conflicts };\n }\n\n /**\n * A merged component head may reference, via its flattened dependencies, a non-head snap of another\n * component — e.g. a deleted component that keeps pinning an older snap of a dependency that has\n * since advanced. On lean lanes those snaps live only on the lane scope and are not fetched by the\n * merge, so the heads-only export (used by `bit _merge-lane --push`) would leave them out and the\n * remote's dependency-integrity check would fail. Import any such missing snap from the lane scope.\n */\n private async importMissingReferencedDeps(ids: ComponentID[], otherLane?: Lane) {\n // the missing snaps live on the lane scope (lean lanes). without the source lane we don't know\n // where to fetch them from, so there's nothing to do.\n if (!otherLane) return;\n const legacyScope = this.scope.legacyScope;\n // one existence check per unique hash — the same snap appears in the flattened list of many heads\n const checkedHashes = new Set<string>();\n const candidateRefs: Ref[] = [];\n await pMapSeries(ids, async (id) => {\n // strip the version — a versioned lookup (sources.get) returns undefined when that Version\n // object is missing locally, and only the model is needed here anyway (for its head).\n const modelComponent = await legacyScope.getModelComponentIfExist(id.changeVersion(undefined));\n const head = modelComponent?.head;\n if (!modelComponent || !head) return;\n const headVersion = await modelComponent.loadVersion(head.toString(), legacyScope.objects, false);\n if (!headVersion) return;\n // flattened (not only direct) to mirror the remote-side check, which validates the flattened\n // dependencies of every exported head (see throwForMissingLocalDependencies). cheap: only the\n // heads are loaded and each unique hash is stat-ed once.\n const flattenedDependencies = await headVersion.loadFlattenedDependencies(legacyScope.objects);\n flattenedDependencies.forEach((depId) => {\n // the remote check validates only same-scope deps (it skips `depId.scope !== scope.name`,\n // cross-scope deps are fetched later by the remote itself), so same-scope is all the export\n // needs to ship. this also filters out the vast majority of the flattened list.\n if (depId.scope !== id.scope) return;\n // only snaps can go missing this way — tags live on the home scope and are never squashed\n // off a lane. (a tag version is a semver string, not an object hash, so Ref.from would be\n // bogus for it anyway.)\n if (!depId.version || !isSnap(depId.version)) return;\n if (checkedHashes.has(depId.version)) return;\n checkedHashes.add(depId.version);\n candidateRefs.push(Ref.from(depId.version));\n });\n });\n // hasMultiple bounds the I/O concurrency, unlike a Promise.all of has() calls\n const existingRefs = await legacyScope.objects.hasMultiple(candidateRefs);\n const existingHashes = new Set(existingRefs.map((ref) => ref.toString()));\n const missingHashes = candidateRefs.map((ref) => ref.toString()).filter((hash) => !existingHashes.has(hash));\n if (!missingHashes.length) return;\n this.logger.debug(\n `importMissingReferencedDeps, importing ${missingHashes.length} non-head dependency snaps referenced by the merged heads from ${otherLane.scope}`\n );\n // fetch the raw objects only (by hash, from the lane scope). importManyObjects does not touch\n // component models/heads, so it can't leave a component pointing at a version whose object is\n // missing — unlike a component-level import.\n await legacyScope.scopeImporter.importManyObjects({ [otherLane.scope]: missingHashes });\n // a Version object references other objects the export must ship along with it — the file\n // sources and the flattened-edges/dependencies-graph. fetch the missing ones too. (parents are\n // not needed — the export doesn't collect them for these versions. artifacts are not needed\n // either — the export tolerates missing artifacts for such non-local versions.)\n const subRefs: Ref[] = [];\n await pMapSeries(missingHashes, async (hash) => {\n const versionObject = (await legacyScope.objects.load(Ref.from(hash))) as Version | null;\n if (!versionObject) return; // the hash could not be fetched after all\n versionObject.refsWithOptions(false, false).forEach((ref) => {\n if (checkedHashes.has(ref.toString())) return;\n checkedHashes.add(ref.toString());\n subRefs.push(ref);\n });\n });\n const existingSubRefs = new Set((await legacyScope.objects.hasMultiple(subRefs)).map((ref) => ref.toString()));\n const missingSubRefs = subRefs.map((ref) => ref.toString()).filter((hash) => !existingSubRefs.has(hash));\n if (!missingSubRefs.length) return;\n await legacyScope.scopeImporter.importManyObjects({ [otherLane.scope]: missingSubRefs });\n }\n\n private validateMergeFlags(otherLaneId: LaneId, currentLaneId: LaneId, options: MergeLaneOptions) {\n const { tag, resolveUnrelated, detachHead } = options;\n\n if (tag && !currentLaneId.isDefault()) {\n throw new BitError(`--tag only possible when on main. currently checked out to ${currentLaneId.toString()}`);\n }\n if (otherLaneId.isEqual(currentLaneId)) {\n throw new BitError(\n `unable to merge lane \"${otherLaneId.toString()}\", you're already at this lane. to get updates, simply run \"bit checkout head\"`\n );\n }\n if (resolveUnrelated && currentLaneId.isDefault()) {\n throw new BitError(\n `unable to resolve unrelated when on main. switch to ${otherLaneId.toString()} and run \"bit lane merge main --resolve-unrelated\"`\n );\n }\n if (detachHead && !currentLaneId.isDefault()) {\n throw new BitError(`unable to detach head. the current lane is not main`);\n }\n }\n\n private async resolveMergeContext(otherLaneId: LaneId, currentLaneId: LaneId, options: Partial<MergeLaneOptions>) {\n const { skipFetch, excludeNonLaneComps, shouldIncludeUpdateDependents, fetchCurrent } = options;\n const legacyScope = this.scope.legacyScope;\n if (fetchCurrent && !currentLaneId.isDefault()) {\n // if current is default, it'll be fetch later on\n await this.lanes.fetchLaneWithItsComponents(currentLaneId);\n }\n const currentLane = currentLaneId.isDefault() ? undefined : await legacyScope.loadLane(currentLaneId);\n const isDefaultLane = otherLaneId.isDefault();\n if (isDefaultLane) {\n if (!skipFetch) {\n // pass `shouldIncludeUpdateDependents` so the prefetch covers main objects for the\n // lane's hidden entries too — the per-component merge engine needs main-side Version\n // objects locally to compute divergence against the hidden cascade snaps.\n const ids = await this.getMainIdsToMerge(currentLane, !excludeNonLaneComps, shouldIncludeUpdateDependents);\n const compIdList = ComponentIdList.fromArray(ids).toVersionLatest();\n await this.importer.importObjectsFromMainIfExist(compIdList);\n }\n }\n let laneToFetchArtifactsFrom: Lane | undefined;\n const getOtherLane = async () => {\n let lane = await legacyScope.loadLane(otherLaneId);\n const shouldFetch = !lane || (!skipFetch && !lane.isNew);\n if (shouldFetch) {\n // don't assign `lane` to the result of this command. otherwise, if you have local snaps, it'll ignore them and use the remote-lane.\n // note: fetching always includes the lane's hidden updateDependents (and routes them to the\n // lane's scope); `shouldIncludeUpdateDependents` still governs whether they take part in the\n // merge itself, via `idsToMerge` below.\n const otherLane = await this.lanes.fetchLaneWithItsComponents(otherLaneId);\n laneToFetchArtifactsFrom = otherLane;\n lane = await legacyScope.loadLane(otherLaneId);\n }\n return lane;\n };\n const otherLane = isDefaultLane ? undefined : await getOtherLane();\n if (fetchCurrent && otherLane && currentLaneId.isDefault()) {\n const ids = await this.getMainIdsToMerge(otherLane, false, shouldIncludeUpdateDependents);\n const compIdList = ComponentIdList.fromArray(ids).toVersionLatest();\n await this.importer.importObjectsFromMainIfExist(compIdList);\n }\n const getBitIds = async () => {\n if (isDefaultLane) {\n const ids = await this.getMainIdsToMerge(currentLane, !excludeNonLaneComps, shouldIncludeUpdateDependents);\n if (options.resolveMainHeadsFromRemote) {\n // opt-in: resolve each head on main falling back to the remote scope, so a base that lives on\n // the remote but wasn't fetched locally is still included instead of being skipped. a component\n // with no head on main at all is genuinely new and dropped.\n const idsWithHead = await Promise.all(\n ids.map(async (id) => {\n const head = await this.lanes.getHeadOnMain(id);\n return head ? id.changeVersion(head) : null;\n })\n );\n return compact(idsWithHead);\n }\n // default: resolve heads from the local scope only (historical behavior). a component not in the\n // local scope throws, and one with no local head was never merged to main and is dropped.\n const modelComponents = await Promise.all(ids.map((id) => this.scope.legacyScope.getModelComponent(id)));\n return compact(\n modelComponents.map((c) => {\n if (!c.head) return null; // probably the component was never merged to main\n return c.toComponentId().changeVersion(c.head.toString());\n })\n );\n }\n if (!otherLane) throw new Error(`lane must be defined for non-default`);\n return shouldIncludeUpdateDependents\n ? otherLane.toComponentIdsIncludeUpdateDependents()\n : otherLane.toComponentIds();\n };\n const idsToMerge = await getBitIds();\n\n return {\n currentLane,\n otherLane,\n laneToFetchArtifactsFrom,\n idsToMerge,\n };\n }\n\n /**\n * check conflicts in case of merging sourceLaneId into targetLaneId\n */\n async checkLaneForConflicts(\n sourceLaneIdStr: string,\n targetLaneIdStr: string,\n options: Partial<MergeLaneOptions>\n ): Promise<{\n conflicts: ConflictPerId[];\n }> {\n const legacyScope = this.scope.legacyScope;\n const otherLaneId: LaneId = await legacyScope.lanes.parseLaneIdFromString(sourceLaneIdStr);\n const currentLaneId: LaneId = await legacyScope.lanes.parseLaneIdFromString(targetLaneIdStr);\n options.excludeNonLaneComps = true;\n const { currentLane, otherLane, idsToMerge } = await this.resolveMergeContext(otherLaneId, currentLaneId, options);\n\n const allComponentsStatus = await this.merging.getMergeStatus(\n idsToMerge,\n {\n mergeStrategy: 'manual',\n },\n currentLane,\n otherLane\n );\n\n throwForFailures(allComponentsStatus);\n\n const configMergeResults = compact(allComponentsStatus.map((c) => c.configMergeResult));\n const componentsWithConfigConflicts = configMergeResults.filter((c) => c.hasConflicts()).map((c) => c.compIdStr);\n const conflicts: ConflictPerId[] = [];\n allComponentsStatus.forEach((c) => {\n const files = c.mergeResults?.modifiedFiles.filter((f) => f.conflict || f.isBinaryConflict) || [];\n const config = componentsWithConfigConflicts.includes(c.id.toStringWithoutVersion());\n if (files.length || config) {\n const configData = configMergeResults.find((co) => co.compIdStr === c.id.toStringWithoutVersion());\n const configConflict = configData?.generateMergeConflictFile() || undefined;\n conflicts.push({ id: c.id, files: files.map((f) => f.filePath), config, configConflict });\n }\n });\n\n return { conflicts };\n }\n\n async mergeMove(newLaneName: string, options: { scope?: string }) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const lastMerge = new LastMerged(this.scope, this.workspace.consumer, this.logger);\n await lastMerge.restoreLaneObjectFromLastMerged();\n const newLaneResult = await this.lanes.createLane(newLaneName, { scope: options.scope });\n return newLaneResult;\n }\n\n async abortLaneMerge(checkoutProps: CheckoutProps, mergeAbortOpts: MergeAbortOpts) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const lastMerge = new LastMerged(this.scope, this.workspace.consumer, this.logger);\n const currentLane = await this.lanes.getCurrentLane();\n const { compDirsToRemove } = await lastMerge.restoreFromLastMerged(mergeAbortOpts, currentLane);\n\n await this.workspace._reloadConsumer();\n\n this.workspace.consumer.scope.objects.unmergedComponents.removeAllComponents();\n await this.workspace.consumer.scope.objects.unmergedComponents.write();\n\n const configMergeFile = this.workspace.getConflictMergeFile();\n await configMergeFile.delete();\n\n let checkoutResults: ApplyVersionResults | undefined;\n let checkoutError: Error | undefined;\n checkoutProps.ids = this.workspace.listIds();\n checkoutProps.restoreMissingComponents = true;\n try {\n checkoutResults = await this.checkout.checkout(checkoutProps);\n } catch (err: any) {\n this.logger.error(`merge-abort got an error during the checkout stage`, err);\n checkoutError = err;\n }\n\n const restoredItems = [\n `${path.basename(this.workspace.consumer.bitMap.mapPath)} file`,\n `${path.basename(this.workspace.consumer.config.path)} file`,\n ];\n if (compDirsToRemove.length) {\n restoredItems.push(`deleted components directories: ${compDirsToRemove.join(', ')}`);\n }\n if (currentLane) {\n restoredItems.push(`${currentLane.id()} lane object`);\n }\n\n return { checkoutResults, restoredItems, checkoutError };\n }\n\n private async getMainIdsToMerge(lane?: Lane | null, includeNonLaneComps = true, includeUpdateDependents = false) {\n if (!lane) throw new Error(`unable to merge ${DEFAULT_LANE}, the current lane was not found`);\n const laneIds = includeUpdateDependents ? lane.toComponentIdsIncludeUpdateDependents() : lane.toComponentIds();\n const ids = laneIds.filter((id) => this.scope.isExported(id));\n if (includeNonLaneComps) {\n if (!this.workspace) {\n throw new BitError(`getMainIdsToMerge needs workspace`);\n }\n const workspaceIds = this.workspace.listIds();\n const mainNotOnLane = workspaceIds.filter(\n (id) => !laneIds.find((laneId) => laneId.isEqualWithoutVersion(id)) && this.scope.isExported(id)\n );\n ids.push(...mainNotOnLane);\n }\n return ids;\n }\n\n private async throwIfNotUpToDate(fromLaneId: LaneId, toLaneId: LaneId) {\n const status = await this.lanes.diffStatus(fromLaneId, toLaneId, { skipChanges: true });\n const compsNotUpToDate = status.componentsStatus.filter((s) => !s.upToDate);\n if (compsNotUpToDate.length) {\n throw new Error(`unable to merge, the following components are not up-to-date:\n${compsNotUpToDate.map((s) => s.componentId.toString()).join('\\n')}`);\n }\n }\n\n static slots = [];\n static dependencies = [\n LanesAspect,\n CLIAspect,\n WorkspaceAspect,\n MergingAspect,\n LoggerAspect,\n RemoveAspect,\n ScopeAspect,\n ExportAspect,\n ImporterAspect,\n CheckoutAspect,\n ConfigStoreAspect,\n ExpressAspect,\n ];\n static runtime = MainRuntime;\n\n static async provider([\n lanes,\n cli,\n workspace,\n merging,\n loggerMain,\n remove,\n scope,\n exporter,\n importer,\n checkout,\n configStore,\n express,\n ]: [\n LanesMain,\n CLIMain,\n Workspace,\n MergingMain,\n LoggerMain,\n RemoveMain,\n ScopeMain,\n ExportMain,\n ImporterMain,\n CheckoutMain,\n ConfigStoreMain,\n ExpressMain,\n ]) {\n const logger = loggerMain.createLogger(MergeLanesAspect.id);\n const lanesCommand = cli.getCommand('lane');\n const mergeLanesMain = new MergeLanesMain(\n workspace,\n merging,\n lanes,\n logger,\n remove,\n scope,\n exporter,\n importer,\n checkout\n );\n lanesCommand?.commands?.push(new MergeLaneCmd(mergeLanesMain, configStore));\n lanesCommand?.commands?.push(new MergeAbortLaneCmd(mergeLanesMain));\n lanesCommand?.commands?.push(new MergeMoveLaneCmd(mergeLanesMain));\n express.register([new LanesCheckConflictsRoute(mergeLanesMain, logger)]);\n return mergeLanesMain;\n }\n}\n\nasync function filterComponentsStatus(\n allComponentsStatus: ComponentMergeStatus[],\n compIdsToKeep: ComponentID[],\n allBitIds: ComponentID[],\n legacyScope: LegacyScope,\n includeDeps = false,\n otherLane?: Lane, // lane that gets merged into the current lane. if not provided, it's main that gets merged into the current lane\n shouldSquash?: boolean\n): Promise<ComponentMergeStatus[]> {\n const bitIdsFromPattern = ComponentIdList.fromArray(compIdsToKeep);\n const bitIdsNotFromPattern = allBitIds.filter((bitId) => !bitIdsFromPattern.hasWithoutVersion(bitId));\n const filteredComponentStatus: ComponentMergeStatus[] = [];\n const depsToAdd: ComponentID[] = [];\n const missingDepsFromHead = {};\n const missingDepsFromHistory: string[] = [];\n\n const versionsToCheckPerId = await pMapSeries(compIdsToKeep, async (compId) => {\n const fromStatus = allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(compId));\n if (!fromStatus) {\n throw new Error(`filterComponentsStatus: unable to find ${compId.toString()} in component-status`);\n }\n filteredComponentStatus.push(fromStatus);\n if (fromStatus.unchangedMessage) {\n return undefined;\n }\n if (!otherLane) {\n // if merging main, no need to check whether the deps are included in the pattern.\n return undefined;\n }\n const { divergeData } = fromStatus;\n if (!divergeData) {\n throw new Error(`filterComponentsStatus: unable to find divergeData for ${compId.toString()}`);\n }\n let targetVersions: Ref[] = divergeData.snapsOnTargetOnly;\n if (!targetVersions.length) {\n return undefined;\n }\n const modelComponent = await legacyScope.getModelComponent(compId);\n if (shouldSquash) {\n // no need to check all versions, we merge only the head\n const headOnTarget = otherLane ? otherLane.getCompHeadIncludeUpdateDependents(compId) : modelComponent.head;\n if (!headOnTarget) {\n throw new Error(`filterComponentsStatus: unable to find head for ${compId.toString()}`);\n }\n targetVersions = [headOnTarget];\n }\n\n return { compId, targetVersions, modelComponent };\n });\n\n // all these versions needs to be imported to load them later and check whether they have dependencies on the target lane\n const toImport = compact(versionsToCheckPerId)\n .map((c) => c.targetVersions.map((v) => c.compId.changeVersion(v.toString())))\n .flat();\n await legacyScope.scopeImporter.importWithoutDeps(ComponentIdList.fromArray(toImport), {\n lane: otherLane,\n cache: true,\n includeVersionHistory: false,\n reason: 'import all history of given patterns components to check whether they have dependencies on the lane',\n });\n\n await pMapSeries(compact(versionsToCheckPerId), async ({ compId, targetVersions, modelComponent }) => {\n await pMapSeries(targetVersions, async (remoteVersion) => {\n const versionObj = await modelComponent.loadVersion(remoteVersion.toString(), legacyScope.objects);\n const flattenedDeps = await versionObj.loadFlattenedDependencies(legacyScope.objects);\n const depsNotIncludeInPattern = flattenedDeps.filter((id) =>\n bitIdsNotFromPattern.find((bitId) => bitId.isEqualWithoutVersion(id))\n );\n if (!depsNotIncludeInPattern.length) {\n return;\n }\n const depsOnLane: ComponentID[] = [];\n await Promise.all(\n depsNotIncludeInPattern.map(async (dep) => {\n const isOnLane = await legacyScope.isIdOnLane(dep, otherLane);\n if (isOnLane) {\n depsOnLane.push(dep);\n }\n })\n );\n if (!depsOnLane.length) {\n return;\n }\n if (includeDeps) {\n depsToAdd.push(...depsOnLane);\n } else {\n const headOnTarget = otherLane ? otherLane.getCompHeadIncludeUpdateDependents(compId) : modelComponent.head;\n const depsOnLaneStr = depsOnLane.map((dep) => dep.toStringWithoutVersion());\n if (headOnTarget?.isEqual(remoteVersion)) {\n depsOnLaneStr.forEach((dep) => {\n (missingDepsFromHead[dep] ||= []).push(compId.toStringWithoutVersion());\n });\n } else {\n missingDepsFromHistory.push(...depsOnLaneStr);\n }\n }\n });\n });\n if (Object.keys(missingDepsFromHead).length || missingDepsFromHistory.length) {\n throw new MissingCompsToMerge(missingDepsFromHead, uniq(missingDepsFromHistory));\n }\n\n if (depsToAdd.length) {\n // remove the version, otherwise, the uniq gives duplicate components with different versions.\n const depsWithoutVersion = depsToAdd.map((d) => d.changeVersion(undefined));\n const depsUniqWithoutVersion = ComponentIdList.uniqFromArray(depsWithoutVersion);\n depsUniqWithoutVersion.forEach((id) => {\n const fromStatus = allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(id));\n if (!fromStatus) {\n throw new Error(`filterComponentsStatus: unable to find ${id.toString()} in component-status`);\n }\n filteredComponentStatus.push(fromStatus);\n });\n }\n return filteredComponentStatus;\n}\n\nasync function squashSnaps(\n succeededComponents: ComponentMergeStatus[],\n currentLaneId: LaneId,\n otherLaneId: LaneId,\n scope: LegacyScope,\n opts: { messageTitle?: string; detachHead?: boolean } = {}\n) {\n const currentLaneName = currentLaneId.name;\n const log = await getLogForSquash(otherLaneId);\n\n await Promise.all(\n succeededComponents.map(async ({ id, divergeData, componentFromModel }) => {\n if (!divergeData) {\n throw new Error(`unable to squash. divergeData is missing from ${id.toString()}`);\n }\n\n const modifiedComp = await squashOneComp(\n currentLaneName,\n otherLaneId,\n id,\n divergeData,\n log,\n scope,\n componentFromModel,\n opts\n );\n if (modifiedComp) {\n scope.objects.add(modifiedComp);\n const modelComponent = await scope.getModelComponent(id);\n const versionHistory = await modelComponent.updateRebasedVersionHistory(scope.objects, [modifiedComp]);\n if (versionHistory) scope.objects.add(versionHistory);\n }\n })\n );\n}\n\n/**\n * returns Version object if it was modified. otherwise, returns undefined\n */\nasync function squashOneComp(\n currentLaneName: string,\n otherLaneId: LaneId,\n id: ComponentID,\n divergeData: SnapsDistance,\n log: Log,\n scope: LegacyScope,\n componentFromModel?: Version,\n opts: { messageTitle?: string; detachHead?: boolean } = {}\n): Promise<Version | undefined> {\n const { messageTitle, detachHead } = opts;\n const shouldSquash = () => {\n if (divergeData.isDiverged()) {\n if (detachHead) {\n // for detach head, it's ok to have it as diverged. as long as the target is ahead, we want to squash.\n return true;\n }\n // diverged + --squash: skip the parent-rewrite path here. the merge snap will be created\n // by snapForMerge with a single parent (and squashed metadata) because the corresponding\n // UnmergedComponent entry has `shouldSquash: true`. see snapping.main.runtime.ts.\n return false;\n }\n if (divergeData.isSourceAhead()) {\n // nothing to do. current is ahead, nothing to merge. (it was probably filtered out already as a \"failedComponent\")\n return false;\n }\n if (!divergeData.isTargetAhead()) {\n // nothing to do. current and remote are the same, nothing to merge. (it was probably filtered out already as a \"failedComponent\")\n return false;\n }\n return true;\n };\n\n if (!shouldSquash()) {\n return undefined;\n }\n\n // remote is ahead and was not diverge.\n const remoteSnaps = divergeData.snapsOnTargetOnly;\n if (remoteSnaps.length === 0) {\n throw new Error(`remote is ahead but it has no snaps. it's impossible`);\n }\n const getAllMessages = async () => {\n if (!messageTitle) return [];\n await scope.scopeImporter.importManyObjects({ [otherLaneId.scope]: remoteSnaps.map((s) => s.toString()) });\n const versionObjects = (await Promise.all(remoteSnaps.map((s) => scope.objects.load(s)))) as Version[];\n return compact(versionObjects).map((v) => v.log.message);\n };\n const getFinalMessage = async (): Promise<string | undefined> => {\n if (!messageTitle) return undefined;\n const allMessage = await getAllMessages();\n const allMessageStr = compact(allMessage)\n .map((m) => `[*] ${m}`)\n .join('\\n');\n return `${messageTitle}\\n${allMessageStr}`;\n };\n if (!componentFromModel) {\n throw new Error('unable to squash, the componentFromModel is missing');\n }\n const currentParents = componentFromModel.parents;\n\n // if the remote has only one snap, there is nothing to squash.\n // other checks here is to make sure `componentFromModel.addAsOnlyParent` call is not needed.\n if (remoteSnaps.length === 1 && divergeData.commonSnapBeforeDiverge && currentParents.length === 1) {\n return undefined;\n }\n\n const doSquash = async () => {\n if (divergeData.commonSnapBeforeDiverge) {\n componentFromModel.addAsOnlyParent(divergeData.commonSnapBeforeDiverge);\n return;\n }\n if (currentLaneName !== DEFAULT_LANE) {\n // when squashing into lane, we have to take main into account\n const modelComponent = await scope.getModelComponentIfExist(id);\n if (!modelComponent) throw new Error(`missing ModelComponent for ${id.toString()}`);\n if (modelComponent.head) {\n componentFromModel.addAsOnlyParent(modelComponent.head);\n return;\n }\n }\n // there is no commonSnapBeforeDiverge. the local has no snaps, all are remote, no need for parents. keep only head.\n componentFromModel.parents.forEach((ref) => componentFromModel.removeParent(ref));\n };\n\n await doSquash();\n\n const finalMessage = await getFinalMessage();\n componentFromModel.setSquashed({ previousParents: currentParents, laneId: otherLaneId }, log, finalMessage);\n return componentFromModel;\n}\n\nMergeLanesAspect.addRuntime(MergeLanesMain);\n\nexport default MergeLanesMain;\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA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AQ,CAAC,CAAC;EAEhB,MAAMG,YAAY,GAAG,MAAMV,eAAe,CAAC,CAAC;EAC5CZ,kBAAkB,CAACuB,WAAW,CAAC;IAAEC,eAAe,EAAER,cAAc;IAAEpG,MAAM,EAAE1N;EAAY,CAAC,EAAE4S,GAAG,EAAEwB,YAAY,CAAC;EAC3G,OAAOtB,kBAAkB;AAC3B;AAEAnE,8BAAgB,CAAC4F,UAAU,CAACzV,cAAc,CAAC;AAAC,IAAA0V,QAAA,GAAAnF,OAAA,CAAA1R,OAAA,GAE7BmB,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_bitError","data","require","_path","_interopRequireDefault","_harmonyModules","_cli","_importer","_lanes","_merging","_componentModules","_workspace","_configStore","_harmonyModules2","_componentId","_objects","_componentVersion","_pMapSeries","_scope","_laneId","_logger","_checkout","_remove","_lodash","_export","_mergeLanes","_mergeLane","_missingCompsToMerge","_mergeAbort","_lastMerged","_mergeMove","_express","_lanesCheckConflicts","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MergeLanesMain","constructor","workspace","merging","lanes","logger","remove","scope","exporter","importer","checkout","mergeLaneByCLI","laneName","options","BitError","currentLaneId","consumer","getCurrentLaneId","otherLaneId","getParsedLaneId","shouldIncludeUpdateDependents","undefined","mergeLane","validateMergeFlags","currentLane","otherLane","laneToFetchArtifactsFrom","idsToMerge","resolveMergeContext","mergeStrategy","noAutoSnap","noSnap","tag","snapMessage","existingOnWorkspaceOnly","build","loose","keepReadme","squash","noSquash","pattern","includeDeps","skipDependencyInstallation","resolveUnrelated","ignoreConfigChanges","throwIfNotUpToDate","detachHead","legacyScope","debug","toString","shouldSquash","isDefault","allComponentsStatus","getMergeStatus","handleTargetAheadAsDiverged","shouldMergeAspectsData","componentIds","compIdsFromPattern","filterIdsFromPoolIdsByPattern","filterComponentsStatus","forEach","bitId","find","c","id","isEqualWithoutVersion","push","unchangedLegitimately","unchangedMessage","workspaceIds","listIds","filter","throwForFailures","succeededComponents","squashSnaps","messageTitle","ids","map","importHeadArtifactsFromLane","lastMerged","LastMerged","snapshot","takeSnapshot","mergeResults","mergeSnaps","persistSnapshot","mergedSuccessfully","failedComponents","length","every","failedComponent","deleteResults","readmeComponent","readmeComponentId","changeVersion","head","hash","removeLocallyByIds","reasonForRemoval","readmeResult","configMergeResults","compact","configMergeResult","mergedSnapIds","ComponentIdList","fromArray","mergeSnapResults","snappedComponents","componentsWithConfigConflicts","hasConflicts","compIdStr","conflicts","mergedSuccessfullyIds","components","files","keys","filesStatus","f","FileStatus","manual","binaryConflict","config","includes","toStringWithoutVersion","snappedId","searchWithoutVersion","importMissingReferencedDeps","onDestroy","name","checkedHashes","Set","candidateRefs","pMapSeries","modelComponent","getModelComponentIfExist","headVersion","loadVersion","objects","flattenedDependencies","loadFlattenedDependencies","depId","version","isSnap","has","add","Ref","from","existingRefs","hasMultiple","existingHashes","ref","missingHashes","scopeImporter","importManyObjects","subRefs","versionObject","load","refsWithOptions","existingSubRefs","missingSubRefs","isEqual","skipFetch","excludeNonLaneComps","fetchCurrent","fetchLaneWithItsComponents","loadLane","isDefaultLane","getMainIdsToMerge","compIdList","toVersionLatest","importObjectsFromMainIfExist","getOtherLane","lane","shouldFetch","isNew","getBitIds","resolveMainHeadsFromRemote","idsWithHead","Promise","all","getHeadOnMain","modelComponents","getModelComponent","toComponentId","Error","toComponentIdsIncludeUpdateDependents","toComponentIds","checkLaneForConflicts","sourceLaneIdStr","targetLaneIdStr","parseLaneIdFromString","modifiedFiles","conflict","isBinaryConflict","configData","co","configConflict","generateMergeConflictFile","filePath","mergeMove","newLaneName","OutsideWorkspaceError","lastMerge","restoreLaneObjectFromLastMerged","newLaneResult","createLane","abortLaneMerge","checkoutProps","mergeAbortOpts","getCurrentLane","compDirsToRemove","restoreFromLastMerged","_reloadConsumer","unmergedComponents","removeAllComponents","write","configMergeFile","getConflictMergeFile","delete","checkoutResults","checkoutError","restoreMissingComponents","err","error","restoredItems","path","basename","bitMap","mapPath","join","includeNonLaneComps","includeUpdateDependents","DEFAULT_LANE","laneIds","isExported","mainNotOnLane","laneId","fromLaneId","toLaneId","status","diffStatus","skipChanges","compsNotUpToDate","componentsStatus","s","upToDate","componentId","provider","cli","loggerMain","configStore","express","createLogger","MergeLanesAspect","lanesCommand","getCommand","mergeLanesMain","commands","MergeLaneCmd","MergeAbortLaneCmd","MergeMoveLaneCmd","register","LanesCheckConflictsRoute","exports","LanesAspect","CLIAspect","WorkspaceAspect","MergingAspect","LoggerAspect","RemoveAspect","ScopeAspect","ExportAspect","ImporterAspect","CheckoutAspect","ConfigStoreAspect","ExpressAspect","MainRuntime","compIdsToKeep","allBitIds","bitIdsFromPattern","bitIdsNotFromPattern","hasWithoutVersion","filteredComponentStatus","depsToAdd","missingDepsFromHead","missingDepsFromHistory","versionsToCheckPerId","compId","fromStatus","divergeData","targetVersions","snapsOnTargetOnly","headOnTarget","getCompHeadIncludeUpdateDependents","toImport","v","flat","importWithoutDeps","cache","includeVersionHistory","reason","remoteVersion","versionObj","flattenedDeps","depsNotIncludeInPattern","depsOnLane","dep","isOnLane","isIdOnLane","depsOnLaneStr","MissingCompsToMerge","uniq","depsWithoutVersion","d","depsUniqWithoutVersion","uniqFromArray","opts","currentLaneName","log","getLogForSquash","componentFromModel","modifiedComp","squashOneComp","versionHistory","updateRebasedVersionHistory","isDiverged","isSourceAhead","isTargetAhead","remoteSnaps","getAllMessages","versionObjects","message","getFinalMessage","allMessage","allMessageStr","m","currentParents","parents","commonSnapBeforeDiverge","doSquash","addAsOnlyParent","removeParent","finalMessage","setSquashed","previousParents","addRuntime","_default"],"sources":["merge-lanes.main.runtime.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport path from 'path';\nimport type { CLIMain } from '@teambit/cli';\nimport { MainRuntime } from '@teambit/harmony.modules.runtimes';\nimport { CLIAspect } from '@teambit/cli';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport type { LanesMain } from '@teambit/lanes';\nimport { LanesAspect } from '@teambit/lanes';\nimport type { MergingMain, ComponentMergeStatus } from '@teambit/merging';\nimport type { ApplyVersionResults, MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { MergingAspect } from '@teambit/merging';\nimport { FileStatus } from '@teambit/component.modules.merge-helper';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport type { ConfigStoreMain } from '@teambit/config-store';\nimport { ConfigStoreAspect } from '@teambit/config-store';\nimport { getLogForSquash } from '@teambit/harmony.modules.get-basic-log';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { Lane, Version, Log } from '@teambit/objects';\nimport { Ref } from '@teambit/objects';\nimport { isSnap } from '@teambit/component-version';\nimport pMapSeries from 'p-map-series';\nimport type { Scope as LegacyScope } from '@teambit/legacy.scope';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { LaneId } from '@teambit/lane-id';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport type { ConfigMergeResult } from '@teambit/config-merger';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { CheckoutMain, CheckoutProps } from '@teambit/checkout';\nimport { CheckoutAspect, throwForFailures } from '@teambit/checkout';\nimport type { SnapsDistance } from '@teambit/component.snap-distance';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect } from '@teambit/remove';\nimport { compact, uniq } from 'lodash';\nimport type { ExportMain } from '@teambit/export';\nimport { ExportAspect } from '@teambit/export';\nimport { MergeLanesAspect } from './merge-lanes.aspect';\nimport { MergeLaneCmd } from './merge-lane.cmd';\nimport { MissingCompsToMerge } from './exceptions/missing-comps-to-merge';\nimport type { MergeAbortOpts } from './merge-abort.cmd';\nimport { MergeAbortLaneCmd } from './merge-abort.cmd';\nimport { LastMerged } from './last-merged';\nimport { MergeMoveLaneCmd } from './merge-move.cmd';\nimport type { ExpressMain } from '@teambit/express';\nimport { ExpressAspect } from '@teambit/express';\nimport { LanesCheckConflictsRoute } from './lanes-check-conflicts.route';\n\nexport type MergeLaneOptions = {\n mergeStrategy: MergeStrategy;\n ours?: boolean;\n theirs?: boolean;\n noAutoSnap?: boolean;\n noSnap?: boolean;\n snapMessage?: string;\n existingOnWorkspaceOnly?: boolean;\n build?: boolean;\n keepReadme?: boolean;\n squash?: boolean;\n noSquash?: boolean;\n tag?: boolean;\n pattern?: string;\n includeDeps?: boolean;\n skipDependencyInstallation?: boolean;\n resolveUnrelated?: MergeStrategy;\n ignoreConfigChanges?: boolean;\n skipFetch?: boolean;\n excludeNonLaneComps?: boolean;\n shouldIncludeUpdateDependents?: boolean;\n throwIfNotUpToDate?: boolean; // relevant when merging from a scope\n fetchCurrent?: boolean; // needed when merging from a bare-scope (because it's empty)\n detachHead?: boolean;\n loose?: boolean; // relevant for --build, to allow build to succeed even if tasks like tests or lint fail\n // opt in to resolving each component's head on main from the REMOTE scope (via getHeadOnMain) when\n // merging from main, so a base that lives only on the remote is still merged. off by default: the\n // merge resolves heads from the local scope only (matches the historical behavior), so this remote\n // round-trip is paid solely by callers that explicitly need it, not every merge-from-main consumer.\n resolveMainHeadsFromRemote?: boolean;\n};\nexport type ConflictPerId = { id: ComponentID; files: string[]; config?: boolean; configConflict?: string };\n\nexport class MergeLanesMain {\n constructor(\n private workspace: Workspace | undefined,\n private merging: MergingMain,\n readonly lanes: LanesMain,\n readonly logger: Logger,\n private remove: RemoveMain,\n private scope: ScopeMain,\n private exporter: ExportMain,\n private importer: ImporterMain,\n private checkout: CheckoutMain\n ) {}\n\n async mergeLaneByCLI(laneName: string, options: MergeLaneOptions) {\n if (!this.workspace) {\n throw new BitError(`unable to merge a lane outside of Bit workspace`);\n }\n const currentLaneId = this.workspace.consumer.getCurrentLaneId();\n const otherLaneId = await this.workspace.consumer.getParsedLaneId(laneName);\n // Hidden lane updateDependents must participate in every merge — otherwise main→lane refresh\n // (`bit lane merge main`) leaves the lane's cascaded entries stuck on their old main-head\n // base, and lane→main merge would push a partially-consistent lane state. The bare-scope\n // counterpart (`bit _merge-lane`, used by Ripple / the UI's \"update lane\" button) already\n // sets this; the workspace path was the missing leg.\n if (options.shouldIncludeUpdateDependents === undefined) {\n options.shouldIncludeUpdateDependents = true;\n }\n return this.mergeLane(otherLaneId, currentLaneId, options);\n }\n\n /**\n * merge otherLaneId into currentLaneId\n */\n async mergeLane(\n otherLaneId: LaneId,\n currentLaneId: LaneId,\n options: MergeLaneOptions\n ): Promise<{\n mergeResults: ApplyVersionResults;\n deleteResults: any;\n configMergeResults: ConfigMergeResult[];\n mergedSuccessfullyIds: ComponentID[];\n conflicts: ConflictPerId[];\n }> {\n this.validateMergeFlags(otherLaneId, currentLaneId, options);\n const { currentLane, otherLane, laneToFetchArtifactsFrom, idsToMerge } = await this.resolveMergeContext(\n otherLaneId,\n currentLaneId,\n options\n );\n\n const {\n mergeStrategy,\n noAutoSnap,\n noSnap,\n tag,\n snapMessage,\n existingOnWorkspaceOnly,\n build,\n loose,\n keepReadme,\n squash,\n noSquash,\n pattern,\n includeDeps,\n skipDependencyInstallation,\n resolveUnrelated,\n ignoreConfigChanges,\n throwIfNotUpToDate,\n detachHead,\n } = options;\n const legacyScope = this.scope.legacyScope;\n const consumer = this.workspace?.consumer;\n\n if (throwIfNotUpToDate) await this.throwIfNotUpToDate(otherLaneId, currentLaneId);\n\n this.logger.debug(`merging the following ids: ${idsToMerge.toString()}`);\n\n const shouldSquash = squash || (currentLaneId.isDefault() && !noSquash);\n let allComponentsStatus = await this.merging.getMergeStatus(\n idsToMerge,\n {\n resolveUnrelated,\n ignoreConfigChanges,\n shouldSquash,\n mergeStrategy,\n handleTargetAheadAsDiverged: noSnap,\n detachHead,\n shouldMergeAspectsData: true,\n },\n currentLane,\n otherLane\n );\n\n if (pattern) {\n const componentIds = idsToMerge;\n const compIdsFromPattern = await (this.workspace || this.scope).filterIdsFromPoolIdsByPattern(\n pattern,\n componentIds\n );\n allComponentsStatus = await filterComponentsStatus(\n allComponentsStatus,\n compIdsFromPattern,\n idsToMerge,\n legacyScope,\n includeDeps,\n otherLane,\n shouldSquash\n );\n idsToMerge.forEach((bitId) => {\n if (!allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(bitId))) {\n allComponentsStatus.push({ id: bitId, unchangedLegitimately: true, unchangedMessage: `excluded by pattern` });\n }\n });\n }\n if (existingOnWorkspaceOnly && this.workspace) {\n const workspaceIds = this.workspace.listIds();\n const compIdsFromPattern = workspaceIds.filter((id) =>\n allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(id))\n );\n allComponentsStatus = await filterComponentsStatus(\n allComponentsStatus,\n compIdsFromPattern,\n idsToMerge,\n legacyScope,\n includeDeps,\n otherLane,\n shouldSquash\n );\n idsToMerge.forEach((bitId) => {\n if (!allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(bitId))) {\n allComponentsStatus.push({\n id: bitId,\n unchangedLegitimately: true,\n unchangedMessage: `not in the workspace`,\n });\n }\n });\n }\n\n throwForFailures(allComponentsStatus);\n\n const succeededComponents = allComponentsStatus.filter((c) => !c.unchangedMessage);\n if (shouldSquash) {\n await squashSnaps(succeededComponents, currentLaneId, otherLaneId, legacyScope, {\n messageTitle: options.snapMessage,\n detachHead,\n });\n }\n\n if (laneToFetchArtifactsFrom) {\n const ids = allComponentsStatus.map((c) => c.id);\n await this.importer.importHeadArtifactsFromLane(laneToFetchArtifactsFrom, ids, true);\n }\n\n const lastMerged = consumer ? new LastMerged(this.scope, consumer, this.logger) : undefined;\n // not only the succeeded ones. with \"--tag\", the unchanged components are tagged as well\n const snapshot = await lastMerged?.takeSnapshot(\n currentLane,\n allComponentsStatus.map((c) => c.id)\n );\n\n const mergeResults = await this.merging.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 shouldSquash,\n });\n\n if (snapshot) await lastMerged?.persistSnapshot(snapshot);\n\n const mergedSuccessfully =\n !mergeResults.failedComponents ||\n mergeResults.failedComponents.length === 0 ||\n mergeResults.failedComponents.every((failedComponent) => failedComponent.unchangedLegitimately);\n\n let deleteResults = {};\n\n if (!keepReadme && otherLane && otherLane.readmeComponent && mergedSuccessfully) {\n const readmeComponentId = otherLane.readmeComponent.id.changeVersion(otherLane.readmeComponent?.head?.hash);\n deleteResults = await this.remove.removeLocallyByIds([readmeComponentId], { reasonForRemoval: 'lane-merge' });\n } else if (otherLane && !otherLane.readmeComponent) {\n deleteResults = { readmeResult: '' };\n }\n const configMergeResults = compact(allComponentsStatus.map((c) => c.configMergeResult));\n\n const mergedSnapIds = ComponentIdList.fromArray(\n mergeResults.mergeSnapResults?.snappedComponents.map((c) => c.id) || []\n );\n const componentsWithConfigConflicts = configMergeResults.filter((c) => c.hasConflicts()).map((c) => c.compIdStr);\n const conflicts: ConflictPerId[] = [];\n const mergedSuccessfullyIds: ComponentID[] = [];\n mergeResults.components?.forEach((c) => {\n const files = Object.keys(c.filesStatus).filter(\n (f) => c.filesStatus[f] === FileStatus.manual || c.filesStatus[f] === FileStatus.binaryConflict\n );\n const config = componentsWithConfigConflicts.includes(c.id.toStringWithoutVersion());\n if (files.length || config) {\n conflicts.push({ id: c.id, files, config });\n } else {\n const snappedId = mergedSnapIds.searchWithoutVersion(c.id);\n mergedSuccessfullyIds.push(snappedId || c.id);\n }\n });\n\n // A merged head may reference — via its flattened dependencies — a non-head snap of another\n // component. When merging to main the squash removes intermediate snaps from each component's own\n // chain, and a bare-scope merge (`bit _merge-lane --push`) exports heads only; in both cases such a\n // referenced snap wouldn't be exported, and on lean lanes it lives only on the lane scope. Import\n // any missing one now so the export can ship it (otherwise the remote's dependency-integrity check\n // would reject the push). Not needed for non-squash workspace merges, which export full history.\n if (shouldSquash || !this.workspace) {\n await this.importMissingReferencedDeps(mergedSuccessfullyIds, otherLane);\n }\n\n await this.workspace?.consumer.onDestroy(`lane-merge (${otherLaneId.name})`);\n\n return { mergeResults, deleteResults, configMergeResults, mergedSuccessfullyIds, conflicts };\n }\n\n /**\n * A merged component head may reference, via its flattened dependencies, a non-head snap of another\n * component — e.g. a deleted component that keeps pinning an older snap of a dependency that has\n * since advanced. On lean lanes those snaps live only on the lane scope and are not fetched by the\n * merge, so the heads-only export (used by `bit _merge-lane --push`) would leave them out and the\n * remote's dependency-integrity check would fail. Import any such missing snap from the lane scope.\n */\n private async importMissingReferencedDeps(ids: ComponentID[], otherLane?: Lane) {\n // the missing snaps live on the lane scope (lean lanes). without the source lane we don't know\n // where to fetch them from, so there's nothing to do.\n if (!otherLane) return;\n const legacyScope = this.scope.legacyScope;\n // one existence check per unique hash — the same snap appears in the flattened list of many heads\n const checkedHashes = new Set<string>();\n const candidateRefs: Ref[] = [];\n await pMapSeries(ids, async (id) => {\n // strip the version — a versioned lookup (sources.get) returns undefined when that Version\n // object is missing locally, and only the model is needed here anyway (for its head).\n const modelComponent = await legacyScope.getModelComponentIfExist(id.changeVersion(undefined));\n const head = modelComponent?.head;\n if (!modelComponent || !head) return;\n const headVersion = await modelComponent.loadVersion(head.toString(), legacyScope.objects, false);\n if (!headVersion) return;\n // flattened (not only direct) to mirror the remote-side check, which validates the flattened\n // dependencies of every exported head (see throwForMissingLocalDependencies). cheap: only the\n // heads are loaded and each unique hash is stat-ed once.\n const flattenedDependencies = await headVersion.loadFlattenedDependencies(legacyScope.objects);\n flattenedDependencies.forEach((depId) => {\n // the remote check validates only same-scope deps (it skips `depId.scope !== scope.name`,\n // cross-scope deps are fetched later by the remote itself), so same-scope is all the export\n // needs to ship. this also filters out the vast majority of the flattened list.\n if (depId.scope !== id.scope) return;\n // only snaps can go missing this way — tags live on the home scope and are never squashed\n // off a lane. (a tag version is a semver string, not an object hash, so Ref.from would be\n // bogus for it anyway.)\n if (!depId.version || !isSnap(depId.version)) return;\n if (checkedHashes.has(depId.version)) return;\n checkedHashes.add(depId.version);\n candidateRefs.push(Ref.from(depId.version));\n });\n });\n // hasMultiple bounds the I/O concurrency, unlike a Promise.all of has() calls\n const existingRefs = await legacyScope.objects.hasMultiple(candidateRefs);\n const existingHashes = new Set(existingRefs.map((ref) => ref.toString()));\n const missingHashes = candidateRefs.map((ref) => ref.toString()).filter((hash) => !existingHashes.has(hash));\n if (!missingHashes.length) return;\n this.logger.debug(\n `importMissingReferencedDeps, importing ${missingHashes.length} non-head dependency snaps referenced by the merged heads from ${otherLane.scope}`\n );\n // fetch the raw objects only (by hash, from the lane scope). importManyObjects does not touch\n // component models/heads, so it can't leave a component pointing at a version whose object is\n // missing — unlike a component-level import.\n await legacyScope.scopeImporter.importManyObjects({ [otherLane.scope]: missingHashes });\n // a Version object references other objects the export must ship along with it — the file\n // sources and the flattened-edges/dependencies-graph. fetch the missing ones too. (parents are\n // not needed — the export doesn't collect them for these versions. artifacts are not needed\n // either — the export tolerates missing artifacts for such non-local versions.)\n const subRefs: Ref[] = [];\n await pMapSeries(missingHashes, async (hash) => {\n const versionObject = (await legacyScope.objects.load(Ref.from(hash))) as Version | null;\n if (!versionObject) return; // the hash could not be fetched after all\n versionObject.refsWithOptions(false, false).forEach((ref) => {\n if (checkedHashes.has(ref.toString())) return;\n checkedHashes.add(ref.toString());\n subRefs.push(ref);\n });\n });\n const existingSubRefs = new Set((await legacyScope.objects.hasMultiple(subRefs)).map((ref) => ref.toString()));\n const missingSubRefs = subRefs.map((ref) => ref.toString()).filter((hash) => !existingSubRefs.has(hash));\n if (!missingSubRefs.length) return;\n await legacyScope.scopeImporter.importManyObjects({ [otherLane.scope]: missingSubRefs });\n }\n\n private validateMergeFlags(otherLaneId: LaneId, currentLaneId: LaneId, options: MergeLaneOptions) {\n const { tag, resolveUnrelated, detachHead } = options;\n\n if (tag && !currentLaneId.isDefault()) {\n throw new BitError(`--tag only possible when on main. currently checked out to ${currentLaneId.toString()}`);\n }\n if (otherLaneId.isEqual(currentLaneId)) {\n throw new BitError(\n `unable to merge lane \"${otherLaneId.toString()}\", you're already at this lane. to get updates, simply run \"bit checkout head\"`\n );\n }\n if (resolveUnrelated && currentLaneId.isDefault()) {\n throw new BitError(\n `unable to resolve unrelated when on main. switch to ${otherLaneId.toString()} and run \"bit lane merge main --resolve-unrelated\"`\n );\n }\n if (detachHead && !currentLaneId.isDefault()) {\n throw new BitError(`unable to detach head. the current lane is not main`);\n }\n }\n\n private async resolveMergeContext(otherLaneId: LaneId, currentLaneId: LaneId, options: Partial<MergeLaneOptions>) {\n const { skipFetch, excludeNonLaneComps, shouldIncludeUpdateDependents, fetchCurrent } = options;\n const legacyScope = this.scope.legacyScope;\n if (fetchCurrent && !currentLaneId.isDefault()) {\n // if current is default, it'll be fetch later on\n await this.lanes.fetchLaneWithItsComponents(currentLaneId);\n }\n const currentLane = currentLaneId.isDefault() ? undefined : await legacyScope.loadLane(currentLaneId);\n const isDefaultLane = otherLaneId.isDefault();\n if (isDefaultLane) {\n if (!skipFetch) {\n // pass `shouldIncludeUpdateDependents` so the prefetch covers main objects for the\n // lane's hidden entries too — the per-component merge engine needs main-side Version\n // objects locally to compute divergence against the hidden cascade snaps.\n const ids = await this.getMainIdsToMerge(currentLane, !excludeNonLaneComps, shouldIncludeUpdateDependents);\n const compIdList = ComponentIdList.fromArray(ids).toVersionLatest();\n await this.importer.importObjectsFromMainIfExist(compIdList);\n }\n }\n let laneToFetchArtifactsFrom: Lane | undefined;\n const getOtherLane = async () => {\n let lane = await legacyScope.loadLane(otherLaneId);\n const shouldFetch = !lane || (!skipFetch && !lane.isNew);\n if (shouldFetch) {\n // don't assign `lane` to the result of this command. otherwise, if you have local snaps, it'll ignore them and use the remote-lane.\n // note: fetching always includes the lane's hidden updateDependents (and routes them to the\n // lane's scope); `shouldIncludeUpdateDependents` still governs whether they take part in the\n // merge itself, via `idsToMerge` below.\n const otherLane = await this.lanes.fetchLaneWithItsComponents(otherLaneId);\n laneToFetchArtifactsFrom = otherLane;\n lane = await legacyScope.loadLane(otherLaneId);\n }\n return lane;\n };\n const otherLane = isDefaultLane ? undefined : await getOtherLane();\n if (fetchCurrent && otherLane && currentLaneId.isDefault()) {\n const ids = await this.getMainIdsToMerge(otherLane, false, shouldIncludeUpdateDependents);\n const compIdList = ComponentIdList.fromArray(ids).toVersionLatest();\n await this.importer.importObjectsFromMainIfExist(compIdList);\n }\n const getBitIds = async () => {\n if (isDefaultLane) {\n const ids = await this.getMainIdsToMerge(currentLane, !excludeNonLaneComps, shouldIncludeUpdateDependents);\n if (options.resolveMainHeadsFromRemote) {\n // opt-in: resolve each head on main falling back to the remote scope, so a base that lives on\n // the remote but wasn't fetched locally is still included instead of being skipped. a component\n // with no head on main at all is genuinely new and dropped.\n const idsWithHead = await Promise.all(\n ids.map(async (id) => {\n const head = await this.lanes.getHeadOnMain(id);\n return head ? id.changeVersion(head) : null;\n })\n );\n return compact(idsWithHead);\n }\n // default: resolve heads from the local scope only (historical behavior). a component not in the\n // local scope throws, and one with no local head was never merged to main and is dropped.\n const modelComponents = await Promise.all(ids.map((id) => this.scope.legacyScope.getModelComponent(id)));\n return compact(\n modelComponents.map((c) => {\n if (!c.head) return null; // probably the component was never merged to main\n return c.toComponentId().changeVersion(c.head.toString());\n })\n );\n }\n if (!otherLane) throw new Error(`lane must be defined for non-default`);\n return shouldIncludeUpdateDependents\n ? otherLane.toComponentIdsIncludeUpdateDependents()\n : otherLane.toComponentIds();\n };\n const idsToMerge = await getBitIds();\n\n return {\n currentLane,\n otherLane,\n laneToFetchArtifactsFrom,\n idsToMerge,\n };\n }\n\n /**\n * check conflicts in case of merging sourceLaneId into targetLaneId\n */\n async checkLaneForConflicts(\n sourceLaneIdStr: string,\n targetLaneIdStr: string,\n options: Partial<MergeLaneOptions>\n ): Promise<{\n conflicts: ConflictPerId[];\n }> {\n const legacyScope = this.scope.legacyScope;\n const otherLaneId: LaneId = await legacyScope.lanes.parseLaneIdFromString(sourceLaneIdStr);\n const currentLaneId: LaneId = await legacyScope.lanes.parseLaneIdFromString(targetLaneIdStr);\n options.excludeNonLaneComps = true;\n const { currentLane, otherLane, idsToMerge } = await this.resolveMergeContext(otherLaneId, currentLaneId, options);\n\n const allComponentsStatus = await this.merging.getMergeStatus(\n idsToMerge,\n {\n mergeStrategy: 'manual',\n },\n currentLane,\n otherLane\n );\n\n throwForFailures(allComponentsStatus);\n\n const configMergeResults = compact(allComponentsStatus.map((c) => c.configMergeResult));\n const componentsWithConfigConflicts = configMergeResults.filter((c) => c.hasConflicts()).map((c) => c.compIdStr);\n const conflicts: ConflictPerId[] = [];\n allComponentsStatus.forEach((c) => {\n const files = c.mergeResults?.modifiedFiles.filter((f) => f.conflict || f.isBinaryConflict) || [];\n const config = componentsWithConfigConflicts.includes(c.id.toStringWithoutVersion());\n if (files.length || config) {\n const configData = configMergeResults.find((co) => co.compIdStr === c.id.toStringWithoutVersion());\n const configConflict = configData?.generateMergeConflictFile() || undefined;\n conflicts.push({ id: c.id, files: files.map((f) => f.filePath), config, configConflict });\n }\n });\n\n return { conflicts };\n }\n\n async mergeMove(newLaneName: string, options: { scope?: string }) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const lastMerge = new LastMerged(this.scope, this.workspace.consumer, this.logger);\n await lastMerge.restoreLaneObjectFromLastMerged();\n const newLaneResult = await this.lanes.createLane(newLaneName, { scope: options.scope });\n return newLaneResult;\n }\n\n async abortLaneMerge(checkoutProps: CheckoutProps, mergeAbortOpts: MergeAbortOpts) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const lastMerge = new LastMerged(this.scope, this.workspace.consumer, this.logger);\n const currentLane = await this.lanes.getCurrentLane();\n const { compDirsToRemove } = await lastMerge.restoreFromLastMerged(mergeAbortOpts, currentLane);\n\n await this.workspace._reloadConsumer();\n\n this.workspace.consumer.scope.objects.unmergedComponents.removeAllComponents();\n await this.workspace.consumer.scope.objects.unmergedComponents.write();\n\n const configMergeFile = this.workspace.getConflictMergeFile();\n await configMergeFile.delete();\n\n let checkoutResults: ApplyVersionResults | undefined;\n let checkoutError: Error | undefined;\n checkoutProps.ids = this.workspace.listIds();\n checkoutProps.restoreMissingComponents = true;\n try {\n checkoutResults = await this.checkout.checkout(checkoutProps);\n } catch (err: any) {\n this.logger.error(`merge-abort got an error during the checkout stage`, err);\n checkoutError = err;\n }\n\n const restoredItems = [\n `${path.basename(this.workspace.consumer.bitMap.mapPath)} file`,\n `${path.basename(this.workspace.consumer.config.path)} file`,\n ];\n if (compDirsToRemove.length) {\n restoredItems.push(`deleted components directories: ${compDirsToRemove.join(', ')}`);\n }\n if (currentLane) {\n restoredItems.push(`${currentLane.id()} lane object`);\n }\n\n return { checkoutResults, restoredItems, checkoutError };\n }\n\n private async getMainIdsToMerge(lane?: Lane | null, includeNonLaneComps = true, includeUpdateDependents = false) {\n if (!lane) throw new Error(`unable to merge ${DEFAULT_LANE}, the current lane was not found`);\n const laneIds = includeUpdateDependents ? lane.toComponentIdsIncludeUpdateDependents() : lane.toComponentIds();\n const ids = laneIds.filter((id) => this.scope.isExported(id));\n if (includeNonLaneComps) {\n if (!this.workspace) {\n throw new BitError(`getMainIdsToMerge needs workspace`);\n }\n const workspaceIds = this.workspace.listIds();\n const mainNotOnLane = workspaceIds.filter(\n (id) => !laneIds.find((laneId) => laneId.isEqualWithoutVersion(id)) && this.scope.isExported(id)\n );\n ids.push(...mainNotOnLane);\n }\n return ids;\n }\n\n private async throwIfNotUpToDate(fromLaneId: LaneId, toLaneId: LaneId) {\n const status = await this.lanes.diffStatus(fromLaneId, toLaneId, { skipChanges: true });\n const compsNotUpToDate = status.componentsStatus.filter((s) => !s.upToDate);\n if (compsNotUpToDate.length) {\n throw new Error(`unable to merge, the following components are not up-to-date:\n${compsNotUpToDate.map((s) => s.componentId.toString()).join('\\n')}`);\n }\n }\n\n static slots = [];\n static dependencies = [\n LanesAspect,\n CLIAspect,\n WorkspaceAspect,\n MergingAspect,\n LoggerAspect,\n RemoveAspect,\n ScopeAspect,\n ExportAspect,\n ImporterAspect,\n CheckoutAspect,\n ConfigStoreAspect,\n ExpressAspect,\n ];\n static runtime = MainRuntime;\n\n static async provider([\n lanes,\n cli,\n workspace,\n merging,\n loggerMain,\n remove,\n scope,\n exporter,\n importer,\n checkout,\n configStore,\n express,\n ]: [\n LanesMain,\n CLIMain,\n Workspace,\n MergingMain,\n LoggerMain,\n RemoveMain,\n ScopeMain,\n ExportMain,\n ImporterMain,\n CheckoutMain,\n ConfigStoreMain,\n ExpressMain,\n ]) {\n const logger = loggerMain.createLogger(MergeLanesAspect.id);\n const lanesCommand = cli.getCommand('lane');\n const mergeLanesMain = new MergeLanesMain(\n workspace,\n merging,\n lanes,\n logger,\n remove,\n scope,\n exporter,\n importer,\n checkout\n );\n lanesCommand?.commands?.push(new MergeLaneCmd(mergeLanesMain, configStore));\n lanesCommand?.commands?.push(new MergeAbortLaneCmd(mergeLanesMain));\n lanesCommand?.commands?.push(new MergeMoveLaneCmd(mergeLanesMain));\n express.register([new LanesCheckConflictsRoute(mergeLanesMain, logger)]);\n return mergeLanesMain;\n }\n}\n\nasync function filterComponentsStatus(\n allComponentsStatus: ComponentMergeStatus[],\n compIdsToKeep: ComponentID[],\n allBitIds: ComponentID[],\n legacyScope: LegacyScope,\n includeDeps = false,\n otherLane?: Lane, // lane that gets merged into the current lane. if not provided, it's main that gets merged into the current lane\n shouldSquash?: boolean\n): Promise<ComponentMergeStatus[]> {\n const bitIdsFromPattern = ComponentIdList.fromArray(compIdsToKeep);\n const bitIdsNotFromPattern = allBitIds.filter((bitId) => !bitIdsFromPattern.hasWithoutVersion(bitId));\n const filteredComponentStatus: ComponentMergeStatus[] = [];\n const depsToAdd: ComponentID[] = [];\n const missingDepsFromHead = {};\n const missingDepsFromHistory: string[] = [];\n\n const versionsToCheckPerId = await pMapSeries(compIdsToKeep, async (compId) => {\n const fromStatus = allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(compId));\n if (!fromStatus) {\n throw new Error(`filterComponentsStatus: unable to find ${compId.toString()} in component-status`);\n }\n filteredComponentStatus.push(fromStatus);\n if (fromStatus.unchangedMessage) {\n return undefined;\n }\n if (!otherLane) {\n // if merging main, no need to check whether the deps are included in the pattern.\n return undefined;\n }\n const { divergeData } = fromStatus;\n if (!divergeData) {\n throw new Error(`filterComponentsStatus: unable to find divergeData for ${compId.toString()}`);\n }\n let targetVersions: Ref[] = divergeData.snapsOnTargetOnly;\n if (!targetVersions.length) {\n return undefined;\n }\n const modelComponent = await legacyScope.getModelComponent(compId);\n if (shouldSquash) {\n // no need to check all versions, we merge only the head\n const headOnTarget = otherLane ? otherLane.getCompHeadIncludeUpdateDependents(compId) : modelComponent.head;\n if (!headOnTarget) {\n throw new Error(`filterComponentsStatus: unable to find head for ${compId.toString()}`);\n }\n targetVersions = [headOnTarget];\n }\n\n return { compId, targetVersions, modelComponent };\n });\n\n // all these versions needs to be imported to load them later and check whether they have dependencies on the target lane\n const toImport = compact(versionsToCheckPerId)\n .map((c) => c.targetVersions.map((v) => c.compId.changeVersion(v.toString())))\n .flat();\n await legacyScope.scopeImporter.importWithoutDeps(ComponentIdList.fromArray(toImport), {\n lane: otherLane,\n cache: true,\n includeVersionHistory: false,\n reason: 'import all history of given patterns components to check whether they have dependencies on the lane',\n });\n\n await pMapSeries(compact(versionsToCheckPerId), async ({ compId, targetVersions, modelComponent }) => {\n await pMapSeries(targetVersions, async (remoteVersion) => {\n const versionObj = await modelComponent.loadVersion(remoteVersion.toString(), legacyScope.objects);\n const flattenedDeps = await versionObj.loadFlattenedDependencies(legacyScope.objects);\n const depsNotIncludeInPattern = flattenedDeps.filter((id) =>\n bitIdsNotFromPattern.find((bitId) => bitId.isEqualWithoutVersion(id))\n );\n if (!depsNotIncludeInPattern.length) {\n return;\n }\n const depsOnLane: ComponentID[] = [];\n await Promise.all(\n depsNotIncludeInPattern.map(async (dep) => {\n const isOnLane = await legacyScope.isIdOnLane(dep, otherLane);\n if (isOnLane) {\n depsOnLane.push(dep);\n }\n })\n );\n if (!depsOnLane.length) {\n return;\n }\n if (includeDeps) {\n depsToAdd.push(...depsOnLane);\n } else {\n const headOnTarget = otherLane ? otherLane.getCompHeadIncludeUpdateDependents(compId) : modelComponent.head;\n const depsOnLaneStr = depsOnLane.map((dep) => dep.toStringWithoutVersion());\n if (headOnTarget?.isEqual(remoteVersion)) {\n depsOnLaneStr.forEach((dep) => {\n (missingDepsFromHead[dep] ||= []).push(compId.toStringWithoutVersion());\n });\n } else {\n missingDepsFromHistory.push(...depsOnLaneStr);\n }\n }\n });\n });\n if (Object.keys(missingDepsFromHead).length || missingDepsFromHistory.length) {\n throw new MissingCompsToMerge(missingDepsFromHead, uniq(missingDepsFromHistory));\n }\n\n if (depsToAdd.length) {\n // remove the version, otherwise, the uniq gives duplicate components with different versions.\n const depsWithoutVersion = depsToAdd.map((d) => d.changeVersion(undefined));\n const depsUniqWithoutVersion = ComponentIdList.uniqFromArray(depsWithoutVersion);\n depsUniqWithoutVersion.forEach((id) => {\n const fromStatus = allComponentsStatus.find((c) => c.id.isEqualWithoutVersion(id));\n if (!fromStatus) {\n throw new Error(`filterComponentsStatus: unable to find ${id.toString()} in component-status`);\n }\n filteredComponentStatus.push(fromStatus);\n });\n }\n return filteredComponentStatus;\n}\n\nasync function squashSnaps(\n succeededComponents: ComponentMergeStatus[],\n currentLaneId: LaneId,\n otherLaneId: LaneId,\n scope: LegacyScope,\n opts: { messageTitle?: string; detachHead?: boolean } = {}\n) {\n const currentLaneName = currentLaneId.name;\n const log = await getLogForSquash(otherLaneId);\n\n await Promise.all(\n succeededComponents.map(async ({ id, divergeData, componentFromModel }) => {\n if (!divergeData) {\n throw new Error(`unable to squash. divergeData is missing from ${id.toString()}`);\n }\n\n const modifiedComp = await squashOneComp(\n currentLaneName,\n otherLaneId,\n id,\n divergeData,\n log,\n scope,\n componentFromModel,\n opts\n );\n if (modifiedComp) {\n scope.objects.add(modifiedComp);\n const modelComponent = await scope.getModelComponent(id);\n const versionHistory = await modelComponent.updateRebasedVersionHistory(scope.objects, [modifiedComp]);\n if (versionHistory) scope.objects.add(versionHistory);\n }\n })\n );\n}\n\n/**\n * returns Version object if it was modified. otherwise, returns undefined\n */\nasync function squashOneComp(\n currentLaneName: string,\n otherLaneId: LaneId,\n id: ComponentID,\n divergeData: SnapsDistance,\n log: Log,\n scope: LegacyScope,\n componentFromModel?: Version,\n opts: { messageTitle?: string; detachHead?: boolean } = {}\n): Promise<Version | undefined> {\n const { messageTitle, detachHead } = opts;\n const shouldSquash = () => {\n if (divergeData.isDiverged()) {\n if (detachHead) {\n // for detach head, it's ok to have it as diverged. as long as the target is ahead, we want to squash.\n return true;\n }\n // diverged + --squash: skip the parent-rewrite path here. the merge snap will be created\n // by snapForMerge with a single parent (and squashed metadata) because the corresponding\n // UnmergedComponent entry has `shouldSquash: true`. see snapping.main.runtime.ts.\n return false;\n }\n if (divergeData.isSourceAhead()) {\n // nothing to do. current is ahead, nothing to merge. (it was probably filtered out already as a \"failedComponent\")\n return false;\n }\n if (!divergeData.isTargetAhead()) {\n // nothing to do. current and remote are the same, nothing to merge. (it was probably filtered out already as a \"failedComponent\")\n return false;\n }\n return true;\n };\n\n if (!shouldSquash()) {\n return undefined;\n }\n\n // remote is ahead and was not diverge.\n const remoteSnaps = divergeData.snapsOnTargetOnly;\n if (remoteSnaps.length === 0) {\n throw new Error(`remote is ahead but it has no snaps. it's impossible`);\n }\n const getAllMessages = async () => {\n if (!messageTitle) return [];\n await scope.scopeImporter.importManyObjects({ [otherLaneId.scope]: remoteSnaps.map((s) => s.toString()) });\n const versionObjects = (await Promise.all(remoteSnaps.map((s) => scope.objects.load(s)))) as Version[];\n return compact(versionObjects).map((v) => v.log.message);\n };\n const getFinalMessage = async (): Promise<string | undefined> => {\n if (!messageTitle) return undefined;\n const allMessage = await getAllMessages();\n const allMessageStr = compact(allMessage)\n .map((m) => `[*] ${m}`)\n .join('\\n');\n return `${messageTitle}\\n${allMessageStr}`;\n };\n if (!componentFromModel) {\n throw new Error('unable to squash, the componentFromModel is missing');\n }\n const currentParents = componentFromModel.parents;\n\n // if the remote has only one snap, there is nothing to squash.\n // other checks here is to make sure `componentFromModel.addAsOnlyParent` call is not needed.\n if (remoteSnaps.length === 1 && divergeData.commonSnapBeforeDiverge && currentParents.length === 1) {\n return undefined;\n }\n\n const doSquash = async () => {\n if (divergeData.commonSnapBeforeDiverge) {\n componentFromModel.addAsOnlyParent(divergeData.commonSnapBeforeDiverge);\n return;\n }\n if (currentLaneName !== DEFAULT_LANE) {\n // when squashing into lane, we have to take main into account\n const modelComponent = await scope.getModelComponentIfExist(id);\n if (!modelComponent) throw new Error(`missing ModelComponent for ${id.toString()}`);\n if (modelComponent.head) {\n componentFromModel.addAsOnlyParent(modelComponent.head);\n return;\n }\n }\n // there is no commonSnapBeforeDiverge. the local has no snaps, all are remote, no need for parents. keep only head.\n componentFromModel.parents.forEach((ref) => componentFromModel.removeParent(ref));\n };\n\n await doSquash();\n\n const finalMessage = await getFinalMessage();\n componentFromModel.setSquashed({ previousParents: currentParents, laneId: otherLaneId }, log, finalMessage);\n return componentFromModel;\n}\n\nMergeLanesAspect.addRuntime(MergeLanesMain);\n\nexport default MergeLanesMain;\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,KAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,IAAA,YAAAA,CAAA;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EpG,MAAM,EAAE1N;EAAY,CAAC,EAAE4S,GAAG,EAAEwB,YAAY,CAAC;EAC3G,OAAOtB,kBAAkB;AAC3B;AAEAnE,8BAAgB,CAAC4F,UAAU,CAACzV,cAAc,CAAC;AAAC,IAAA0V,QAAA,GAAAnF,OAAA,CAAA1R,OAAA,GAE7BmB,cAAc","ignoreList":[]}
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
1
  {
2
2
  "name": "@teambit/merge-lanes",
3
- "version": "1.0.1284",
3
+ "version": "1.0.1286",
4
4
  "homepage": "https://bit.cloud/teambit/lanes/merge-lanes",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.lanes",
8
8
  "name": "merge-lanes",
9
- "version": "1.0.1284"
9
+ "version": "1.0.1286"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
13
13
  "fs-extra": "10.0.0",
14
+ "lodash": "4.18.1",
14
15
  "tempy": "1.0.1",
15
16
  "yesno": "0.4.0",
16
- "lodash": "4.18.1",
17
17
  "p-map-series": "2.1.0",
18
18
  "@teambit/express": "0.0.1508",
19
19
  "@teambit/logger": "0.0.1502",
20
20
  "@teambit/bit-error": "0.0.404",
21
- "@teambit/legacy.constants": "0.0.50",
22
- "@teambit/harmony": "0.4.12",
23
21
  "@teambit/component-id": "1.2.5",
24
- "@teambit/component-version": "1.0.4",
25
- "@teambit/harmony.modules.runtimes": "0.0.4",
26
- "@teambit/lane-id": "0.0.312",
27
22
  "@teambit/legacy.bit-map": "0.0.250",
28
23
  "@teambit/legacy.consumer": "0.0.196",
29
24
  "@teambit/legacy.scope": "0.0.196",
30
- "@teambit/objects": "0.0.731",
31
- "@teambit/scope": "1.0.1254",
32
- "@teambit/checkout": "1.0.1263",
33
25
  "@teambit/cli": "0.0.1427",
34
26
  "@teambit/component.modules.merge-helper": "0.0.140",
35
27
  "@teambit/config-store": "0.0.308",
36
- "@teambit/merging": "1.0.1265",
37
- "@teambit/remove": "1.0.1256",
28
+ "@teambit/legacy.constants": "0.0.50",
29
+ "@teambit/harmony": "0.4.12",
30
+ "@teambit/component-version": "1.0.4",
38
31
  "@teambit/component.snap-distance": "0.0.193",
39
- "@teambit/config-merger": "0.0.1122",
40
- "@teambit/export": "1.0.1258",
41
32
  "@teambit/harmony.modules.get-basic-log": "0.0.197",
42
- "@teambit/importer": "1.0.1256",
43
- "@teambit/lanes": "1.0.1284",
44
- "@teambit/workspace": "1.0.1255"
33
+ "@teambit/harmony.modules.runtimes": "0.0.4",
34
+ "@teambit/lane-id": "0.0.312",
35
+ "@teambit/objects": "0.0.732",
36
+ "@teambit/scope": "1.0.1255",
37
+ "@teambit/checkout": "1.0.1264",
38
+ "@teambit/merging": "1.0.1266",
39
+ "@teambit/remove": "1.0.1257",
40
+ "@teambit/config-merger": "0.0.1123",
41
+ "@teambit/export": "1.0.1259",
42
+ "@teambit/importer": "1.0.1257",
43
+ "@teambit/lanes": "1.0.1285",
44
+ "@teambit/workspace": "1.0.1256"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/fs-extra": "9.0.7",
48
48
  "@types/lodash": "4.14.165",
49
49
  "@types/mocha": "9.1.0",
50
- "@teambit/harmony.envs.core-aspect-env": "2.1.2",
51
50
  "@teambit/component.testing.mock-components": "0.0.472",
52
51
  "@teambit/harmony.testing.load-aspect": "0.0.466",
53
- "@teambit/snapping": "1.0.1261",
54
- "@teambit/workspace.testing.mock-workspace": "0.0.280"
52
+ "@teambit/workspace.testing.mock-workspace": "0.0.280",
53
+ "@teambit/harmony.envs.core-aspect-env": "2.1.2",
54
+ "@teambit/snapping": "1.0.1262"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "chai": "5.2.1"