@teambit/merging 0.0.455 → 0.0.457
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/merge-status-provider.d.ts +25 -0
- package/dist/merge-status-provider.js +415 -0
- package/dist/merge-status-provider.js.map +1 -0
- package/dist/merging.main.runtime.d.ts +3 -3
- package/dist/merging.main.runtime.js +17 -324
- package/dist/merging.main.runtime.js.map +1 -1
- package/package.json +16 -16
- /package/dist/{preview-1692933492285.js → preview-1693106196664.js} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Workspace } from '@teambit/workspace';
|
|
2
|
+
import { BitId } from '@teambit/legacy/dist/bit-id';
|
|
3
|
+
import { Lane } from '@teambit/legacy/dist/scope/models';
|
|
4
|
+
import { ImporterMain } from '@teambit/importer';
|
|
5
|
+
import { Logger } from '@teambit/logger';
|
|
6
|
+
import { ComponentMergeStatus } from './merging.main.runtime';
|
|
7
|
+
export declare class MergeStatusProvider {
|
|
8
|
+
private workspace;
|
|
9
|
+
private logger;
|
|
10
|
+
private importer;
|
|
11
|
+
private currentLane?;
|
|
12
|
+
private otherLane?;
|
|
13
|
+
private options?;
|
|
14
|
+
constructor(workspace: Workspace, logger: Logger, importer: ImporterMain, currentLane?: Lane | undefined, // currently checked out lane. if on main, then it's undefined.
|
|
15
|
+
otherLane?: Lane | undefined, // the lane we want to merged to our lane. (undefined if it's "main").
|
|
16
|
+
options?: {
|
|
17
|
+
resolveUnrelated?: "manual" | "ours" | "theirs" | undefined;
|
|
18
|
+
ignoreConfigChanges?: boolean | undefined;
|
|
19
|
+
} | undefined);
|
|
20
|
+
getStatus(bitIds: BitId[]): Promise<ComponentMergeStatus[]>;
|
|
21
|
+
private getComponentMergeStatus;
|
|
22
|
+
private returnUnmerged;
|
|
23
|
+
private getComponentStatusBeforeMergeAttempt;
|
|
24
|
+
private handleNoCommonSnap;
|
|
25
|
+
}
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
require("core-js/modules/es.array.flat.js");
|
|
5
|
+
require("core-js/modules/es.array.iterator.js");
|
|
6
|
+
require("core-js/modules/es.array.unscopables.flat.js");
|
|
7
|
+
require("core-js/modules/es.promise.js");
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
exports.MergeStatusProvider = void 0;
|
|
12
|
+
function _defineProperty2() {
|
|
13
|
+
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
_defineProperty2 = function () {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
function _pMapSeries() {
|
|
20
|
+
const data = _interopRequireDefault(require("p-map-series"));
|
|
21
|
+
_pMapSeries = function () {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
function _bitId() {
|
|
27
|
+
const data = require("@teambit/legacy/dist/bit-id");
|
|
28
|
+
_bitId = function () {
|
|
29
|
+
return data;
|
|
30
|
+
};
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
function _laneId() {
|
|
34
|
+
const data = require("@teambit/lane-id");
|
|
35
|
+
_laneId = function () {
|
|
36
|
+
return data;
|
|
37
|
+
};
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
40
|
+
function _getDivergeData() {
|
|
41
|
+
const data = require("@teambit/legacy/dist/scope/component-ops/get-diverge-data");
|
|
42
|
+
_getDivergeData = function () {
|
|
43
|
+
return data;
|
|
44
|
+
};
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
function _repositories() {
|
|
48
|
+
const data = require("@teambit/legacy/dist/scope/repositories");
|
|
49
|
+
_repositories = function () {
|
|
50
|
+
return data;
|
|
51
|
+
};
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
function _lodash() {
|
|
55
|
+
const data = require("lodash");
|
|
56
|
+
_lodash = function () {
|
|
57
|
+
return data;
|
|
58
|
+
};
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
function _threeWayMerge() {
|
|
62
|
+
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge"));
|
|
63
|
+
_threeWayMerge = function () {
|
|
64
|
+
return data;
|
|
65
|
+
};
|
|
66
|
+
return data;
|
|
67
|
+
}
|
|
68
|
+
function _noCommonSnap() {
|
|
69
|
+
const data = require("@teambit/legacy/dist/scope/exceptions/no-common-snap");
|
|
70
|
+
_noCommonSnap = function () {
|
|
71
|
+
return data;
|
|
72
|
+
};
|
|
73
|
+
return data;
|
|
74
|
+
}
|
|
75
|
+
function _configMerger() {
|
|
76
|
+
const data = require("./config-merger");
|
|
77
|
+
_configMerger = function () {
|
|
78
|
+
return data;
|
|
79
|
+
};
|
|
80
|
+
return data;
|
|
81
|
+
}
|
|
82
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
83
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
84
|
+
class MergeStatusProvider {
|
|
85
|
+
constructor(workspace, logger, importer, currentLane,
|
|
86
|
+
// currently checked out lane. if on main, then it's undefined.
|
|
87
|
+
otherLane,
|
|
88
|
+
// the lane we want to merged to our lane. (undefined if it's "main").
|
|
89
|
+
options) {
|
|
90
|
+
this.workspace = workspace;
|
|
91
|
+
this.logger = logger;
|
|
92
|
+
this.importer = importer;
|
|
93
|
+
this.currentLane = currentLane;
|
|
94
|
+
this.otherLane = otherLane;
|
|
95
|
+
this.options = options;
|
|
96
|
+
}
|
|
97
|
+
async getStatus(bitIds) {
|
|
98
|
+
if (!this.currentLane && this.otherLane) {
|
|
99
|
+
await this.importer.importObjectsFromMainIfExist(this.otherLane.toBitIds().toVersionLatest());
|
|
100
|
+
}
|
|
101
|
+
const componentStatusBeforeMergeAttempt = await (0, _pMapSeries().default)(bitIds, id => this.getComponentStatusBeforeMergeAttempt(id));
|
|
102
|
+
const toImport = componentStatusBeforeMergeAttempt.map(compStatus => {
|
|
103
|
+
if (!compStatus.divergeData) return [];
|
|
104
|
+
const versionsToImport = (0, _lodash().compact)([...compStatus.divergeData.snapsOnTargetOnly, compStatus.divergeData.commonSnapBeforeDiverge]);
|
|
105
|
+
return versionsToImport.map(v => compStatus.id.changeVersion(v.toString()));
|
|
106
|
+
}).flat();
|
|
107
|
+
await this.workspace.consumer.scope.scopeImporter.importWithoutDeps(_bitId().BitIds.fromArray(toImport), {
|
|
108
|
+
lane: this.otherLane,
|
|
109
|
+
cache: true,
|
|
110
|
+
includeVersionHistory: false
|
|
111
|
+
});
|
|
112
|
+
const compStatusNotNeedMerge = componentStatusBeforeMergeAttempt.filter(c => !c.mergeProps);
|
|
113
|
+
const compStatusNeedMerge = componentStatusBeforeMergeAttempt.filter(c => c.mergeProps);
|
|
114
|
+
const getComponentsStatusNeedMerge = async () => {
|
|
115
|
+
const tmp = new (_repositories().Tmp)(this.workspace.consumer.scope);
|
|
116
|
+
try {
|
|
117
|
+
const componentsStatus = await Promise.all(compStatusNeedMerge.map(compStatus => this.getComponentMergeStatus(compStatus)));
|
|
118
|
+
await tmp.clear();
|
|
119
|
+
return componentsStatus;
|
|
120
|
+
} catch (err) {
|
|
121
|
+
await tmp.clear();
|
|
122
|
+
throw err;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const results = await getComponentsStatusNeedMerge();
|
|
126
|
+
results.push(...compStatusNotNeedMerge);
|
|
127
|
+
return results;
|
|
128
|
+
}
|
|
129
|
+
async getComponentMergeStatus(componentMergeStatusBeforeMergeAttempt) {
|
|
130
|
+
var _this$currentLane;
|
|
131
|
+
const {
|
|
132
|
+
id,
|
|
133
|
+
divergeData,
|
|
134
|
+
currentComponent,
|
|
135
|
+
mergeProps
|
|
136
|
+
} = componentMergeStatusBeforeMergeAttempt;
|
|
137
|
+
if (!mergeProps) throw new Error(`getDivergedMergeStatus, mergeProps is missing for ${id.toString()}`);
|
|
138
|
+
const {
|
|
139
|
+
otherLaneHead,
|
|
140
|
+
currentId,
|
|
141
|
+
modelComponent
|
|
142
|
+
} = mergeProps;
|
|
143
|
+
const repo = this.workspace.consumer.scope.objects;
|
|
144
|
+
if (!divergeData) throw new Error(`getDivergedMergeStatus, divergeData is missing for ${id.toString()}`);
|
|
145
|
+
if (!currentComponent) throw new Error(`getDivergedMergeStatus, currentComponent is missing for ${id.toString()}`);
|
|
146
|
+
const baseSnap = divergeData.commonSnapBeforeDiverge; // must be set when isTrueMerge
|
|
147
|
+
this.logger.debug(`merging snaps details:
|
|
148
|
+
id: ${id.toStringWithoutVersion()}
|
|
149
|
+
base: ${baseSnap.toString()}
|
|
150
|
+
current: ${currentId.version}
|
|
151
|
+
other: ${otherLaneHead.toString()}`);
|
|
152
|
+
const baseComponent = await modelComponent.loadVersion(baseSnap.toString(), repo);
|
|
153
|
+
const otherComponent = await modelComponent.loadVersion(otherLaneHead.toString(), repo);
|
|
154
|
+
const currentLaneName = ((_this$currentLane = this.currentLane) === null || _this$currentLane === void 0 ? void 0 : _this$currentLane.toLaneId().toString()) || 'main';
|
|
155
|
+
const otherLaneName = this.otherLane ? this.otherLane.toLaneId().toString() : _laneId().DEFAULT_LANE;
|
|
156
|
+
const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;
|
|
157
|
+
const otherLabel = `${otherLaneHead.toString()} (${otherLaneName === currentLaneName ? 'incoming' : otherLaneName})`;
|
|
158
|
+
const workspaceIds = await this.workspace.listIds();
|
|
159
|
+
const configMerger = new (_configMerger().ConfigMerger)(id.toStringWithoutVersion(), workspaceIds, this.otherLane, currentComponent.extensions, baseComponent.extensions, otherComponent.extensions, currentLabel, otherLabel, this.logger);
|
|
160
|
+
const configMergeResult = configMerger.merge();
|
|
161
|
+
const mergeResults = await (0, _threeWayMerge().default)({
|
|
162
|
+
consumer: this.workspace.consumer,
|
|
163
|
+
otherComponent,
|
|
164
|
+
otherLabel,
|
|
165
|
+
currentComponent,
|
|
166
|
+
currentLabel,
|
|
167
|
+
baseComponent
|
|
168
|
+
});
|
|
169
|
+
return {
|
|
170
|
+
currentComponent,
|
|
171
|
+
id,
|
|
172
|
+
mergeResults,
|
|
173
|
+
divergeData,
|
|
174
|
+
configMergeResult
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
returnUnmerged(id, msg, unmergedLegitimately = false) {
|
|
178
|
+
const componentStatus = {
|
|
179
|
+
id
|
|
180
|
+
};
|
|
181
|
+
componentStatus.unmergedMessage = msg;
|
|
182
|
+
componentStatus.unmergedLegitimately = unmergedLegitimately;
|
|
183
|
+
return componentStatus;
|
|
184
|
+
}
|
|
185
|
+
async getComponentStatusBeforeMergeAttempt(id) {
|
|
186
|
+
var _this$currentLane2, _this$options;
|
|
187
|
+
const consumer = this.workspace.consumer;
|
|
188
|
+
const componentStatus = {
|
|
189
|
+
id
|
|
190
|
+
};
|
|
191
|
+
const modelComponent = await consumer.scope.getModelComponentIfExist(id);
|
|
192
|
+
if (!modelComponent) {
|
|
193
|
+
return this.returnUnmerged(id, `component ${id.toString()} is on the lane/main but its objects were not found, please re-import the lane`);
|
|
194
|
+
}
|
|
195
|
+
const unmerged = consumer.scope.objects.unmergedComponents.getEntry(id.name);
|
|
196
|
+
if (unmerged) {
|
|
197
|
+
return this.returnUnmerged(id, `component ${id.toStringWithoutVersion()} is in during-merge state a previous merge, please snap/tag it first (or use bit merge --resolve/--abort/ bit lane merge-abort)`);
|
|
198
|
+
}
|
|
199
|
+
const repo = consumer.scope.objects;
|
|
200
|
+
const version = id.version;
|
|
201
|
+
const otherLaneHead = modelComponent.getRef(version);
|
|
202
|
+
const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, {
|
|
203
|
+
ignoreVersion: true
|
|
204
|
+
});
|
|
205
|
+
const componentOnOther = await modelComponent.loadVersion(version, consumer.scope.objects);
|
|
206
|
+
const idOnCurrentLane = (_this$currentLane2 = this.currentLane) === null || _this$currentLane2 === void 0 ? void 0 : _this$currentLane2.getComponent(id);
|
|
207
|
+
if (componentOnOther.isRemoved()) {
|
|
208
|
+
// if exist in current lane, we want the current lane to get the soft-remove update.
|
|
209
|
+
// or if it was removed with --update-main, we want to merge it so then main will get the update.
|
|
210
|
+
const shouldMerge = idOnCurrentLane || componentOnOther.shouldRemoveFromMain();
|
|
211
|
+
if (shouldMerge) {
|
|
212
|
+
// remove the component from the workspace if exist.
|
|
213
|
+
componentStatus.shouldBeRemoved = true;
|
|
214
|
+
} else {
|
|
215
|
+
// on main, don't merge soft-removed components unless it's marked with removeOnMain.
|
|
216
|
+
// on lane, if it's not part of the current lane, don't merge it.
|
|
217
|
+
return this.returnUnmerged(id, `component has been removed`, true);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const getCurrentId = () => {
|
|
221
|
+
if (existingBitMapId) return existingBitMapId;
|
|
222
|
+
if (this.currentLane) {
|
|
223
|
+
if (!idOnCurrentLane) return null;
|
|
224
|
+
return idOnCurrentLane.id.changeVersion(idOnCurrentLane.head.toString());
|
|
225
|
+
}
|
|
226
|
+
// it's on main
|
|
227
|
+
const head = modelComponent.getHeadAsTagIfExist();
|
|
228
|
+
if (head) {
|
|
229
|
+
return id.changeVersion(head);
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
};
|
|
233
|
+
const currentId = getCurrentId();
|
|
234
|
+
if (!currentId) {
|
|
235
|
+
const divergeData = await (0, _getDivergeData().getDivergeData)({
|
|
236
|
+
repo,
|
|
237
|
+
modelComponent,
|
|
238
|
+
targetHead: otherLaneHead,
|
|
239
|
+
throws: false
|
|
240
|
+
});
|
|
241
|
+
return _objectSpread(_objectSpread({}, componentStatus), {}, {
|
|
242
|
+
componentFromModel: componentOnOther,
|
|
243
|
+
divergeData
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
const getCurrentComponent = () => {
|
|
247
|
+
if (existingBitMapId) return consumer.loadComponent(existingBitMapId);
|
|
248
|
+
return consumer.scope.getConsumerComponent(currentId);
|
|
249
|
+
};
|
|
250
|
+
const currentComponent = await getCurrentComponent();
|
|
251
|
+
if (currentComponent.isRemoved()) {
|
|
252
|
+
// we have a few options:
|
|
253
|
+
// 1. other is ahead. in this case, other recovered the component. so we can continue with the merge.
|
|
254
|
+
// it is possible that it is diverged, in which case, still continue with the merge, and later on, the
|
|
255
|
+
// merge-config will show a config conflict of the remove aspect.
|
|
256
|
+
// 2. other is not ahead. in this case, just ignore this component, no point to merge it, we want it removed.
|
|
257
|
+
// 3. there are errors when calculating the divergeData, e.g. no snap in common. in such cases, we assume
|
|
258
|
+
// there are issues with this component, and is better not to merge it.
|
|
259
|
+
const divergeData = await (0, _getDivergeData().getDivergeData)({
|
|
260
|
+
repo,
|
|
261
|
+
modelComponent,
|
|
262
|
+
targetHead: otherLaneHead,
|
|
263
|
+
throws: false
|
|
264
|
+
});
|
|
265
|
+
if (divergeData.err || !divergeData.isTargetAhead()) {
|
|
266
|
+
return this.returnUnmerged(id, `component has been removed`, true);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const isModified = async () => {
|
|
270
|
+
const componentModificationStatus = await consumer.getComponentStatusById(currentComponent.id);
|
|
271
|
+
if (!componentModificationStatus.modified) return undefined;
|
|
272
|
+
if (!existingBitMapId) return undefined;
|
|
273
|
+
const baseComponent = await modelComponent.loadVersion(existingBitMapId.version, consumer.scope.objects);
|
|
274
|
+
const isSourceCodeModified = await consumer.isComponentSourceCodeModified(baseComponent, currentComponent);
|
|
275
|
+
if (isSourceCodeModified) return 'code';
|
|
276
|
+
return 'config';
|
|
277
|
+
};
|
|
278
|
+
const modifiedType = await isModified();
|
|
279
|
+
if (modifiedType === 'config' && !((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.ignoreConfigChanges)) {
|
|
280
|
+
return this.returnUnmerged(id, `component has config changes, please snap/tag it first. alternatively, use --ignore-config-changes flag to bypass`);
|
|
281
|
+
}
|
|
282
|
+
if (modifiedType === 'code') {
|
|
283
|
+
return this.returnUnmerged(id, `component is modified, please snap/tag it first`);
|
|
284
|
+
}
|
|
285
|
+
if (!otherLaneHead) {
|
|
286
|
+
throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);
|
|
287
|
+
}
|
|
288
|
+
const divergeData = await (0, _getDivergeData().getDivergeData)({
|
|
289
|
+
repo,
|
|
290
|
+
modelComponent,
|
|
291
|
+
targetHead: otherLaneHead,
|
|
292
|
+
throws: false
|
|
293
|
+
});
|
|
294
|
+
if (divergeData.err) {
|
|
295
|
+
var _this$options2;
|
|
296
|
+
if (!(divergeData.err instanceof _noCommonSnap().NoCommonSnap) || !((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.resolveUnrelated)) {
|
|
297
|
+
return this.returnUnmerged(id, `unable to traverse ${currentComponent.id.toString()} history. error: ${divergeData.err.message}`);
|
|
298
|
+
}
|
|
299
|
+
return this.handleNoCommonSnap(modelComponent, id, otherLaneHead, currentComponent, componentOnOther, divergeData);
|
|
300
|
+
}
|
|
301
|
+
if (!divergeData.isDiverged()) {
|
|
302
|
+
if (divergeData.isSourceAhead()) {
|
|
303
|
+
// do nothing!
|
|
304
|
+
return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is ahead, nothing to merge`, true);
|
|
305
|
+
}
|
|
306
|
+
if (divergeData.isTargetAhead()) {
|
|
307
|
+
// just override with the model data
|
|
308
|
+
return _objectSpread(_objectSpread({}, componentStatus), {}, {
|
|
309
|
+
currentComponent,
|
|
310
|
+
componentFromModel: componentOnOther,
|
|
311
|
+
divergeData
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
// we know that localHead and remoteHead are set, so if none of them is ahead they must be equal
|
|
315
|
+
return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is already merged`, true);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// it's diverged and needs merge operation
|
|
319
|
+
const mergeProps = {
|
|
320
|
+
otherLaneHead,
|
|
321
|
+
currentId,
|
|
322
|
+
modelComponent
|
|
323
|
+
};
|
|
324
|
+
return _objectSpread(_objectSpread({}, componentStatus), {}, {
|
|
325
|
+
currentComponent,
|
|
326
|
+
mergeProps,
|
|
327
|
+
divergeData
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
async handleNoCommonSnap(modelComponent, id, otherLaneHead, currentComponent, componentOnOther, divergeData) {
|
|
331
|
+
const {
|
|
332
|
+
resolveUnrelated
|
|
333
|
+
} = this.options || {};
|
|
334
|
+
if (!resolveUnrelated) throw new Error(`handleNoCommonSnap expects resolveUnrelated to be set`);
|
|
335
|
+
const consumer = this.workspace.consumer;
|
|
336
|
+
const repo = consumer.scope.objects;
|
|
337
|
+
const mainHead = modelComponent.head;
|
|
338
|
+
const returnAccordingToOurs = (headToSaveInLane, unrelatedHead, unrelatedLaneId) => {
|
|
339
|
+
return {
|
|
340
|
+
currentComponent,
|
|
341
|
+
id,
|
|
342
|
+
divergeData,
|
|
343
|
+
resolvedUnrelated: {
|
|
344
|
+
strategy: 'ours',
|
|
345
|
+
headOnCurrentLane: headToSaveInLane,
|
|
346
|
+
unrelatedHead,
|
|
347
|
+
unrelatedLaneId
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
const returnAccordingToTheirs = (resolvedRef, unrelatedHeadRef, unrelatedLaneId) => {
|
|
352
|
+
// just override with the model data
|
|
353
|
+
return {
|
|
354
|
+
currentComponent,
|
|
355
|
+
componentFromModel: componentOnOther,
|
|
356
|
+
id,
|
|
357
|
+
divergeData,
|
|
358
|
+
resolvedUnrelated: {
|
|
359
|
+
strategy: 'theirs',
|
|
360
|
+
headOnCurrentLane: resolvedRef,
|
|
361
|
+
unrelatedHead: unrelatedHeadRef,
|
|
362
|
+
unrelatedLaneId
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
const currentVersionRef = modelComponent.getRef(currentComponent.id.version);
|
|
367
|
+
if (!currentVersionRef) throw new Error(`handleNoCommonSnap, unable to get ref of current version "${currentComponent.id.version}" for "${id.toString()}"`);
|
|
368
|
+
const otherVersionRef = modelComponent.getRef(id.version);
|
|
369
|
+
if (!otherVersionRef) throw new Error(`handleNoCommonSnap, unable to get ref of other version "${id.version}" for "${id.toString()}"`);
|
|
370
|
+
if (mainHead) {
|
|
371
|
+
const hasResolvedFromMain = async hashToCompare => {
|
|
372
|
+
const divergeDataFromMain = await (0, _getDivergeData().getDivergeData)({
|
|
373
|
+
repo,
|
|
374
|
+
modelComponent,
|
|
375
|
+
sourceHead: hashToCompare,
|
|
376
|
+
targetHead: mainHead,
|
|
377
|
+
throws: false
|
|
378
|
+
});
|
|
379
|
+
if (!divergeDataFromMain.err) return true;
|
|
380
|
+
return !(divergeDataFromMain.err instanceof _noCommonSnap().NoCommonSnap);
|
|
381
|
+
};
|
|
382
|
+
const hasResolvedLocally = await hasResolvedFromMain(modelComponent.getHeadRegardlessOfLane());
|
|
383
|
+
const hasResolvedRemotely = await hasResolvedFromMain(otherLaneHead);
|
|
384
|
+
if (!hasResolvedLocally && !hasResolvedRemotely) {
|
|
385
|
+
return this.returnUnmerged(id, `unable to traverse ${currentComponent.id.toString()} history. the main-head ${mainHead.toString()} doesn't appear in both lanes.
|
|
386
|
+
it was probably created in each lane separately and it also exists on main. please merge main first to one of these lanes`);
|
|
387
|
+
}
|
|
388
|
+
const refToSaveInLane = hasResolvedLocally ? currentVersionRef : otherVersionRef;
|
|
389
|
+
const unrelatedHeadRef = hasResolvedLocally ? otherVersionRef : currentVersionRef;
|
|
390
|
+
if (resolveUnrelated === 'ours') {
|
|
391
|
+
var _this$currentLane3;
|
|
392
|
+
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, (_this$currentLane3 = this.currentLane) === null || _this$currentLane3 === void 0 ? void 0 : _this$currentLane3.toLaneId());
|
|
393
|
+
}
|
|
394
|
+
if (resolveUnrelated === 'theirs') {
|
|
395
|
+
var _this$currentLane4;
|
|
396
|
+
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, (_this$currentLane4 = this.currentLane) === null || _this$currentLane4 === void 0 ? void 0 : _this$currentLane4.toLaneId());
|
|
397
|
+
}
|
|
398
|
+
throw new Error(`unsupported strategy "${resolveUnrelated}" of resolve-unrelated. supported strategies are: [ours, theirs]`);
|
|
399
|
+
}
|
|
400
|
+
const refToSaveInLane = resolveUnrelated === 'ours' ? currentVersionRef : otherVersionRef;
|
|
401
|
+
const unrelatedHeadRef = resolveUnrelated === 'ours' ? otherVersionRef : currentVersionRef;
|
|
402
|
+
if (resolveUnrelated === 'ours') {
|
|
403
|
+
var _this$otherLane;
|
|
404
|
+
return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, (_this$otherLane = this.otherLane) === null || _this$otherLane === void 0 ? void 0 : _this$otherLane.toLaneId());
|
|
405
|
+
}
|
|
406
|
+
if (resolveUnrelated === 'theirs') {
|
|
407
|
+
var _this$currentLane5;
|
|
408
|
+
return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, (_this$currentLane5 = this.currentLane) === null || _this$currentLane5 === void 0 ? void 0 : _this$currentLane5.toLaneId());
|
|
409
|
+
}
|
|
410
|
+
throw new Error(`unsupported strategy "${resolveUnrelated}" of resolve-unrelated. supported strategies are: [ours, theirs]`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
exports.MergeStatusProvider = MergeStatusProvider;
|
|
414
|
+
|
|
415
|
+
//# sourceMappingURL=merge-status-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_bitId","_laneId","_getDivergeData","_repositories","_lodash","_threeWayMerge","_noCommonSnap","_configMerger","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","MergeStatusProvider","constructor","workspace","logger","importer","currentLane","otherLane","options","getStatus","bitIds","importObjectsFromMainIfExist","toBitIds","toVersionLatest","componentStatusBeforeMergeAttempt","mapSeries","id","getComponentStatusBeforeMergeAttempt","toImport","map","compStatus","divergeData","versionsToImport","compact","snapsOnTargetOnly","commonSnapBeforeDiverge","v","changeVersion","toString","flat","consumer","scope","scopeImporter","importWithoutDeps","BitIds","fromArray","lane","cache","includeVersionHistory","compStatusNotNeedMerge","c","mergeProps","compStatusNeedMerge","getComponentsStatusNeedMerge","tmp","Tmp","componentsStatus","Promise","all","getComponentMergeStatus","clear","err","results","componentMergeStatusBeforeMergeAttempt","_this$currentLane","currentComponent","Error","otherLaneHead","currentId","modelComponent","repo","objects","baseSnap","debug","toStringWithoutVersion","version","baseComponent","loadVersion","otherComponent","currentLaneName","toLaneId","otherLaneName","DEFAULT_LANE","currentLabel","otherLabel","workspaceIds","listIds","configMerger","ConfigMerger","extensions","configMergeResult","merge","mergeResults","threeWayMerge","returnUnmerged","msg","unmergedLegitimately","componentStatus","unmergedMessage","_this$currentLane2","_this$options","getModelComponentIfExist","unmerged","unmergedComponents","getEntry","name","getRef","existingBitMapId","bitMap","getBitIdIfExist","ignoreVersion","componentOnOther","idOnCurrentLane","getComponent","isRemoved","shouldMerge","shouldRemoveFromMain","shouldBeRemoved","getCurrentId","head","getHeadAsTagIfExist","getDivergeData","targetHead","throws","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","isTargetAhead","isModified","componentModificationStatus","getComponentStatusById","modified","undefined","isSourceCodeModified","isComponentSourceCodeModified","modifiedType","ignoreConfigChanges","_this$options2","NoCommonSnap","resolveUnrelated","message","handleNoCommonSnap","isDiverged","isSourceAhead","mainHead","returnAccordingToOurs","headToSaveInLane","unrelatedHead","unrelatedLaneId","resolvedUnrelated","strategy","headOnCurrentLane","returnAccordingToTheirs","resolvedRef","unrelatedHeadRef","currentVersionRef","otherVersionRef","hasResolvedFromMain","hashToCompare","divergeDataFromMain","sourceHead","hasResolvedLocally","getHeadRegardlessOfLane","hasResolvedRemotely","refToSaveInLane","_this$currentLane3","_this$currentLane4","_this$otherLane","_this$currentLane5","exports"],"sources":["merge-status-provider.ts"],"sourcesContent":["import { Workspace } from '@teambit/workspace';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport mapSeries from 'p-map-series';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { DEFAULT_LANE, LaneId } from '@teambit/lane-id';\nimport { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data';\nimport { Lane, ModelComponent, Version } from '@teambit/legacy/dist/scope/models';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { ImporterMain } from '@teambit/importer';\nimport { Logger } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport threeWayMerge from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';\nimport { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';\nimport { ConfigMerger } from './config-merger';\nimport { ComponentMergeStatus, ComponentMergeStatusBeforeMergeAttempt } from './merging.main.runtime';\n\nexport class MergeStatusProvider {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private importer: ImporterMain,\n private currentLane?: Lane, // currently checked out lane. if on main, then it's undefined.\n private otherLane?: Lane, // the lane we want to merged to our lane. (undefined if it's \"main\").\n private options?: { resolveUnrelated?: MergeStrategy; ignoreConfigChanges?: boolean }\n ) {}\n\n async getStatus(\n bitIds: BitId[] // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatus[]> {\n if (!this.currentLane && this.otherLane) {\n await this.importer.importObjectsFromMainIfExist(this.otherLane.toBitIds().toVersionLatest());\n }\n const componentStatusBeforeMergeAttempt = await mapSeries(bitIds, (id) =>\n this.getComponentStatusBeforeMergeAttempt(id)\n );\n const toImport = componentStatusBeforeMergeAttempt\n .map((compStatus) => {\n if (!compStatus.divergeData) return [];\n const versionsToImport = compact([\n ...compStatus.divergeData.snapsOnTargetOnly,\n compStatus.divergeData.commonSnapBeforeDiverge,\n ]);\n return versionsToImport.map((v) => compStatus.id.changeVersion(v.toString()));\n })\n .flat();\n\n await this.workspace.consumer.scope.scopeImporter.importWithoutDeps(BitIds.fromArray(toImport), {\n lane: this.otherLane,\n cache: true,\n includeVersionHistory: false,\n });\n\n const compStatusNotNeedMerge = componentStatusBeforeMergeAttempt.filter(\n (c) => !c.mergeProps\n ) as ComponentMergeStatus[];\n const compStatusNeedMerge = componentStatusBeforeMergeAttempt.filter((c) => c.mergeProps);\n\n const getComponentsStatusNeedMerge = async (): Promise<ComponentMergeStatus[]> => {\n const tmp = new Tmp(this.workspace.consumer.scope);\n try {\n const componentsStatus = await Promise.all(\n compStatusNeedMerge.map((compStatus) => this.getComponentMergeStatus(compStatus))\n );\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n const results = await getComponentsStatusNeedMerge();\n\n results.push(...compStatusNotNeedMerge);\n return results;\n }\n\n private async getComponentMergeStatus(\n componentMergeStatusBeforeMergeAttempt: ComponentMergeStatusBeforeMergeAttempt\n ) {\n const { id, divergeData, currentComponent, mergeProps } = componentMergeStatusBeforeMergeAttempt;\n if (!mergeProps) throw new Error(`getDivergedMergeStatus, mergeProps is missing for ${id.toString()}`);\n const { otherLaneHead, currentId, modelComponent } = mergeProps;\n const repo = this.workspace.consumer.scope.objects;\n if (!divergeData) throw new Error(`getDivergedMergeStatus, divergeData is missing for ${id.toString()}`);\n if (!currentComponent) throw new Error(`getDivergedMergeStatus, currentComponent is missing for ${id.toString()}`);\n\n const baseSnap = divergeData.commonSnapBeforeDiverge as Ref; // must be set when isTrueMerge\n this.logger.debug(`merging snaps details:\nid: ${id.toStringWithoutVersion()}\nbase: ${baseSnap.toString()}\ncurrent: ${currentId.version}\nother: ${otherLaneHead.toString()}`);\n const baseComponent: Version = await modelComponent.loadVersion(baseSnap.toString(), repo);\n const otherComponent: Version = await modelComponent.loadVersion(otherLaneHead.toString(), repo);\n\n const currentLaneName = this.currentLane?.toLaneId().toString() || 'main';\n const otherLaneName = this.otherLane ? this.otherLane.toLaneId().toString() : DEFAULT_LANE;\n const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;\n const otherLabel = `${otherLaneHead.toString()} (${\n otherLaneName === currentLaneName ? 'incoming' : otherLaneName\n })`;\n const workspaceIds = await this.workspace.listIds();\n const configMerger = new ConfigMerger(\n id.toStringWithoutVersion(),\n workspaceIds,\n this.otherLane,\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions,\n currentLabel,\n otherLabel,\n this.logger\n );\n const configMergeResult = configMerger.merge();\n\n const mergeResults = await threeWayMerge({\n consumer: this.workspace.consumer,\n otherComponent,\n otherLabel,\n currentComponent,\n currentLabel,\n baseComponent,\n });\n return { currentComponent, id, mergeResults, divergeData, configMergeResult };\n }\n\n private returnUnmerged(id: BitId, msg: string, unmergedLegitimately = false): ComponentMergeStatusBeforeMergeAttempt {\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n componentStatus.unmergedMessage = msg;\n componentStatus.unmergedLegitimately = unmergedLegitimately;\n return componentStatus;\n }\n\n private async getComponentStatusBeforeMergeAttempt(\n id: BitId // the id.version is the version we want to merge to the current component\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const componentStatus: ComponentMergeStatusBeforeMergeAttempt = { id };\n const modelComponent = await consumer.scope.getModelComponentIfExist(id);\n if (!modelComponent) {\n return this.returnUnmerged(\n id,\n `component ${id.toString()} is on the lane/main but its objects were not found, please re-import the lane`\n );\n }\n const unmerged = consumer.scope.objects.unmergedComponents.getEntry(id.name);\n if (unmerged) {\n return this.returnUnmerged(\n id,\n `component ${id.toStringWithoutVersion()} is in during-merge state a previous merge, please snap/tag it first (or use bit merge --resolve/--abort/ bit lane merge-abort)`\n );\n }\n const repo = consumer.scope.objects;\n const version = id.version as string;\n const otherLaneHead = modelComponent.getRef(version);\n const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, { ignoreVersion: true });\n const componentOnOther: Version = await modelComponent.loadVersion(version, consumer.scope.objects);\n const idOnCurrentLane = this.currentLane?.getComponent(id);\n\n if (componentOnOther.isRemoved()) {\n // if exist in current lane, we want the current lane to get the soft-remove update.\n // or if it was removed with --update-main, we want to merge it so then main will get the update.\n const shouldMerge = idOnCurrentLane || componentOnOther.shouldRemoveFromMain();\n if (shouldMerge) {\n // remove the component from the workspace if exist.\n componentStatus.shouldBeRemoved = true;\n } else {\n // on main, don't merge soft-removed components unless it's marked with removeOnMain.\n // on lane, if it's not part of the current lane, don't merge it.\n return this.returnUnmerged(id, `component has been removed`, true);\n }\n }\n const getCurrentId = () => {\n if (existingBitMapId) return existingBitMapId;\n if (this.currentLane) {\n if (!idOnCurrentLane) return null;\n return idOnCurrentLane.id.changeVersion(idOnCurrentLane.head.toString());\n }\n // it's on main\n const head = modelComponent.getHeadAsTagIfExist();\n if (head) {\n return id.changeVersion(head);\n }\n return null;\n };\n const currentId = getCurrentId();\n if (!currentId) {\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n return { ...componentStatus, componentFromModel: componentOnOther, divergeData };\n }\n const getCurrentComponent = () => {\n if (existingBitMapId) return consumer.loadComponent(existingBitMapId);\n return consumer.scope.getConsumerComponent(currentId);\n };\n const currentComponent = await getCurrentComponent();\n if (currentComponent.isRemoved()) {\n // we have a few options:\n // 1. other is ahead. in this case, other recovered the component. so we can continue with the merge.\n // it is possible that it is diverged, in which case, still continue with the merge, and later on, the\n // merge-config will show a config conflict of the remove aspect.\n // 2. other is not ahead. in this case, just ignore this component, no point to merge it, we want it removed.\n // 3. there are errors when calculating the divergeData, e.g. no snap in common. in such cases, we assume\n // there are issues with this component, and is better not to merge it.\n const divergeData = await getDivergeData({ repo, modelComponent, targetHead: otherLaneHead, throws: false });\n if (divergeData.err || !divergeData.isTargetAhead()) {\n return this.returnUnmerged(id, `component has been removed`, true);\n }\n }\n\n const isModified = async (): Promise<undefined | 'code' | 'config'> => {\n const componentModificationStatus = await consumer.getComponentStatusById(currentComponent.id);\n if (!componentModificationStatus.modified) return undefined;\n if (!existingBitMapId) return undefined;\n const baseComponent = await modelComponent.loadVersion(\n existingBitMapId.version as string,\n consumer.scope.objects\n );\n const isSourceCodeModified = await consumer.isComponentSourceCodeModified(baseComponent, currentComponent);\n if (isSourceCodeModified) return 'code';\n return 'config';\n };\n\n const modifiedType = await isModified();\n if (modifiedType === 'config' && !this.options?.ignoreConfigChanges) {\n return this.returnUnmerged(\n id,\n `component has config changes, please snap/tag it first. alternatively, use --ignore-config-changes flag to bypass`\n );\n }\n if (modifiedType === 'code') {\n return this.returnUnmerged(id, `component is modified, please snap/tag it first`);\n }\n\n if (!otherLaneHead) {\n throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);\n }\n const divergeData = await getDivergeData({\n repo,\n modelComponent,\n targetHead: otherLaneHead,\n throws: false,\n });\n if (divergeData.err) {\n if (!(divergeData.err instanceof NoCommonSnap) || !this.options?.resolveUnrelated) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. error: ${divergeData.err.message}`\n );\n }\n return this.handleNoCommonSnap(\n modelComponent,\n id,\n otherLaneHead,\n currentComponent,\n componentOnOther,\n divergeData\n );\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isSourceAhead()) {\n // do nothing!\n return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is ahead, nothing to merge`, true);\n }\n if (divergeData.isTargetAhead()) {\n // just override with the model data\n return {\n ...componentStatus,\n currentComponent,\n componentFromModel: componentOnOther,\n divergeData,\n };\n }\n // we know that localHead and remoteHead are set, so if none of them is ahead they must be equal\n return this.returnUnmerged(id, `component ${currentComponent.id.toString()} is already merged`, true);\n }\n\n // it's diverged and needs merge operation\n const mergeProps = {\n otherLaneHead,\n currentId,\n modelComponent,\n };\n\n return { ...componentStatus, currentComponent, mergeProps, divergeData };\n }\n\n private async handleNoCommonSnap(\n modelComponent: ModelComponent,\n id: BitId,\n otherLaneHead: Ref,\n currentComponent: ConsumerComponent,\n componentOnOther?: Version,\n divergeData?: SnapsDistance\n ): Promise<ComponentMergeStatusBeforeMergeAttempt> {\n const { resolveUnrelated } = this.options || {};\n if (!resolveUnrelated) throw new Error(`handleNoCommonSnap expects resolveUnrelated to be set`);\n const consumer = this.workspace.consumer;\n const repo = consumer.scope.objects;\n const mainHead = modelComponent.head;\n\n const returnAccordingToOurs = (\n headToSaveInLane: Ref,\n unrelatedHead: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n return {\n currentComponent,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'ours',\n headOnCurrentLane: headToSaveInLane,\n unrelatedHead,\n unrelatedLaneId,\n },\n };\n };\n const returnAccordingToTheirs = (\n resolvedRef: Ref,\n unrelatedHeadRef: Ref,\n unrelatedLaneId: LaneId\n ): ComponentMergeStatusBeforeMergeAttempt => {\n // just override with the model data\n return {\n currentComponent,\n componentFromModel: componentOnOther,\n id,\n divergeData,\n resolvedUnrelated: {\n strategy: 'theirs',\n headOnCurrentLane: resolvedRef,\n unrelatedHead: unrelatedHeadRef,\n unrelatedLaneId,\n },\n };\n };\n\n const currentVersionRef = modelComponent.getRef(currentComponent.id.version as string);\n if (!currentVersionRef)\n throw new Error(\n `handleNoCommonSnap, unable to get ref of current version \"${\n currentComponent.id.version\n }\" for \"${id.toString()}\"`\n );\n const otherVersionRef = modelComponent.getRef(id.version as string);\n if (!otherVersionRef)\n throw new Error(`handleNoCommonSnap, unable to get ref of other version \"${id.version}\" for \"${id.toString()}\"`);\n\n if (mainHead) {\n const hasResolvedFromMain = async (hashToCompare: Ref | null) => {\n const divergeDataFromMain = await getDivergeData({\n repo,\n modelComponent,\n sourceHead: hashToCompare,\n targetHead: mainHead,\n throws: false,\n });\n if (!divergeDataFromMain.err) return true;\n return !(divergeDataFromMain.err instanceof NoCommonSnap);\n };\n const hasResolvedLocally = await hasResolvedFromMain(modelComponent.getHeadRegardlessOfLane() as Ref);\n const hasResolvedRemotely = await hasResolvedFromMain(otherLaneHead);\n if (!hasResolvedLocally && !hasResolvedRemotely) {\n return this.returnUnmerged(\n id,\n `unable to traverse ${currentComponent.id.toString()} history. the main-head ${mainHead.toString()} doesn't appear in both lanes.\nit was probably created in each lane separately and it also exists on main. please merge main first to one of these lanes`\n );\n }\n const refToSaveInLane = hasResolvedLocally ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = hasResolvedLocally ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n\n const refToSaveInLane = resolveUnrelated === 'ours' ? currentVersionRef : otherVersionRef;\n const unrelatedHeadRef = resolveUnrelated === 'ours' ? otherVersionRef : currentVersionRef;\n if (resolveUnrelated === 'ours') {\n return returnAccordingToOurs(refToSaveInLane, unrelatedHeadRef, this.otherLane?.toLaneId() as LaneId);\n }\n if (resolveUnrelated === 'theirs') {\n return returnAccordingToTheirs(refToSaveInLane, unrelatedHeadRef, this.currentLane?.toLaneId() as LaneId);\n }\n throw new Error(\n `unsupported strategy \"${resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,cAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,eAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,cAAA,YAAA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KAAK,MAAM,EAAE;MAAA,IAAA4B,eAAA;MAC/B,OAAOtB,qBAAqB,CAACmB,eAAe,EAAEV,gBAAgB,GAAAa,eAAA,GAAE,IAAI,CAACvJ,SAAS,cAAAuJ,eAAA,uBAAdA,eAAA,CAAgBxF,QAAQ,CAAC,CAAW,CAAC;IACvG;IACA,IAAI4D,gBAAgB,KAAK,QAAQ,EAAE;MAAA,IAAA6B,kBAAA;MACjC,OAAOhB,uBAAuB,CAACY,eAAe,EAAEV,gBAAgB,GAAAc,kBAAA,GAAE,IAAI,CAACzJ,WAAW,cAAAyJ,kBAAA,uBAAhBA,kBAAA,CAAkBzF,QAAQ,CAAC,CAAW,CAAC;IAC3G;IACA,MAAM,IAAId,KAAK,CACZ,yBAAwB0E,gBAAiB,kEAC5C,CAAC;EACH;AACF;AAAC8B,OAAA,CAAA/J,mBAAA,GAAAA,mBAAA"}
|
|
@@ -23,7 +23,9 @@ import { InstallMain } from '@teambit/install';
|
|
|
23
23
|
import { ConfigMergeResult } from './config-merge-result';
|
|
24
24
|
declare type ResolveUnrelatedData = {
|
|
25
25
|
strategy: MergeStrategy;
|
|
26
|
-
|
|
26
|
+
headOnCurrentLane: Ref;
|
|
27
|
+
unrelatedHead: Ref;
|
|
28
|
+
unrelatedLaneId: LaneId;
|
|
27
29
|
};
|
|
28
30
|
export declare type WorkspaceDepsUpdates = {
|
|
29
31
|
[pkgName: string]: [string, string];
|
|
@@ -119,8 +121,6 @@ export declare class MergingMain {
|
|
|
119
121
|
resolveUnrelated?: MergeStrategy;
|
|
120
122
|
ignoreConfigChanges?: boolean;
|
|
121
123
|
}): Promise<ComponentMergeStatus[]>;
|
|
122
|
-
private getComponentStatusBeforeMergeAttempt;
|
|
123
|
-
private getComponentMergeStatus;
|
|
124
124
|
private applyVersion;
|
|
125
125
|
private abortMerge;
|
|
126
126
|
private resolveMerge;
|